31.08.2015, 20:50
PVars are way too slow, especially if coupled with format and OnPlayerUpdate. I'd rather use an array like:
And then use something like:
Next, check the example for OnPlayerWeaponChange on the wiki page of OnPlayerUpdate (which regrettably also uses PVars, but that aside). If the player changes to a weapon for which he has no ammo then the weapon is being hacked in. Take note to exclude parachutes and detonators as these are given automatically by the game.
pawn Код:
gPlayerWeaponData[MAX_PLAYERS][47]
pawn Код:
SafeGivePlayerWeapon(playerid, weaponid, ammo)
{
gPlayerWeaponData[playerid][weaponid] = ammo;
return GivePlayerWeapon(playerid, weaponid, ammo);
}