AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   entity_set_model (https://forums.alliedmods.net/showthread.php?t=53847)

soccdoodcss 04-11-2007 23:08

entity_set_model
 
PHP Code:

case CSW_M4A1:
        {
            new 
V_RIFLE[56]
            new 
P_RIFLE[56]
            
            
format(V_RIFLE,55,"models/v_halorifle.mdl")
            
format(P_RIFLE,55,"models/p_halorifle.mdl")
            
entity_set_model(EV_SZ_modelP_RIFLE)
            
entity_set_model(EV_SZ_viewmodelV_RIFLE)
            
            return 
PLUGIN_HANDLED
        


This isn't setting any models at all, I did precache the models. Also, my knife model sets but when changing to grenade it stays the knife model, any way around that? Thanks

Deviance 04-11-2007 23:24

Re: entity_set_model
 
Code:
case CSW_M4A1:         {             new V_RIFLE[56]             new P_RIFLE[56]                         format(V_RIFLE,55,"models/v_halorifle.mdl")             format(P_RIFLE,55,"models/p_halorifle.mdl")             entity_set_string(id, EV_SZ_viewmodel, V_RIFLE)             entity_set_string(id, EV_SZ_weaponmodel, P_RIFLE)                         return PLUGIN_HANDLED         }

soccdoodcss 04-12-2007 00:26

Re: entity_set_model
 
This works, but none of the models go through heir movements such as reload and firing and such. Only a picture of the gun.

Deviance 04-12-2007 00:30

Re: entity_set_model
 
Quote:

Originally Posted by soccdoodcss (Post 463745)
This works, but none of the models go through heir movements such as reload and firing and such. Only a picture of the gun.

This can be because the guns your using is ment to be used on another weapons.

soccdoodcss 04-12-2007 16:41

Re: entity_set_model
 
Oh didn't think about that, thanks.

When I change to pistol after having it out, the model stays. :(

LittleDude 04-12-2007 20:13

Re: entity_set_model
 
Quote:

Originally Posted by soccdoodcss (Post 464051)

When I change to pistol after having it out, the model stays. :(

Use the CurWeapon event to get the current weapon, and if it's not the right model set it back to the right model

regalis 04-13-2007 15:03

Re: entity_set_model
 
Code:
register_event("CurWeapon", "Change_Wpn", "be")//Weapon changed ...... // Called on player switches his weapon public Change_Wpn(id) {     if (!get_pcvar_num(g_speed_enabled)) return PLUGIN_HANDLED             new WeaponNum = read_data(2)  // read and store the weaponID     new WeaponActive = read_data(1)  // read the flag if weapon is active (user holds in his hand)     if (WeaponNum != WeaponUsed[id] && WeaponActive)  // if weapon has changed and its the active weapon continue     {         WeaponUsed[id] = WeaponNum         calculate_speed(id, WeaponNum)         give_speed(id)     }     return PLUGIN_HANDLED } ...... // Calculate the percentual running- and walking-speed for current Weapon (e.g. awp gives a slower speed than knife) stock calculate_speed(id, WeaponNum) {     new speed_value = get_pcvar_num(g_speed_value)     switch (WeaponNum)     {     case 3:{                     // CSW_SCOUT                     g_data[id][0] = (speed_value * 104)/100;                 // Calculate the speed for current Weapon                     g_data[id][1] = (g_data[id][0]*55)/100;        // Calculate the walking speed for current Weapon(plus a little buffer)                  }     case 30:{                     // CSW_P90                     g_data[id][0] = (speed_value * 98)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 5, 8, 14, 15:{                     // CSW_XM1014, CSW_AUG, CSW_GALI, CSW_FAMAS                     g_data[id][0] = (speed_value * 96)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 27:{                     // CSW_SG552                     g_data[id][0] = (speed_value * 94)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 21, 22:{                     // CSW_M3, CSW_M4A1                     g_data[id][0] = (speed_value * 92)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 28:{                     // CSW_AK47                     g_data[id][0] = (speed_value * 884)/1000;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 20:{                     // CSW_M249                     g_data[id][0] = (speed_value * 88)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     case 13, 18, 24:{                     // CSW_SG550, CSW_AWP, CSW_G3SG1                     g_data[id][0] = (speed_value * 84)/100;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     default:{                     // All other weapons and nades                     g_data[id][0] = speed_value;                     g_data[id][1] = (g_data[id][0]*55)/100;                     }     }     return PLUGIN_CONTINUE }

Maybe this will help you with your problem!?

greetz regalis

soccdoodcss 04-13-2007 16:42

Re: entity_set_model
 
Wow, thanks! That helps a lot. Will try when I get a chance.


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

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