Command bug?
#1

Hello i have some problem with command, Here my code

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;
}
Reply


Messages In This Thread
Command bug? - by MasonSFW - 26.10.2014, 06:22
Re: Command bug? - by DavidBilla - 26.10.2014, 07:39
Re: Command bug? - by Quickie - 26.10.2014, 08:08

Forum Jump:


Users browsing this thread: 1 Guest(s)