[UN SOLVED] Autokick wrong ip + name - 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: [UN SOLVED] Autokick wrong ip + name (
/showthread.php?tid=100994)
[UN SOLVED] Autokick wrong ip + name -
BP13 - 07.10.2009
How do I make it so when someone connects with my name and it is
NOT my IP Address they get autokicked (and FYI my Ip address never changes)
Quote:
Originally Posted by [SU
BP13 ]
ok. I guess you dont know what im talking about. Ill write it out with math
Name: [SU]BP13 + IP: 99.248.243.238 = Join
Name: [SU]BP13 + IP: Any IP Except 99.248.243.238 = Kicked For Impersonating Me.
|
Re: Autokick wrong ip + name -
dice7 - 07.10.2009
https://sampwiki.blast.hk/wiki/OnPlayerConnect
https://sampwiki.blast.hk/wiki/GetPlayerIp
https://sampwiki.blast.hk/wiki/Strcmp
https://sampwiki.blast.hk/wiki/Kick
Re: Autokick wrong ip + name -
BP13 - 07.10.2009
ok. would this work?
pawn Код:
new name[16];
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "[SU]BP13"))
{
if(!strcmp(plrIP, "99.248.243.238"))
{
SendClientMessage(playerid, COLOR_BASIC, "Welcome [SU]BP13!");
}
else
{
Ban(playerid);
}
}
Re: Autokick wrong ip + name -
viKKmaN - 07.10.2009
pawn Код:
new name[16];
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "[SU]BP13", 8))
{
if(strcmp(plrIP, "YOUR IP HERE"))
{
Kick(playerid);
}
}
Yes it will work but look at what i posted above. Optimized code (i believe that "welcome blablablah" is rubbish, considering that you know your name...) + no need to ban the player, just a kick will do the trick since you might loose regular players. Also as you can see "if(!strcmp(name, "[SU]BP13",

)" compares only 8 chars so it helps those "smarter exploiters" that might add another letter at the end(as for adding a letter infront of it... you gotta figure that out on your own).
Re: Autokick wrong ip + name -
BP13 - 07.10.2009
ok. I guess you dont know what im talking about. Ill write it out with math
Name: [SU]BP13 + IP: 99.248.243.238 = Join
Name: [SU]BP13 + IP: Any IP Except 99.248.243.238 = Kicked For Impersonating Me.
Re: Autokick wrong ip + name -
Hiitch - 07.10.2009
pawn Код:
if(strcmp(plrIP, "YOUR IP HERE"))
{
Kick(playerid);
}
I'm not 100% sure if this would work (the thing I will suggest below) but I've tried it connecting to my own server through an IP that was set up.
pawn Код:
if(!strcmp(plrIP, "127.0.0.1"))
{
Kick(playerid);
}
I'm just thinking of this, dont know if it will work or not though.
Re: Autokick wrong ip + name -
BP13 - 07.10.2009
Quote:
Originally Posted by djlobo[Awesome-games.tk
]
with that code you will ban yourself
check range ip not the whole ip because in next connection with internet your ip can change:
example :
Quote:
instead of 91.91.91.91
...
91.91.*.*
|
|
couldent the range be anything?