17.11.2013, 16:50
I'm using the last (R34) BlueG's( or by the current developer maddinat0r) mysql plugin, I'm not even sure if the problems is from the mysql part, but I'm trying to save player's IP when player leaves. The problem is that everybody's IP goes 255.255.255.255. There is part of my code:
I know that getting IP wasn't working either on the onplayerconnect or onplayerdisconnect callback, but I don't remember which one. So what is the solution there ?
Thanks in advance.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(Logged[playerid] == 1)
{
new query[512];
format(query, sizeof(query), "UPDATE players SET IP = '%s' WHERE Name = '%s'", GetIP(playerid), GetPName(playerid));
mysql_function_query(IMDb, query, false, "", "");
}
return 1;
}
stock GetPName(playerid)
{
GetPlayerName(playerid,gName,sizeof gName);
return gName;
}
stock GetIP(playerid)
{
new gIP[16];
GetPlayerIp(playerid, gIP, sizeof gIP);
return gIP;
}
Thanks in advance.