help plix?
#1

hello

can anyone help me with scripting, that i can see a message when 2 players in the server have the same ip?
like guy1 is on the server, then guy2 connects and has the same ip like guy1, then admins get a message, that they have the same ip

greetings
Reply
#2

you need these functions:
- GetPlayerIp
- Strcmp
- SendClientMessage
Reply
#3

Quote:
Originally Posted by Rks_
you need these functions:
- GetPlayerIp
- Strcmp
- SendClientMessage
okay thanks, i'll try
Reply
#4

Meh.

pawn Код:
for(new a = 0; a < MAX_PLAYERS; a++)
{
    new ip1[16];
    GetPlayerIp(a, ip1, sizeof(ip1));

    for(new b = 0; b < MAX_PLAYERS; b++)
    {
        new ip2[16];
        GetPlayerIp(b, ip2, sizeof(ip2));

        if(strcmp(ip1, ip2, true) == 0)
        {
            new string[56];
            format(string, sizeof(string), "%d has the same IP as you :O!", b);
            SendPlayerMessage(a, 0xFFFFFFFF, string);
        }
    }
}
Would be really bad and laggy for your server, and no guarantees that it would work.
Reply
#5

To above ^: Why do you even show your code if you know that it sucks or if you're not even sure that it works?

pawn Код:
public OnPlayerConnect(playerid)
{
  new IP1[16], IP2[16];
  GetPlayerIp(playerid, IP1, sizeof(IP1));
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    GetPlayerIp(i, IP2, sizeof(IP2));
    if(!strcmp(IP1, IP2, true))
    {
      new string[70];
      format(string, sizeof(string), "Players [ID: %d] and [ID: %d] have the same IP. USE TEH BANHAMMORZ!", playerid, i);
      for(new a = 0; a < MAX_PLAYERS; a++) if(IsPlayerAdmin(a)) SendClientMessage(a, COLOR_SOMECOOLCOLOR, string);
      return 1;
    }
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)