AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking spawned CSDM items (https://forums.alliedmods.net/showthread.php?t=62292)

Mini_Midget 10-23-2007 07:25

Blocking spawned CSDM items
 
How do you block the spawned items from CSDM item mode?
All of them have the prefix "csdm" or if its a weapon. "csdmw_"
I want to block everything that is spawned from it.
Heres the list from the source
PHP Code:

new g_EntClass[][] = 
{
    
""
    
"csdmw_p228"
    
""
    
"csdmw_scout"
    
"csdmw_hegrenade"
    
"csdmw_xm1014"
    
""
    
"csdmw_mac10"
    
"csdmw_aug"
    
"csdmw_smokegrenade"
    
"csdmw_elite"
    
"csdmw_fiveseven"
    
"csdmw_ump45"
    
"csdmw_sg550"
    
"csdmw_galil"
    
"csdmw_famas"
    
"csdmw_usp"
    
"csdmw_glock18"
    
"csdmw_awp"
    
"csdmw_mp5navy"
    
"csdmw_m249"
    
"csdmw_m3"
    
"csdmw_m4a1"
    
"csdmw_tmp"
    
"csdmw_g3sg1"
    
"csdmw_flashbang"
    
"csdmw_deagle"
    
"csdmw_sg552"
    
"csdmw_ak47"
    
""
    
"csdmw_p90"
    
"csdm_longjump"
    
"csdm_medkit"
    
"csdm_battery"
    
"csdm_pistolammo"
    
"csdm_rifleammo"
    
"csdm_shotammo"
    
"csdm_smgammo"
    
"csdm_awpammo"
    
"csdm_paraammo"
    
"csdm_fullammo"
    
"csdm_armor"



kp_uparrow 10-23-2007 23:12

Re: Blocking spawned CSDM items
 
what u trying to do?

y not remove the spawn items module / plugin

Mini_Midget 10-24-2007 06:15

Re: Blocking spawned CSDM items
 
I'm trying to block it from weapon pickup for a team.
I'm using the touch forward to do so but can't figure out how to do so.

Alka 10-24-2007 06:51

Re: Blocking spawned CSDM items
 
Get the player team and ent classname and do something like this.

Code:

Forward_Touch(Ent, id)
{
    static classname[32];
    pev(Ent, pev_classname, classname, sizeof classname - 1);
 
    for(new i = 0 ; i < sizeof g_EntClass ; i++)
    {
          if(equali(classname, g_EntClass[i]) && get_user_team(id) == 1)
          {
              return FMRES_SUPERCEDE;
          }
    }
    return FMRES_HANDLED;
}


ConnorMcLeod 10-24-2007 07:06

Re: Blocking spawned CSDM items
 
Check first if ent is a valid entity or you'll get some errors.
I also guess that the function has to be public, and that you should return FMRES_IGNORED, not FMRES_HANDLED, but i may be wrong on this last point.

Code:
public Forward_Touch(Ent, id) {     if(!is_user_alive(id) || !is_user_connected(id))         return FMRES_IGNORED;     if(!pev_valid(Ent)) {         return FMRES_IGNORED;     }     static classname[32];     pev(Ent, pev_classname, classname, sizeof classname - 1);     for(new i = 0 ; i < sizeof g_EntClass ; i++)     {         if(equali(classname, g_EntClass[i]) && get_user_team(id) == 1)         {             return FMRES_SUPERCEDE;         }     }     return return FMRES_IGNORED; }

You also may avoid using the native get_user_team checking player team offset.

Alka 10-24-2007 07:12

Re: Blocking spawned CSDM items
 
Meh...how you say...

Mini_Midget 10-24-2007 07:43

Re: Blocking spawned CSDM items
 
Why doesn't this work? I tried doing this...
PHP Code:

public fw_Touch(touchedtoucher)
{
    if(!
get_pcvar_num(zomb_switch))
        return 
FMRES_IGNORED
    
    
if (!pev_valid(touched) || !is_user_connected(toucher) || !g_zombie[toucher])
        return 
FMRES_IGNORED

    
static classname[33]
    
pev(touchedpev_classnameclassname32)
    
    if ( ( 
classname[0] == 'w' && classname[1] == 'e' && classname[2] == 'a') || (classname[0] == 'a' && classname[1] == 'r' && classname[2] == 'm') || (classname[0] == 'c' && classname[1] == 's' && classname[2] == 'd' ) )
        return 
FMRES_SUPERCEDE
    
    
return FMRES_IGNORED


wea is for weaponbox and weapon_shield
arm is for armory_entity
csd is for the csdm spawned items

Alka 10-24-2007 08:01

Re: Blocking spawned CSDM items
 
try to replace last FMRES_IGNORED with FMRES_HANDLED :/

Edit:I don't think will work. Should be FMRES_IGNORED but , you'r example should work :s

Try to use equali(classname[0], "w")) and so...instead of classname[0] == 'w'

ConnorMcLeod 10-24-2007 08:13

Re: Blocking spawned CSDM items
 
I assume you have registered the forward in plugin_init ?

Code:
register_forward(FM_Touch,"fw_Touch")

kp_uparrow 10-24-2007 09:44

Re: Blocking spawned CSDM items
 
use {} ?
yes he declared touch


All times are GMT -4. The time now is 01:13.

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