Raised This Month: $51 Target: $400
 12% 

Solved changing v_ model


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 02-23-2021 , 08:26   changing v_ model
Reply With Quote #1

Hello guys! I have 2 questions (I know about 1 question per topic)
1) If i holding a knife, then typing "changeknife 1" in console, viewmodel isn't changing immediately. I need to change to any other weapon and then change back to knife. Is there any way to fix this?
2) Which weapon models can be changed via "entity_set_string(id, EV_SZ_viewmodel, modelname)"?
Here is the script i using:
PHP Code:
#include < amxmodx >
#include < engine >

new const models[][] = {
    
"models/v_knife.mdl",
    
"models/p_knife.mdl",
    
"models/v_knife_r.mdl"
}

enum _:udata {
    
knife
}

new 
UserData[33][udata]

public 
plugin_precache()
{
    for(new 
isizeof(models); i++)
        
precache_model(models[i])
}

public 
plugin_init() {
    
register_plugin ("knife changer""test""kww (yes)")
    
    
register_event ("CurWeapon""event_curweapon""be""1=1")
    
register_clcmd ("changeknife""xknife_handler")
}

public 
client_putinserver id ) {
    
UserData[id][knife] = 0
}

public 
xknife_handler(id) {
    new 
x_arg[16]
    
read_argv(1x_argcharsmax(x_arg))
    
    switch(
x_arg[0]) {
        case 
EOSclient_print(idprint_console"* Usage: changeknife <1|0> (now %i)"UserData[id][knife])
        case 
'0'UserData[id][knife] = 0
        
case '1'UserData[id][knife] = 1
    
}
    
client_print(idprint_console"%i", )
    return 
PLUGIN_HANDLED
}

public 
event_curweapon(id) {
    new 
wpn read_data(2)
    if (
wpn == CSW_KNIFE) {
        switch (
UserData[id][knife]) {
            case 
0:
            {
                
entity_set_string(idEV_SZ_viewmodelmodels[0])
                
entity_set_string(idEV_SZ_weaponmodelmodels[1])
            }
            case 
1:
            {
                
entity_set_string(idEV_SZ_viewmodelmodels[2])
            }
        }
    }
    
    return 
PLUGIN_CONTINUE


Last edited by kww; 02-23-2021 at 10:18.
kww is offline
 



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 16:57.


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