SA-MP Forums Archive
help plix? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help plix? (/showthread.php?tid=66715)



help plix? - Flo_White - 23.02.2009

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


Re: help plix? - Rks25 - 23.02.2009

you need these functions:
- GetPlayerIp
- Strcmp
- SendClientMessage


Re: help plix? - Flo_White - 23.02.2009

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


Re: help plix? - Lazarus - 23.02.2009

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.


Re: help plix? - Finn - 23.02.2009

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