AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Removing particular weapon pick up (https://forums.alliedmods.net/showthread.php?t=313690)

koezee 01-18-2019 18:55

Removing particular weapon pick up
 
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 :oops:

deprale 01-21-2019 22:14

Re: Removing particular weapon pick up
 
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!

Xalus 01-22-2019 03:53

Re: Removing particular weapon pick up
 
Taking classname of that entity, will just result back into "weaponbox" or "armoury_entity",
Use cs_get_weapon_id.

koezee 01-22-2019 07:14

Re: Removing particular weapon pick up
 
Thanks for tips deprale & Xalus! Now I figured it out :up:

Thread can be closed


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

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