#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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
Reply
#5

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).
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

Omg, i want to use it for 'Auto Login'
Reply
#10

check out the tutorial section....most of them have your ip saving and auto login..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)