Raised This Month: $ Target: $400
 0% 

Make all players drop all weapons except knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pantheon
Member
Join Date: Jan 2011
Old 01-09-2011 , 15:26   Make all players drop all weapons except knife
Reply With Quote #1

How can i do this?
Pantheon is offline
sibox
Member
Join Date: Apr 2009
Location: Bulgaria
Old 01-09-2011 , 15:28   Re: Make all players drop all weapons except knife
Reply With Quote #2

loop through all players and then strip_user_weapons();
sibox is offline
Send a message via Skype™ to sibox
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-10-2011 , 00:35   Re: Make all players drop all weapons except knife
Reply With Quote #3

And then give_item(id, "weapon_knife")
Elusive138 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-10-2011 , 00:46   Re: Make all players drop all weapons except knife
Reply With Quote #4

That's stripping weapons, not dropping.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-10-2011 , 00:59   Re: Make all players drop all weapons except knife
Reply With Quote #5

True.. maybe client_cmd(id, slot1;+attack;-attack;drop;slot2;+attack;-attack;drop)

That won't work if there's a multi-weapon plugin (or some other way of getting more than 1 weapon each slot). And slot5 for bomb and grenades can't be dropped.

In any case, there isn't much point to dropping weapons only to have them picked up a second later. If you only want the player to be holding a knife, stripping is better.
Elusive138 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-10-2011 , 02:16   Re: Make all players drop all weapons except knife
Reply With Quote #6

You can take code from here : http://forums.alliedmods.net/showthread.php?p=761924

If you don't care about bpammo, here are 2 other simpler ways :

PHP Code:
const NODROP_WPNS_BITSUM = (1<<CSW_KNIFE)|(1<<CSW_HEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)

#define FIRST_WEAPON = CSW_P228
#define LAST_WEAPON = CSW_P90

DropPlayerWeaponsid )
{    
    new 
iWeapons[32], iNumiWeapon
    get_user_weapons
(idiWeaponsiNum)
    new 
szWeaponName[22]
    for(--
iNumiNum>=0iNum--)
    {
        
iWeapon iWeapons[iNum]
        if( 
iWeapons & (1<<iWeapon) && ~NODROP_WPNS_BITSUM & (1<<iWeapon) )
        {
            
get_weaponname(iWeaponszWeaponNamecharsmax(szWeaponName))
            
engclient_cmd(id"drop"szWeaponName)
        }
    }
}

DropPlayerWeapons2id )
{
    new 
iWeapons pev(idpev_weapons)
    new 
szWeaponName[22]
    for(new 
iWeapon FIRST_WEAPONiWeapon<=LAST_WEAPONiWeapons++)
    {
        if( 
iWeapons & (1<<iWeapon) && ~NODROP_WPNS_BITSUM & (1<<iWeapon) )
        {
            
get_weaponname(iWeaponszWeaponNamecharsmax(szWeaponName))
            
engclient_cmd(id"drop"szWeaponName)
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode