AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [REQ] Remove defuse kit from the ground (https://forums.alliedmods.net/showthread.php?t=238038)

kam3n1tza 04-03-2014 02:44

[REQ] Remove defuse kit from the ground
 
How to edit the code to remove defuse kit from the ground?
All weapons are removed from the ground only defuse kit don't want...

PHP Code:

#include <amxmodx>
#include <fakemeta>

new cvar_removedropped

public plugin_init()
{
    
register_plugin("Remove drop weapons""1.0""watch")

    
register_forward(FM_SetModel"fw_SetModel")

    
cvar_removedropped register_cvar("remove_dropped_weapons""2")
}

public 
fw_SetModel(entity, const model[])
{
    new 
len strlen(model)

    if(
len 8) return

    if (
get_pcvar_float(cvar_removedropped) > 0.0)
    {
        static 
classname[10]
        
pev(entitypev_classnameclassnamecharsmax(classname))
        
        if (
equal(classname"weaponbox"))
        {
            
set_pev(entitypev_nextthinkget_gametime() + get_pcvar_float(cvar_removedropped))
            return
        }
    }



Kiske 04-03-2014 05:56

Re: [REQ] Remove defuse kit from the ground
 
This is because the defuse kit hasn't the weaponbox classname.
The classname is item_thighpack.

So, you need to check if the classname is equal to item_thighpack.

kam3n1tza 04-03-2014 06:58

Re: [REQ] Remove defuse kit from the ground
 
Quote:

Originally Posted by Kiske (Post 2119559)
This is because the defuse kit hasn't the weaponbox classname.
The classname is item_thighpack.

So, you need to check if the classname is equal to item_thighpack.

I tried this way, but still not working:
PHP Code:

#include <amxmodx>
#include <fakemeta>

new cvar_removedropped

public plugin_init()
{
    
register_plugin("Remove drop weapons""1.0""watch")

    
register_forward(FM_SetModel"fw_SetModel")

    
cvar_removedropped register_cvar("remove_dropped_weapons""2")
}

public 
fw_SetModel(entity, const model[])
{
    new 
len strlen(model)

    if(
len 8) return

    if (
get_pcvar_float(cvar_removedropped) > 0.0)
    {
        static 
classname[20]
        
pev(entitypev_classnameclassnamecharsmax(classname))
        
        if (
equal(classname"item_thighpack"))
        {
            
set_pev(entitypev_nextthinkget_gametime() + get_pcvar_float(cvar_removedropped))
            return
        }
    }




All times are GMT -4. The time now is 05:55.

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