SA-MP Forums Archive
How to remove a players currently holding 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)
+--- Thread: How to remove a players currently holding weapon? (/showthread.php?tid=366802)



How to remove a players currently holding weapon? - gnoomen2 - 07.08.2012

if(GetPlayerWeapon(playerid) == 1) "remove the current weapon here if that is possible"


Re: How to remove a players currently holding weapon? - Roko_foko - 07.08.2012

SetPlayerArmedWeapon(playerid,0) and if you want to remove it completly GivePlayerWeapon(playerid, 1, 0) 0=ammo


Re: How to remove a players currently holding weapon? - FalconX - 07.08.2012

Quote:
Originally Posted by gnoomen2
Посмотреть сообщение
if(GetPlayerWeapon(playerid) == 1) "remove the current weapon here if that is possible"
pawn Код:
stock SetPlayerAmmo(playerid, weaponid, ammo)
{
    new weapon[13][2];
    for(new i=0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon[i][0], weapon[i][1]);
        if(weapon[i][0] == weaponid)
        {
            GivePlayerWeapon(playerid, weaponid, -(weapon[i][1]*2));
            break;
        }
    }
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
}
I think you can remove it by this function:

http://forum.sa-mp.com/showpost.php?...31&postcount=6


Re: How to remove a players currently holding weapon? - gnoomen2 - 07.08.2012

Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
SetPlayerArmedWeapon(playerid,0) and if you want to remove it completly GivePlayerWeapon(playerid, 1, 0) 0=ammo
Thanks!


Re: How to remove a players currently holding weapon? - gnoomen2 - 07.08.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
pawn Код:
stock SetPlayerAmmo(playerid, weaponid, ammo)
{
    new weapon[13][2];
    for(new i=0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon[i][0], weapon[i][1]);
        if(weapon[i][0] == weaponid)
        {
            GivePlayerWeapon(playerid, weaponid, -(weapon[i][1]*2));
            break;
        }
    }
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
}
I think you can remove it by this function:

http://forum.sa-mp.com/showpost.php?...31&postcount=6
Thank you for posting that, thanks to you too!


Re: How to remove a players currently holding weapon? - RedFusion - 07.08.2012

Make a repeating timer with SetPlayerArmedWeapon


Respuesta: How to remove a players currently holding weapon? - [DOG]irinel1996 - 07.08.2012

Actually you can use this: https://sampwiki.blast.hk/wiki/ResetPlayerWeaponsEx
I think it's more effcient, also, you can't remove melee weapons, as knifes.
Just give a try, between, you have an good example in the wiki.

Best regards!