How to remove a players currently holding weapon?
#1

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

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

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
Reply
#4

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

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!
Reply
#6

Make a repeating timer with SetPlayerArmedWeapon
Reply
#7

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)