public OnAccountLoad(playerid) { new score; pData[playerid][Admin] = cache_get_field_content_int(0, "Admin"); pData[playerid][VIP] = cache_get_field_content_int(0, "VIP"); pData[playerid][Money] = cache_get_field_content_int(0, "Money"); pData[playerid][Deaths] = cache_get_field_content_int(0, "Deaths"); pData[playerid][MissionsPlayed] = cache_get_field_content_int(0, "MissionsPlayed"); pData[playerid][VipTime] = cache_get_field_content_int(0, "VipTime"); pData[playerid][Warns] = cache_get_field_content_int(0, "Warns"); pData[playerid][Cookies] = cache_get_field_content_int(0, "Cookies"); pData[playerid][Jailed] = cache_get_field_content_int(0, "Jailed"); pData[playerid][Muted] = cache_get_field_content_int(0, "Muted"); pData[playerid][Duty] = cache_get_field_content_int(0, "Duty"); pData[playerid][Nopm] = cache_get_field_content_int(0, "Nopm"); pData[playerid][RegisterDate] = cache_get_field_content_int(0, "RegisterDate"); score = cache_get_field_content_int(0, "Score"); SetPlayerScore(playerid, score); GivePlayerCash(playerid, pData[playerid][Money]); SendClientMessage(playerid,red,"------------------------------------------------------"); new playername3[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername3, sizeof(playername3)); new string[128]; format(string,sizeof(string),"* System: Welcome back {F70505}%s (%d) {FFFFFF} - Your stats have been restored.",playername3,playerid); SCM(playerid,-1,string); SendClientMessage(playerid,red,"------------------------------------------------------"); CheckVipTime(playerid); Logged[playerid] = 1; return 1; }
//I'm ingame and used /test cmd then quitting-------------------------------------------------------// UPDATE `players` SET `IP` = 'HIDDEN IP', `Admin` = '5', `VIP` = '1', `Deaths` = '6', `Score` = '40', `Money` = '20000', `MissionsPlayed` = '27' WHERE `Username` = 'Face9000' UPDATE `players` SET `VipTime` = 'Y', `Warns` = '3', `Cookies` = '89', `Jailed` = '0', `Muted` = '0', `RegisterDate` = '', `Duty` = '0', `Nopm` = '0' WHERE `Username` = 'Face9000' [part] Face9000 has left the server (0:1) //Joining after few seconds------------------------------------------------------// [connection] **** requests connection cookie. [connection] incoming connection: HIDDEN IP id: 0 [join] Face9000 has joined the server (0:HHIDEN IP) SELECT `IP`, `Password` FROM `players` WHERE `Username` = 'Face9000' LIMIT 1 //Noticed? All stats were to 0!-------------------------------------------------------------// UPDATE `players` SET `IP` = '93.148.160.140', `Admin` = '0', `VIP` = '0', `Deaths` = '0', `Score` = '0', `Money` = '0', `MissionsPlayed` = '0' WHERE `Username` = 'Face9000' UPDATE `players` SET `VipTime` = '', `Warns` = '0', `Cookies` = '0', `Jailed` = '0', `Muted` = '0', `RegisterDate` = '', `Duty` = '0', `Nopm` = '0' WHERE `Username` = 'Face9000' UPDATE `players` SET `IP` = '93.148.160.140', `Admin` = '0', `VIP` = '0', `Deaths` = '0', `Score` = '0', `Money` = '0', `MissionsPlayed` = '0' WHERE `Username` = 'Face9000' UPDATE `players` SET `VipTime` = '', `Warns` = '0', `Cookies` = '0', `Jailed` = '0', `Muted` = '0', `RegisterDate` = '', `Duty` = '0', `Nopm` = '0' WHERE `Username` = 'Face9000' [part] Face9000 has left the server (0:1) |
cache_get_data
public OnAccountLoad(playerid)
{
new score;
new rows, fields;
cache_get_data(rows, fields, Connection)//Connection is your DB connection
if(rows)
{
pData[playerid][Admin] = cache_get_field_content_int(0, "Admin");
pData[playerid][VIP] = cache_get_field_content_int(0, "VIP");
pData[playerid][Money] = cache_get_field_content_int(0, "Money");
pData[playerid][Deaths] = cache_get_field_content_int(0, "Deaths");
pData[playerid][MissionsPlayed] = cache_get_field_content_int(0, "MissionsPlayed");
pData[playerid][VipTime] = cache_get_field_content_int(0, "VipTime");
pData[playerid][Warns] = cache_get_field_content_int(0, "Warns");
pData[playerid][Cookies] = cache_get_field_content_int(0, "Cookies");
pData[playerid][Jailed] = cache_get_field_content_int(0, "Jailed");
pData[playerid][Muted] = cache_get_field_content_int(0, "Muted");
pData[playerid][Duty] = cache_get_field_content_int(0, "Duty");
pData[playerid][Nopm] = cache_get_field_content_int(0, "Nopm");
pData[playerid][RegisterDate] = cache_get_field_content_int(0, "RegisterDate");
}
score = cache_get_field_content_int(0, "Score");
SetPlayerScore(playerid, score);
GivePlayerCash(playerid, pData[playerid][Money]);
SendClientMessage(playerid,red,"------------------------------------------------------");
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new string[128];
format(string,sizeof(string),"* System: Welcome back {F70505}%s (%d) {FFFFFF} - Your stats have been restored.",playername3,playerid);
SCM(playerid,-1,string);
SendClientMessage(playerid,red,"------------------------------------------------------");
CheckVipTime(playerid);
Logged[playerid] = 1;
return 1;
}
pData[playerid][RegisterDate] = cache_get_field_content_int(0, "RegisterDate");