05.11.2011, 16:19
This function will disable the player weapons in hand efficiently.
For avoid problems if the player weapons are forbiden, before of give a weapon for the player, toggle the player weapons, give the new weapons and forbid it again.
For avoid problems if the player weapons are forbiden, before of give a weapon for the player, toggle the player weapons, give the new weapons and forbid it again.
pawn Код:
new PlayerWeapons[MAX_PLAYERS][2][13]; //in the top
TogglePlayerWeapons(playerid, bool:toggle)
{
if(!toggle)
{
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapons[playerid][0][i], PlayerWeapons[playerid][1][i]);
if(PlayerWeapons[playerid][0][i]) GivePlayerWeapon(playerid, PlayerWeapons[playerid][0][i], - (PlayerWeapons[playerid][1][i] * 2) );
}
}
else
{
ResetPlayerWeapons(playerid);
for(new i = 0; i < 13; i++)
{
if(PlayerWeapons[playerid][0][i]) GivePlayerWeapon(playerid, PlayerWeapons[playerid][0][i], PlayerWeapons[playerid][1][i]);
}
}
return 1;
}