12.08.2013, 15:27
You want that stuff to be 0, though. Odds are when a player leaves the server, they're not going to come back with the same player ID, so the information for that ID can be used by a different player. As for restarting the server, everything is set to 0 unless particularly set to a different value upon creating the variable.
So.. I don't quite see the issue here. By the way, you should be using foreach! Also, you were declaring two strings inside the loop- you don't need to do that; it's using too much memory.
So.. I don't quite see the issue here. By the way, you should be using foreach! Also, you were declaring two strings inside the loop- you don't need to do that; it's using too much memory.
pawn Код:
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;
}

