Raised This Month: $ Target: $400
 0% 

Temporaly change model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HumanMod
Junior Member
Join Date: Mar 2009
Old 05-30-2009 , 11:03   Temporaly change model
Reply With Quote #1

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
HumanMod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-30-2009 , 11:27   Re: Temporaly change model
Reply With Quote #2

Replace your line by : set_pev( player, pev_viewmodel2, "models/knife/v_knife.mdl" );
__________________
Arkshine is offline
HumanMod
Junior Member
Join Date: Mar 2009
Old 05-30-2009 , 11:39   Re: Temporaly change model
Reply With Quote #3

Still not work
HumanMod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-30-2009 , 11:50   Re: Temporaly change model
Reply With Quote #4

It should, i see nothing wrong.
__________________
Arkshine is offline
HumanMod
Junior Member
Join Date: Mar 2009
Old 05-30-2009 , 12:21   Re: Temporaly change model
Reply With Quote #5

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.
HumanMod is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 05-30-2009 , 12:31   Re: Temporaly change model
Reply With Quote #6

When you change weapons, of course it's gonna change the model. Hook CurWeapon and change it again when the weapon changes.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-30-2009 , 12:41   Re: Temporaly change model
Reply With Quote #7

Yeah, you have to use another event, like CurWeapon or using Ham_Item_Deploy avec weapon_knife as classname.
__________________
Arkshine is offline
HumanMod
Junior Member
Join Date: Mar 2009
Old 05-30-2009 , 13:38   Re: Temporaly change model
Reply With Quote #8

I'm not experienced enough in this. Can you give me an example?
HumanMod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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