Raised This Month: $51 Target: $400
 12% 

Prevent terrorist from pickuping ANY weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 09-30-2008 , 13:47   Prevent terrorist from pickuping ANY weapon
Reply With Quote #1

Hello.
I'm doing a plugin and i want to prevent terrorist from pickup any weapon.
I have an code wroten by me, but its causing problems.

Code :
PHP Code:
public func_mutant_noweapon_pickup(entityclient)
{
    new 
is_mutant[33]
    
is_mutant[client] = cs_get_user_team(client) == CS_TEAM_T true false
    
if (!is_user_connected(client) || !is_user_alive(client))
    {
        new 
entity_class[32]
        
pev(entitypev_classnameentity_class31)
        if(
is_mutant[client])
        {
            if (
equal(entity_class"weaponbox"))
            {
                return 
FMRES_SUPERCEDE
            
}
        }
    }    

    return 
FMRES_IGNORED

Please don't laugh, i'm new in scripting.

Problems :
Code:
L 09/30/2008 - 19:46:46: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 09/30/2008 - 19:46:46: [AMXX]    [0] stalker.sma::func_mutant_noweapon_pickup (line 298)
L 09/30/2008 - 19:46:46: [CSTRIKE] Player out of range (0)
L 09/30/2008 - 19:46:46: [AMXX] Displaying debug trace (plugin "stalker.amxx")
L 09/30/2008 - 19:46:46: [AMXX] Run time error 10: native error (native "cs_get_user_team")
Can someone help me?
+karma of course
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-30-2008 , 13:48   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #2

try to change
PHP Code:
cs_get_user_team(client) == CS_TEAM_T true false 
->
PHP Code:
get_user_team(client) == true false 
__________________
xPaw is offline
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 09-30-2008 , 13:54   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #3

xPaw, i've changed it, but my code isn't working.
Can someone post working code? ;>
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-30-2008 , 13:57   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #4

try this one
PHP Code:
public func_mutant_noweapon_pickup(entityclient)
{
    if (
is_user_alive(client))
    {
        new 
entity_class[32]
        
pev(entitypev_classnameentity_class31)

        if(
get_user_team(client) == 1)
            if (
equal(entity_class"weaponbox"))
                return 
FMRES_SUPERCEDE
    
}

    return 
FMRES_IGNORED

__________________
xPaw is offline
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 09-30-2008 , 14:01   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #5

Sorry, it's not working...
I've tried it on awp_map and Mutants (Terrorists) can pickup AWP.

@EDIT
Code is half working, because T can't pickup once dropped AWP.
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-30-2008 , 14:06   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #6

change
PHP Code:
if (equal(entity_class"weaponbox")) 
->
PHP Code:
if (equal(entity_class"weaponbox") || equal(entity_class"armoury_entity") || equal(entity_class"grenade")) 
__________________
xPaw is offline
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 09-30-2008 , 14:13   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #7

Thanks, it is working now.
But i have another question...
I's there a way to prevent Terrorist from using flashlights?
And can i make that flashlights shine brighter?
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-30-2008 , 14:19   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #8

try this one

PHP Code:
register_forward(FM_CmdStart"CmdStart")

// [..]

public CmdStart(iduc_handleseed)
{
    if(
get_uc(uc_handleUC_Impulse) == 100)
    {
        if(
is_user_alive(id) && get_user_team(id) == 1)
        {
            
client_print(idprint_chat"Only CT's can use flashlight.");
            
set_uc(uc_handleUC_Impulse0)
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED

__________________
xPaw is offline
FakeNick
Senior Member
Join Date: Feb 2008
Location: Poland
Old 09-30-2008 , 14:23   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #9

Oh, xPaw, thanks again!
Very big +karma for you!
__________________


[||||||||||] Snowball war v3.05

Pol
ish translations here ;) (PM me if you want one).


FakeNick is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-30-2008 , 14:23   Re: Prevent terrorist from pickuping ANY weapon
Reply With Quote #10

No Problem ;)
__________________
xPaw is offline
Reply



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 19:09.


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