25.09.2016, 20:27
pawn Code:
stock SavePlayerData(playerid)
{
if(LoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID)
{
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
GetPlayerArmour(playerid, PlayerArmour[playerid]);
new query[600];
format(query, sizeof(query), "UPDATE `accounts` SET LastX = %f, LastY = %f, LastZ = %f, LastVW = %d, LastInt = %d WHERE id = %d", x, y, z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), PlayerSQLID[playerid]);
mysql_tquery(dbHandle, query, "", "");
format(query, sizeof(query), "UPDATE `accounts` SET `TotalTime` = %d, `Money` = %d, ThiefCooldown = %d,HotwireCooldown = %d, `SGrip` = %d, `MGrip` = %d, `LGrip` = %d,`SFrame` = %d, `MFrame` = %d, `LFrame` = %d,`SBarrel` = %d, `MBarrel` = %d, `LBarrel` = %d, `Jail` = %d, `AdminJail` = %d, FishBait = %d, `Armour` = %f, LastLogin = %d, JobCooldown = %d, PizzaCooldown = %d, WepTime = %d, DrugTime = %d, MFrags = %d, LastPayday = %d, SweepCooldown = %d WHERE `id` = %d LIMIT 1"
, TotalTime[playerid], PlayerMoney[playerid], ThiefCooldown[playerid],HotwireCooldown[playerid],SGrip[playerid], MGrip[playerid], LGrip[playerid],SFrame[playerid],MFrame[playerid],LFrame[playerid], SBarrel[playerid],MBarrel[playerid],LBarrel[playerid], Jail[playerid], AdminJail[playerid],FishBait[playerid],PlayerArmour[playerid],LastLogin[playerid], JobCooldown[playerid], PizzaCooldown[playerid],WepTime[playerid], DrugTime[playerid], MFrags[playerid], LastPayday[playerid],
SweepCooldown[playerid], PlayerSQLID[playerid]);
mysql_tquery(dbHandle, query,"", "");
for(new w = 0; w < 13; w++)
{
if(PlayerWeapons[playerid][w] > 0)
{
MySQL_SetInteger(PlayerWeapons[playerid][w], "WepAmmo", WepAmmo[PlayerWeapons[playerid][w]], "weapons");
}
}
}
//Simple mysql query.
return 1;
}
Could anyone assist? I save on disconnect and every 5 minutes.