SA-MP Forums Archive
Dropping one weapon - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dropping one weapon (/showthread.php?tid=269782)



Dropping one weapon - cloudysky - 17.07.2011

I'm making a rent weapon system and I need to know how to drop a certain weapon instead of all of them.


Re: Dropping one weapon - PrawkC - 17.07.2011

using
https://sampwiki.blast.hk/wiki/GetPlayerWeaponData

basically what want to store the data, then give him back all the weapons except the one you dropped.


Re: Dropping one weapon - cloudysky - 17.07.2011

I don't really understand that. Could you do it by getting the players weapon then making the ammo 0 after a set amount of time?


Re: Dropping one weapon - Emmet Shawn - 17.07.2011

Sup,

Try this:

pawn Код:
stock RemovePlayerWeapon(playerid, weaponid) {
    new Weapons[12], Ammo[12];
    for(new slot=0; slot !=12;++slot) {
        new weapon, ammo;
        GetPlayerWeaponData(playerid, slot, weapon, ammo);
        if(weapon !=weaponid && ammo !=0) {
            GetPlayerWeaponData(playerid, slot, Weapons[slot], Ammo[slot]);
        }
    }
    ResetPlayerWeapons(playerid);
    for(new slot =0; slot !=12;++slot) {
        if(Ammo[slot] != 0) {
        GivePlayerWeapon(playerid, Weapons[slot], Ammo[slot]);
    }
    return 1;
}