26.10.2014, 06:22
Hello i have some problem with command, Here my code
When i can't get back weapon when i do /takeweapon
When i can't get back weapon when i do /takeweapon
pawn Код:
new savedweapon;
new ammo;
stock RemovePlayerWeapon(playerid, pweaponid)
{
new plyWeapons[12];
new plyAmmo[12];
for(new slot = 0; slot != 12; slot++)
{
new pwep, pammo;
GetPlayerWeaponData(playerid, slot, pwep, pammo);
if(pwep != pweaponid)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
ResetPlayerWeapons(playerid);
for(new slot = 0; slot != 12; slot++)
{
GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
}
}
CMD:saveweapon(playerid, params[])
{
savedweapon = GetPlayerWeapon(playerid);
amount = GetPlayerAmmo(playerid);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
return 1;
}
CMD:takeweapon(playerid, params[])
{
GivePlayerWeapon(playerid, savedweapon, amount);
return 1;
}