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

Removing particular weapon pick up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
koezee
New Member
Join Date: Jan 2019
Old 01-18-2019 , 18:55   Removing particular weapon pick up
Reply With Quote #1

I searched everywhere, but none of the variants worked as I wanted it to.

What I want: TT have ability to pick up (and drop) only C4 and nothing more. CT have ability to pick up (and drop) everything.

Help me please
koezee is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-21-2019 , 22:14   Re: Removing particular weapon pick up
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta_util>

new g_tRest;

new const 
tRest[][] =
{
    
"weapon_c4"
}

public 
plugin_init()
{
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon");
    
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeapon");
        
g_tRest register_cvar("amx_tRest""1");
}

public 
fw_TouchWeapon(weaponid
{
    if (!
get_pcvar_num(g_tRest)) //Checks if g_tRest is deactivated (set to 0)
        
return PLUGIN_CONTINUE //If it is, let players on T side pick up weapons
        
    
if ( !is_user_aliveid ) || ( cs_get_user_teamid ) != CS_TEAM_T ) )
    {
        return 
HAM_IGNORED
    
}
   
    static 
classname[32]
    
pev(weaponpev_classnameclassnamecharsmax(classname))
 
    for(new 
0sizeof tResti++)
    if (!
equal(classnametRest[i])) 
    {
        
//Sends a message that weapons are only for CT's
        
client_print(idprint_center"You can only pick up the bomb on T side.")
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

Try it, didn't test. (DRUNK & my b-day)
If not, wait for someone more qualified to answer!

ALSO forgot to specify, thanks to Unkolix(VIP Plugin V5.4.5) and AMXX Documentation I was able to code this, Hope it works!
__________________

Last edited by deprale; 01-21-2019 at 22:26. Reason: forgot to include the capital R in the "tRest" var in the for loop
deprale is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 01-22-2019 , 03:53   Re: Removing particular weapon pick up
Reply With Quote #3

Taking classname of that entity, will just result back into "weaponbox" or "armoury_entity",
Use cs_get_weapon_id.
__________________
Retired.
Xalus is offline
koezee
New Member
Join Date: Jan 2019
Old 01-22-2019 , 07:14   Re: Removing particular weapon pick up
Reply With Quote #4

Thanks for tips deprale & Xalus! Now I figured it out

Thread can be closed

Last edited by koezee; 01-22-2019 at 07:15.
koezee 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 20:22.


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