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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IP (
/showthread.php?tid=214923)
IP -
Linus- - 22.01.2011
Hey, i have this code 'OnPlayerDisConnect'
pawn Код:
if (GetPVarInt(playerid,"Logged") == 1 && INI_Exist(pName(playerid)))
{
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
new PlayerFile[ 13 + MAX_PLAYER_NAME + 1];
format( PlayerFile , sizeof PlayerFile, "Accounts/%s.ini", Encode(pName(playerid)));
new INI:PlayerAcc = INI_Open(PlayerFile);
INI_WriteString( PlayerAcc, "IP",plrIP);
INI_Close(PlayerAcc);
}
But its shows ip 'IP = 255.255.255.255' but not showing my ip '196.96.64.1'
How can i fix it?
Re: IP -
JaTochNietDan - 22.01.2011
GetPlayerIP doesn't work in OnPlayerDisconnect, you should store it for everyone in a multi-dimensional array OnPlayerConnect and just use that variable when you want to use the IP somewhere.
Re: IP -
Linus- - 22.01.2011
Quote:
Originally Posted by JaTochNietDan
GetPlayerIP doesn't work in OnPlayerDisconnect, you should store it for everyone in a multi-dimensional array OnPlayerConnect and just use that variable when you want to use the IP somewhere.
|
ohh okay thanks.
Re: IP -
Finn - 22.01.2011
Could be if you're running the server on your own PC it gives that IP, might not be a bug at all.
Edit: Ah, it indeed was a bug. :P
Re: IP -
Mike Garber - 22.01.2011
Quote:
Originally Posted by Finn
Could be if you're running the server on your own PC it gives that IP, might not be a bug at all.
Edit: Ah, it indeed was a bug. :P
|
No, It's not a bug. 255.255.255.255 is a local DNS, and not his IP. It means that the server couldn't retrieve the IP from the DNS, because the player was already disconnected.
You can't fix It, SA:MP cannot control the time it takes for your computer to terminate the process (and disconnect from the server).
Re: IP -
Finn - 22.01.2011
Quote:
Originally Posted by Mike Garber
No, It's not a bug. 255.255.255.255 is a local DNS, and not his IP. It means that the server couldn't retrieve the IP from the DNS, because the player was already disconnected.
You can't fix It, SA:MP cannot control the time it takes for your computer to terminate the process (and disconnect from the server).
|
Of course the script is bugged somehow if it is not working like it should.
JaTochNietDan just gave the solution for this problem.
Re: IP -
Mike Garber - 22.01.2011
Quote:
Originally Posted by Finn
Of course the script is bugged somehow if it is not working like it should.
JaTochNietDan just gave the solution for this problem.
|
It is NOT a bug. JaTochNietDan gave a solution to the problem, but It still doesn't make GetPlayerIp work under OnPlayerDisconnect, which you said was a bug.
Re: IP -
Finn - 22.01.2011
Quote:
Originally Posted by Mike Garber
It is NOT a bug. JaTochNietDan gave a solution to the problem, but It still doesn't make GetPlayerIp work under OnPlayerDisconnect, which you said was a bug.
|
Of course it should work in OnPlayerDisconnect. If the player is already disconnected when that callback gets called, the callback should be OnPlayerDisconnected.
Even IsPlayerConnected returns true in OnPlayerDisconnect.
Re: IP -
Linus- - 22.01.2011
Omg, i want to use it for 'Auto Login'
Re: IP -
Anthonyx3' - 22.01.2011
check out the tutorial section....most of them have your ip saving and auto login..