• Welcome to Valhalla Legends Archive.
 

C Bot Programming

Started by Presence, February 28, 2003, 07:38 PM

Previous topic - Next topic

Presence

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

(plz no flaming)

Presence

#1
rr... i meant
the script in C language
for connecting a bot :D

Banana fanna fo fanna

#2
greetbot

Moonshine

Side note: The proper term in C is source code, not scripts.

Presence

#4
okay so im a total newbie...
can anyone help me ?

ILurker

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;
}

Kp

#6
ILurker: I must point out that he asked for C code.  Your function is a class member, which only works in C++. *g*
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

MrRaza

#7
gogogo C! ;D

Noodlez

#8
QuoteILurker: I must point out that he asked for C code.  Your function is a class member, which only works in C++. *g*
It's not even his function... that's straight out of DMBot

Zorm

#9
Silly noodlez, you are wrong. That is from greetbot/bnx!
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

Banana fanna fo fanna

#10
NOODLEZ GOT OWNED.

ILurker

#11
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

Noodlez

#12
/me cries
then dmbot stole it!

ILurker

Wonder when the stars will be fixed  :-/ ( the forum member rank thingy's )

tA-Kane

#14
QuoteWonder when the stars will be fixed
They're broken?
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com