12.08.2013, 18:59
Title says all, these are results of the printf's.
Also, SaveWeapons(playerid) is not working either. Which saves armour.
I load everything under DIALOG_LOGIN.
It does work.
This is where it's used.
SaveData.
pawn Код:
[22:12:33] playerid 0//correct
[22:12:33] playersqlid 1//correct
[22:12:33] TotalTime 1392//correct
[22:12:33] Bank Money 0//correct cos it reset already..
[22:12:33] PlayerSkin 100 // here, skin I set to 100.
[22:12:33] PlayerMoney 1939200 //remains correct
//It appears to have ran it twice. Setting the things up wrongly because it's restarting?
[22:12:43] playerid 0
[22:12:43] playersqlid 1
[22:12:43] TotalTime 1393
[22:12:43] Bank Money 0
[22:12:43] PlayerSkin 0 //skin reset.
[22:12:43] PlayerMoney 1939200
I load everything under DIALOG_LOGIN.
It does work.
This is where it's used.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SavePlayerData(playerid);
SaveWeapons(playerid);
return 1;
}
public OnGameModeExit()
{
KillTimer(timer);
KillTimer(OneMin);
KillTimer(FiveSecs);
KillTimer(onesec);
foreach(Player, i)
{
SavePlayerData(i);
SaveWeapons(i);
}
return 1;
}
pawn Код:
stock SavePlayerData(playerid)
{
new playerip[16], query[128];
if(LoggedIn[playerid] == 1)
{
printf("playerid %d", playerid);
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
printf("playersqlid %d", PlayerSQLID[playerid]);
MySQL_SetInteger(PlayerSQLID[playerid], "TotalTime", TotalTime[playerid], "accounts");
printf("TotalTime %d", TotalTime[playerid]);
MySQL_SetInteger(PlayerSQLID[playerid], "BankMoney", BankMoney[playerid], "accounts");
printf("Bank Money %d", BankMoney[playerid]);
PlayerSkin[playerid] = GetPlayerSkin(playerid);
printf("PlayerSkin %d", PlayerSkin[playerid]);
MySQL_SetInteger(PlayerSQLID[playerid], "Skin", PlayerSkin[playerid], "accounts");
PlayerMoney[playerid] = GetPlayerMoney(playerid);
MySQL_SetInteger(PlayerSQLID[playerid], "Money", PlayerMoney[playerid], "accounts");
printf("PlayerMoney %d", PlayerMoney[playerid]);
MySQL_SetInteger(PlayerSQLID[playerid], "Cocaine", Cocaine[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "Weed", Weed[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "SGrip", SGrip[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "MGrip", MGrip[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "LGrip", LGrip[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "SFrame", SFrame[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "MFrame", MFrame[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "LFrame", LFrame[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "SBarrel", SBarrel[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "MBarrel", MBarrel[playerid], "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "LBarrel", LBarrel[playerid], "accounts");
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(query, sizeof(query), "UPDATE `accounts` SET `PlayerIP` = '%s' WHERE `id` = '%d' LIMIT 1", playerip,PlayerSQLID[playerid]);
mysql_query(query);
}
return 1;
}