Multiple connections from same IP - 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)
+--- Thread: Multiple connections from same IP (
/showthread.php?tid=319572)
Multiple connections from same IP -
Gumica - 19.02.2012
How to block multiple connections from same IP? If that is possible, how can I make it?
Re: Multiple connections from same IP -
JhnzRep - 19.02.2012
Try this under OPlayerConnect.
pawn Code:
for (new i = 0; i != MAX_PLAYERS; ++i)
{
new connectingip[16], oldip[16];
GetPlayerIp(i, oldip, sizeof(oldip));
GetPlayerIp(playerid, connectingip, sizeof(connectingip));
if(connectingip[i] == oldip[playerid])
{
Kick(playerid);
}
}
Re: Multiple connections from same IP -
Warfish - 19.02.2012
why would you do that? When I go to my friend and we play both sa-mp we have the same IP, there is nothing wrong with two players that have the same IP..
Re: Multiple connections from same IP -
2KY - 19.02.2012
Something like...
pawn Code:
new
ConnectedIP[MAX_PLAYERS][16];
public OnPlayerConnect(playerid)
{
new
p_IP[16],
g_IP[16]
;
GetPlayerIp(playerid, ConnectedIP[playerid], 16);
for ( new u; u < MAX_PLAYERS; u++ )
{
GetPlayerIp(u, g_IP, sizeof(g_IP));
if(g_IP[u] == p_IP[playerid])
{
//Multiple IPS! - Do something!
}
}
return 1;
}
This is untested, and it compiles, but I'm not sure it'll work.