05.01.2015, 19:09
PHP код:
stock SaveAccount(playerid)
{
new query[800];
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
format(query, sizeof query, "UPDATE `accounts` SET `level` = '%d', `respect` = '%d', `money`= '%d', `bankmoney`= '%d', `skin`= '%d', `phonebalance`= '%d', `member`= '%d', `leader`= '%d', `rank`= '%d', `mskin`= '%d'",
PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pRespect],
PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pBankMoney],
PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPhoneBalance],
PlayerInfo[playerid][pMember], PlayerInfo[playerid][pLeader],
PlayerInfo[playerid][pRank], PlayerInfo[playerid][pMSkin]);
format(query, sizeof query, "%s, `hospital`= '%d', `hp`= '%d', `ip`= '%s', `phone`= %d', `admlevel`= '%d', `admpass`= '%d', `satiety`= '%d' WHERE `id` = '%d'", query,
PlayerInfo[playerid][pHospital],PlayerInfo[playerid][pHealth],
PlayerInfo[playerid][pIP], PlayerInfo[playerid][pPhone],
PlayerInfo[playerid][pAdmLevel],PlayerInfo[playerid][pAdmPass],
PlayerInfo[playerid][pSatiety], PlayerInfo[playerid][pID]);
mysql_function_query(dbHandle, query, false, "", "" );
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
DestroyPlayerTextDraws(playerid);
KillTimer(PlayerTimerID[playerid]);
TextDrawHideForPlayer(playerid, LOGO);
if(gPlayerLogged[playerid] == true)
{
SaveAccount(playerid);
}
return 1;
}