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]
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;
}
It's a function and I call it at GMX (Restart) and OnPlayerDisconnect!
I agree with what you've said, thank you very much. |
stock SavePlayerData()
{
new playerip[16], query[128];
foreach(new i : Player)
{
if(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");
GetPlayerIp(i, playerip, sizeof(playerip));
format(query, sizeof(query), "UPDATE `accounts` SET `PlayerIP` = '%s' WHERE `id` = '%d' LIMIT 1", playerip,i);
mysql_query(query);
}
}
return 1;
}