AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   fw_setmodel cant detect a model (https://forums.alliedmods.net/showthread.php?t=233329)

avril-lavigne 01-13-2014 05:06

fw_setmodel cant detect a model
 
Code:


public StartKamikadze()
{
    activated = 2
    forw = register_forward(FM_SetModel,"fw_setmodel"); //register it just for gameplay #2
}


public fw_setmodel(ent,model[])
 {
    client_print(0,3,"DEBUG : activated MODE IS %d", activated) //this is called with any weapon drop/buy
 
    if(equali(model,"models/backpack.mdl"))
    {
        client_print(0 , 3 ,"DEBUG : activated MODEL BACKPACK FOUND")  // THIS IS NOT CALLED
        engfunc( EngFunc_SetModel, ent , invis_c4 );
        return FMRES_SUPERCEDE;
    }

    if(equali(model,"models/w_c4.mdl"))
    {
        client_print(0,3,"DEBUG : activated MODEL w_c4 FOUND")  // THIS IS NOT CALLED
        engfunc( EngFunc_SetModel, ent , invis_c4 );
        return FMRES_SUPERCEDE;
    }

    return FMRES_IGNORED;
}

so the function is called
but if (equali ( model = NOT . I need to make backpack.mdl invisible so the others cant see who carries the bomb )

DavidJr 01-13-2014 05:42

Re: fw_setmodel cant detect a model
 
PHP Code:

if(equali(model,"models/backpack.mdl"))
    {
        
client_print(,"DEBUG : activated MODEL BACKPACK FOUND")  // THIS IS NOT CALLED
        
engfuncEngFunc_SetModelent invis_c4 );
        return 
FMRES_SUPERCEDE;
    } 

change models/backpack.mdl to models/w_backpack.mdl

also c4 model will be set to backpack if it is dropped.

Anyway, try to check if the entity is valid

avril-lavigne 01-13-2014 05:48

Re: fw_setmodel cant detect a model
 
Yes w_backpack works thank you. but I want to change it on terrorist`s back .

the model still looks like backpack on terrorists back. but on the ground it changes corectly

DavidJr 01-13-2014 05:52

Re: fw_setmodel cant detect a model
 
Because backpack on player models is submodel of player model.

[IMG]http://imagizer.**************/v2/800x600q90/9/spf0.jpg[/IMG]

avril-lavigne 01-13-2014 06:04

Re: fw_setmodel cant detect a model
 
ok

/* Sets the submodel setting of the player.
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
* 0 removes it.
*/
native cs_set_user_submodel(index, value);

DavidJr 01-13-2014 06:51

Re: fw_setmodel cant detect a model
 
I usually use set_pev(id, pev_body, the value);

avril-lavigne 01-13-2014 06:55

Re: fw_setmodel cant detect a model
 
entity_set_int(player1, EV_INT_body, 0) do the same i think

need more testing.

DavidJr 01-13-2014 07:03

Re: fw_setmodel cant detect a model
 
What are you actually gonna do?

avril-lavigne 01-13-2014 07:08

Re: fw_setmodel cant detect a model
 
no its done, thank you for help

backpack is invisible when T has the bomb


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

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