public OnPlayerDisconnect(playerid, reason)
{
new Query[100];
format(Query,sizeof(Query),"UPDATE playerdata SET money=%d, score=%d, ip=%s WHERE username='%s'",GetPlayerMoney(playerid),GetPlayerScore(playerid),GetPlayerIP(playerid),PlayerName(playerid));
mysql_query(Query);
return true;
}
stock GetPlayerIP(playerid)
{
new Ip[25];
GetPlayerIp(playerid, Ip, sizeof(Ip));
return Ip;
}
this is my login dialog
format(Query,sizeof(Query),"SELECT username FROM playerdata WHERE username='%s' AND password='%s'",PlayerName(playerid),inputtext);
mysql_query(Query);
mysql_store_result();
format(Query, sizeof(Query), "INSERT INTO playerdata IP VALUES '%s'",GetPlayerIP(playerid));
// Top of script
new PlayerIP[MAX_PLAYERS][16];
// Login
format(PlayerIP[playerid], 16, "%s", GetPlayerIP(playerid));
// Disconnect
Use "PlayerIP[playerid]"
pawn Код:
|
if( dialogid == DIALOG_LOGIN )
{
new Query[100];
if(!response) return
Kick(playerid),
SendClientMessage(playerid,-1,"Login exit");
format(Query,sizeof(Query),"SELECT username FROM playerdata WHERE username='%s' AND password='%s'",PlayerName(playerid),inputtext);
new PlayerIP[MAX_PLAYERS][16];
format(PlayerIP[playerid], 16, "%s", GetPlayerIP(playerid));
mysql_query(Query);
mysql_store_result();
if( dialogid == DIALOG_REGISTER )
{
new Query[100];// line 353
if(!response) return
Kick(playerid),
SendClientMessage(playerid,COLOR_RED,"You have cansel to register!");
format(Query,sizeof(Query),"INSERT INTO playerdata (username,password,score,money,ip) VALUES ('%s','%s',0,0,'%s')",PlayerName(playerid),inputtext);
mysql_query(Query);
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Header size: 2696 bytes
Code size: 33520 bytes
Data size: 21912 bytes
Stack/heap size: 16384 bytes; estimated max. usage=14156 cells (56624 bytes)
Total requirements: 74512 bytes