Weapon/Armour sometimes don't load back in. -
Dokins - 14.08.2013
I was wondering if in general people could give me reasons why this might be? Sometimes I can give myself armour, a bunch of weapons and then /kick myself, log back in and I'll have all weapons and armour still intact. I can then /q from the server a bunch of times too and still keep it, but then randomly if I leave the server, come back in the odd time, none of the stuff is there?
Re: Weapon/Armour sometimes don't load back in. -
JimmyCh - 14.08.2013
Show us your saving/loading codes for the weapons and armour please..
Re: Weapon/Armour sometimes don't load back in. -
Dokins - 15.08.2013
Loading. Under DIALOG_LOGIN.
pawn Код:
PlayerBanned[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Banned", "accounts");
SetSpawnInfo(playerid, -1, PlayerSkin[playerid],-2381.5684,2332.7764,4.9844, 90.0, 0,0,0,0,0,0);
SpawnPlayer(playerid);
PlayerArmour[playerid] = MySQL_GetFloat(PlayerSQLID[playerid], "Armour", "accounts");
printf("ARMOUR %f", PlayerArmour[playerid]);
SetPlayerArmour(playerid, PlayerArmour[playerid]);
printf("SET ARMOUR %f", PlayerArmour[playerid]);
new fieldname[50];
for(new w = 0; w < 13; w++)
{
format(fieldname, sizeof(fieldname), "Weapon%d", w);
PlayerWeapons[playerid][w] = MySQL_GetValue(PlayerSQLID[playerid], fieldname, "accounts");
printf("Player Weapons %d",PlayerWeapons[playerid]);
format(fieldname, sizeof(fieldname), "Weapon%dAmmo", w);
PlayerWeaponAmmo[playerid][w] = MySQL_GetValue(PlayerSQLID[playerid], fieldname, "accounts");
if(PlayerWeapons[playerid][w] > 0) GivePlayerWeapon(playerid, PlayerWeapons[playerid][w], PlayerWeaponAmmo[playerid][w]);
}
SAVING is under a One Minute Timer, (EVERY MINUTE).
pawn Код:
SaveWeapons()
{
foreach(Player, p)
{
if(LoggedIn[p] == 1)
{
for(new w = 0; w < 13; w++)
{
GetPlayerWeaponData(p, w, PlayerWeapons[p][w], PlayerWeaponAmmo[p][w]);
new fieldname[50],Float: armour;
format(fieldname, sizeof(fieldname), "Weapon%d", w);
MySQL_SetInteger(PlayerSQLID[p], fieldname, PlayerWeapons[p][w], "accounts");
format(fieldname, sizeof(fieldname), "Weapon%dAmmo", w);
MySQL_SetInteger(PlayerSQLID[p], fieldname, PlayerWeaponAmmo[p][w], "accounts");
GetPlayerArmour(p, armour);
MySQL_SetFloat(PlayerSQLID[p], "Armour", armour, "accounts");
printf("MINUTE ARMOUR %f", PlayerArmour[p]);
}
}
}
return 1;
}
Re: Weapon/Armour sometimes don't load back in. -
Dokins - 16.08.2013
Still not resolved.
Re: Weapon/Armour sometimes don't load back in. -
Dokins - 16.08.2013
Resolved.