Raised This Month: $32 Target: $400
 8% 

Strip ALL weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 10-18-2009 , 13:34   Strip ALL weapons
Reply With Quote #1

Hey!

I'm trying to strip all equipped weapons in the start of a new round (CS:S), but sometimes there are players who still have weapons. Am I doing something wrong with this code?
PHP Code:
    for(new i=1<= GetMaxClients(); i++)
    {
        new 
wepIdx;
        for (new 
06s++)
        {
            if ((
wepIdx GetPlayerWeaponSlot(is)) != -1)
            
RemovePlayerItem(iwepIdx);
        }
    } 
dataviruset is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 10-18-2009 , 18:16   Re: Strip ALL weapons
Reply With Quote #2

PHP Code:
    // 0 = primary 1 = pistol 2 = knife 3 = grenade
    //
    // in this example the knife is not stripped. just remove "x != 2" to strip the knife too.
    
new wepIdx;
    for (new 
0<= 3x++)
    {
        if (
!= && (wepIdx GetPlayerWeaponSlot(clientx)) != -1)
        {  
            
RemovePlayerItem(clientwepIdx);
            
RemoveEdict(wepIdx);
        }
    }
    
// the above method only removes the hegrenade if they have one.
    // you can remove flashes and smokes using ammo offsets. 

Last edited by meng; 10-19-2009 at 17:00.
meng is offline
Send a message via Yahoo to meng
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 10-18-2009 , 18:32   Re: Strip ALL weapons
Reply With Quote #3

Thanks
dataviruset is offline
Nasse xD
Junior Member
Join Date: Jan 2011
Old 10-06-2019 , 16:30   Re: Strip ALL weapons
Reply With Quote #4

whats the code if i want to strip all weapons without knifes and granades ( CS:S )
Quote:
PHP Code:
// strip all weapons


for (new 04s++)


{


if ((
wepIdx GetPlayerWeaponSlot(clients)) != -1)


{


RemovePlayerItem(clientwepIdx);


RemoveEdict(wepIdx); 

Last edited by Nasse xD; 10-06-2019 at 17:40.
Nasse xD is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 10-06-2019 , 21:51   Re: Strip ALL weapons
Reply With Quote #5

Quote:
Originally Posted by Nasse xD View Post
whats the code if i want to strip all weapons without knifes and granades ( CS:S )
change

PHP Code:
for (new 04s++) 
to

PHP Code:
for (new 02s++) 
__________________
8guawong is offline
Nasse xD
Junior Member
Join Date: Jan 2011
Old 10-07-2019 , 16:14   Re: Strip ALL weapons
Reply With Quote #6

Quote:
Originally Posted by 8guawong View Post
change

PHP Code:
for (new 04s++) 
to

PHP Code:
for (new 02s++) 
thx for fast reply!
Nasse xD is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 10-11-2019 , 18:21   Re: Strip ALL weapons
Reply With Quote #7

Use AcceptEntityInput(wepIdx, "Kill"); instead of RemoveEdict(wepIdx); it's safer...
MasterMind420 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 04:07.


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