12.08.2013, 00:53
Basically, when a GMX happens or a player leaves the server it keeps setting the stuff to 0, I think it's because it's looping more than once and I tried using break; to stop it, didn't work.
I know this because:
printf outputs.
I know this because:
printf outputs.
pawn Код:
playersql 1
[03:51:49] bank money : 0
[03:51:49] playerskin 67 //it was this before the server gmx'd
[03:51:49] WEED 0
[03:51:53] playersql 1
[03:51:53] bank money : 0
[03:51:53] playerskin 0 //notice how it's 0 now.
[03:51:53] WEED 0
[03:52:05]
pawn Код:
stock SavePlayerData()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && LoggedIn[i] == 1)
{
PlayerSQLID[i] = MySQL_GetValue(PlayerSQLID[i], "id", "accounts");
printf("playersql %d", PlayerSQLID[i]);
MySQL_SetInteger(PlayerSQLID[i], "TotalTime", TotalTime[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "BankMoney", BankMoney[i], "accounts");
printf("bank money : %d", BankMoney[i]);
SaveWeapons();
MySQL_SetInteger(PlayerSQLID[i], "Skin", GetPlayerSkin(i), "accounts");
printf("playerskin %d", GetPlayerSkin(i));
MySQL_SetInteger(PlayerSQLID[i], "Money", GetPlayerMoney(i), "accounts");
MySQL_SetInteger(PlayerSQLID[i], "Cocaine", Cocaine[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "Weed", Weed[i], "accounts");
printf("WEED %d", Weed[i]);
MySQL_SetInteger(PlayerSQLID[i], "SGrip", SGrip[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "MGrip", MGrip[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "LGrip", LGrip[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "SFrame", SFrame[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "MFrame", MFrame[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "LFrame", LFrame[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "SBarrel", SBarrel[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "MBarrel", MBarrel[i], "accounts");
MySQL_SetInteger(PlayerSQLID[i], "LBarrel", LBarrel[i], "accounts");
new playerip[16], query[128];
GetPlayerIp(i, playerip, sizeof(playerip));
format(query, sizeof(query), "UPDATE `accounts` SET `PlayerIP` = '%s' WHERE `id` = '%d' LIMIT 1", playerip,i);
mysql_query(query);
break;
//LAST IP.
}
}
return 1;
}