05.05.2014, 04:50
Just a quick update; I got weapons to finally load, but now they don't reset on a players death. Here's the code I've been trying to implement.
So when they spawn, I simply give them the weapons and ammo saved to their account. I attempt to reset the values to 0 when they die.
pawn Код:
stock ResetSavedWeapons(playerid)
{
ResetPlayerWeapons(playerid);
pInfo[playerid][pWeapon1] = 0;
pInfo[playerid][pWeapon1a] = 0;
pInfo[playerid][pWeapon2] = 0;
pInfo[playerid][pWeapon2a] = 0;
pInfo[playerid][pWeapon3] = 0;
pInfo[playerid][pWeapon3a] = 0;
pInfo[playerid][pWeapon4] = 0;
pInfo[playerid][pWeapon4a] = 0;
pInfo[playerid][pWeapon5] = 0;
pInfo[playerid][pWeapon5a] = 0;
pInfo[playerid][pWeapon6] = 0;
pInfo[playerid][pWeapon6a] = 0;
pInfo[playerid][pWeapon7] = 0;
pInfo[playerid][pWeapon7a] = 0;
SaveAccount(playerid);
return 1;
}
//onplayerdeath
ResetPlayerWeapons(playerid);
pawn Код:
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon1], pInfo[playerid][pWeapon1a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon2], pInfo[playerid][pWeapon2a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon3], pInfo[playerid][pWeapon3a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon4], pInfo[playerid][pWeapon4a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon5], pInfo[playerid][pWeapon5a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon6], pInfo[playerid][pWeapon6a]);
GivePlayerWeapon(playerid, pInfo[playerid][pWeapon7], pInfo[playerid][pWeapon7a]);