AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Temporaly change model (https://forums.alliedmods.net/showthread.php?t=93542)

HumanMod 05-30-2009 11:03

Temporaly change model
 
Hi I've been trying all day to change models but with no success. Could someone help me to do that? Here is my code:
Code:

public plugin_precache()
{       
    precache_model("models/knife/v_knife.mdl")
}

public zp_extra_item_selected(player, itemid)
{
    if(itemid == g_sps)
    {   
       
        g_hassps[player] = 1
       
        new temp[2], weaponID = get_user_weapon(player, temp[0], temp[1])
        if(weaponID == CSW_KNIFE)
        {
            entity_set_string(player, EV_SZ_viewmodel, "models/knife/v_knife.mdl")
        }
       
    }
        return PLUGIN_CONTINUE
}

I need to change the model when player buys that item

Arkshine 05-30-2009 11:27

Re: Temporaly change model
 
Replace your line by : set_pev( player, pev_viewmodel2, "models/knife/v_knife.mdl" );

HumanMod 05-30-2009 11:39

Re: Temporaly change model
 
Still not work

Arkshine 05-30-2009 11:50

Re: Temporaly change model
 
It should, i see nothing wrong.

HumanMod 05-30-2009 12:21

Re: Temporaly change model
 
I don't know why but it doesn't work. It changed for a sec and then I rechanged weapons it changed to knife again.

Drak 05-30-2009 12:31

Re: Temporaly change model
 
When you change weapons, of course it's gonna change the model. Hook CurWeapon and change it again when the weapon changes.

Arkshine 05-30-2009 12:41

Re: Temporaly change model
 
Yeah, you have to use another event, like CurWeapon or using Ham_Item_Deploy avec weapon_knife as classname.

HumanMod 05-30-2009 13:38

Re: Temporaly change model
 
I'm not experienced enough in this. Can you give me an example?


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

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