Valhalla Legends Forums Archive | Battle.net Bot Development | C Bot Programming

AuthorMessageTime
Presence
Yo can anyone here help me with the script for connecting a bot on C ?

(plz no flaming)
March 1, 2003, 1:38 AM
Presence
rr... i meant
the script in C language
for connecting a bot :D
March 1, 2003, 1:39 AM
St0rm.iD
greetbot
March 1, 2003, 1:03 PM
Moonshine
Side note: The proper term in C is source code, not scripts.
March 2, 2003, 4:58 AM
Presence
okay so im a total newbie...
can anyone help me ?
March 4, 2003, 11:39 PM
ILurker
[code]
int BnBot::Connect() {
 struct sockaddr_in name;
 struct hostent *hp;

 memset(&name, '\0', sizeof(name));
 name.sin_family = AF_INET;
 name.sin_port = htons(nServerPort);

 // if this is a hostname and not an IP address, resolve it
 char *p = szServerAddr;
 while (*p && (isdigit(*p) || (*p == '.'))) {
   p++;
 }

 // non-digit found - assume hostname
 if (*p) {
   hp = gethostbyname(szServerAddr);
   if (hp == 0)
     return 0;         // can't resolve hostname
   memcpy(&name.sin_addr, hp->h_addr, hp->h_length);
 }
 else {
   name.sin_addr.s_addr = inet_addr(szServerAddr);
 }

 s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 if (s == INVALID_SOCKET) {
   return 0;
 }

 if (connect(s, (struct sockaddr *)&name, sizeof(name))) {
   return 0;
 }

 return 1;
}[/code]
March 5, 2003, 12:22 AM
Kp
ILurker: I must point out that he asked for C code.  Your function is a class member, which only works in C++. *g*
March 5, 2003, 12:58 PM
MrRaza
gogogo C! ;D
March 5, 2003, 1:05 PM
Noodlez
[quote]ILurker: I must point out that he asked for C code.  Your function is a class member, which only works in C++. *g*[/quote]
It's not even his function... that's straight out of DMBot
March 6, 2003, 9:21 PM
zorm
Silly noodlez, you are wrong. That is from greetbot/bnx!
March 6, 2003, 9:31 PM
St0rm.iD
NOODLEZ GOT OWNED.
March 8, 2003, 12:05 AM
ILurker
Zorm is right, and +, i was bored so i just threw a c++ code at him, that i had in my folder that i was going to delete
i bairly know c++, so i couldnt well explain the source to him
March 8, 2003, 12:38 AM
Noodlez
/me cries
then dmbot stole it!
March 8, 2003, 2:26 AM
ILurker
Wonder when the stars will be fixed  :-/ ( the forum member rank thingy's )
March 8, 2003, 3:29 AM
tA-Kane
[quote]Wonder when the stars will be fixed[/quote]
They're broken?
March 8, 2003, 8:34 AM
Yoni
[quote]Wonder when the stars will be fixed  :-/ ( the forum member rank thingy's )[/quote]
They work exactly the way they're meant to.
March 8, 2003, 9:43 AM

Search