SA-MP Forums Archive
Help With Getting An 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: Help With Getting An Ip (/showthread.php?tid=515692)



Help With Getting An Ip - AroseKhanNiazi - 27.05.2014

how can i do that if the player does not join with the ip in script his ip is banned not the name


Re: Help With Getting An Ip - ReD_HunTeR - 27.05.2014

what do you mean?


Re: Help With Getting An Ip - AroseKhanNiazi - 27.05.2014

i mean i got an static ip (that never changes) so i want in script that no one else can join with my name i mean no one can join it without my ip


Re: Help With Getting An Ip - R0 - 27.05.2014

you mean the function for banning player's ip?


Re: Help With Getting An Ip - AroseKhanNiazi - 27.05.2014

example a player join with ip 136.545.448.455 and the ip for that nick name in script is 145.145.145.145(just example) his ip 136.545.448.455 (only ip not name) gets banned


Re: Help With Getting An Ip - R0 - 27.05.2014

to ban player's ip,not the user
pawn Код:
new ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
format(string, sizeof(string),"banip %s", ip);
SendRconCommand(string);
SendRconCommand("reloadbans");



Re: Help With Getting An Ip - Khanz - 27.05.2014

just put a password on the server.


Re: Help With Getting An Ip - AroseKhanNiazi - 27.05.2014

and how to get that which ip is not = to or == the ip in script


Re: Help With Getting An Ip - Affan - 27.05.2014

OnPlayerConnect
pawn Код:
new ip[16], string[128];
if(!GetPlayerIp(playerid, ip, sizeof(ip)) == 127.0.0.1)
{
     format(string, sizeof(string),"banip %s", ip);
     SendRconCommand(string);
     SendRconCommand("reloadbans");
}
Try?


Re: Help With Getting An Ip - Konstantinos - 27.05.2014

pawn Код:
// OnPlayerConnect:
new
    szName[MAX_PLAYER_NAME],
    szIP[16];

GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
GetPlayerIP(playerid, szIP, 16);
if (!strcmp(szName, "AroseKhanNaizi", true, MAX_PLAYER_NAME) && strcmp(szIP, "145.145.145.145"))
{
    // player's name is AroseKhanNaizi and the IP is not the one from the script..
    // do your code..
}