AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Where I wrong with changing on w_ models? (https://forums.alliedmods.net/showthread.php?t=244958)

KiLLeR. 07-26-2014 08:17

Where I wrong with changing on w_ models?
 
I want to change world models on grenades and try this, but didn't work. Where I wrong?
PHP Code:

register_forward(FM_SetModel"fw_SetModel");

public 
fw_SetModel(entity, const model[])
{        
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED;
    
    if(
equal(model"models/csbg_bm/w_hegrenade.mdl"))
    {
        
entity_set_model(entity"models/csbg_bm/w_hegrenade.mdl");
        return 
FMRES_SUPERCEDE;
    }
    
    if(
equal(model"models/csbg_bm/w_flashbang.mdl"))
    {
        
entity_set_model(entity"models/csbg_bm/w_flashbang.mdl");
        return 
FMRES_SUPERCEDE;
    }
    
    if(
equal(model"models/csbg_bm/w_smokegrenade.mdl"))
    {
        
entity_set_model(entity"models/csbg_bm/w_smokegrenade.mdl");
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;



HamletEagle 07-26-2014 09:02

Re: Where I wrong with changing on w_ models?
 
Why you are checking if the grenade has your model,then you set it again ? At this point,grenades have default models, you have to check for that one.

KiLLeR. 07-26-2014 09:12

Re: Where I wrong with changing on w_ models?
 
I haven't pay attention to this. Very thanks you! :)
Is there a need I check whether a classname is grenade?

klippy 07-26-2014 10:17

Re: Where I wrong with changing on w_ models?
 
Quote:

Originally Posted by KiLLeR. (Post 2174133)
I haven't pay attention to this. Very thanks you! :)
Is there a need I check whether a classname is grenade?

I don't think so, since only grenades should have that model, not other entities.

GuskiS 07-26-2014 10:35

Re: Where I wrong with changing on w_ models?
 
Use grenade_throw event to set model you want.

KiLLeR. 07-26-2014 11:17

Re: Where I wrong with changing on w_ models?
 
Thanks you on all, already can lock the topic!


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

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