SA-MP Forums Archive
Please help with GetPlayerIp - 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: Please help with GetPlayerIp (/showthread.php?tid=612139)



Please help with GetPlayerIp - TayFunCZE - 14.07.2016

Hello, this code is working, but "NORMAL IP" and "REG IP" wasn't show player's IP, it's empty.
Please help me what is bad.
PHP код:
format(stringsizeof(string), "[NORMAL IP - %s][REG IP - %s][PING: %d]",GetPlayerIp(targetidplayerIPsizeof(playerIP)),PlayerData[playerid][pIP],GetPlayerPing(playerid));
SendClientMessage(playerid,BLUE,string); 



Re: Please help with GetPlayerIp - Vince - 14.07.2016

GetPlayerIp itself only returns 0 or 1 depending on whether the player is connected. It cannot be used inline like that. The result is stored in the variable that is passed as the second parameter (playerIP) and it is this value that you will want to use in format().


Re: Please help with GetPlayerIp - TayFunCZE - 14.07.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
GetPlayerIp itself only returns 0 or 1 depending on whether the player is connected. It cannot be used inline like that. The result is stored in the variable that is passed as the second parameter (playerIP) and it is this value that you will want to use in format().
OK, and can you help me with code please?


Re: Please help with GetPlayerIp - Freaksken - 14.07.2016

Quote:
Originally Posted by TayFunCZE
Посмотреть сообщение
OK, and can you help me with code please?
You can find a complete example on the wiki.
There is a wiki for SA-MP, use it.


Re: Please help with GetPlayerIp - TayFunCZE - 14.07.2016

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
You can find a complete example on the wiki.
There is a wiki for SA-MP, use it.
I used it -_-


Re: Please help with GetPlayerIp - AbyssMorgan - 14.07.2016

PHP код:
GetPlayerIp(targetidplayerIPsizeof(playerIP));
format(stringsizeof(string), "[NORMAL IP - %s][REG IP - %s][PING: %d]",playerIP,PlayerData[playerid][pIP],GetPlayerPing(playerid)); 
SendClientMessage(playerid,BLUE,string); 



Re: Please help with GetPlayerIp - Crayder - 14.07.2016

new str[16];
GetPlayerIp(playerid, str, sizeof str);
//now use 'str', which is the IP


Re: Please help with GetPlayerIp - TayFunCZE - 14.07.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
GetPlayerIp(targetidplayerIPsizeof(playerIP));
format(stringsizeof(string), "[NORMAL IP - %s][REG IP - %s][PING: %d]",playerIP,PlayerData[playerid][pIP],GetPlayerPing(playerid)); 
SendClientMessage(playerid,BLUE,string); 
OK, thanks man..


Re: Please help with GetPlayerIp - TayFunCZE - 14.07.2016

Quote:
Originally Posted by Crayder
Посмотреть сообщение
new str[16];
GetPlayerIp(playerid, str, sizeof str);
//now use 'str', which is the IP
I can't use playerIP?


Re: Please help with GetPlayerIp - TayFunCZE - 14.07.2016

FIXED - 100% working, thank you everybody who help