Proplem with setting view model
Hi, everyone
Today i'm trying to make dotsight for the aug, it worked, however, when i switch to another weapon, its view model is set to the aug! Can anyone fix it for me? Here is the code: [php] #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <fakemeta> #include <fakemeta_util> #include <engine> #include <hamsandwich> #define PLUGIN "Scope Dot" #define VERSION "1.0" #define AUTHOR "Explas" public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_PlayerPreThink, "PlayerPreThink") // Add your code here... } /[php] public plugin_precache() { precache_model("models/v_aug_scope.mdl") precache_model("models/v_aug.mdl") } public PlayerPreThink(id) { if( get_user_weapon(id) == CSW_AUG) { if( cs_get_user_zoom(id) == CS_SET_AUGSG552_ZOOM) { set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/v_aug_scope.mdl")) } if( cs_get_user_zoom(id) == CS_SET_NO_ZOOM) { set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, "models/v_aug.mdl")) } } } |
Re: Proplem with setting view model
Don't use PlayerPreThink to set a model.
Use rather Ham_Item_Deploy POST registered. Also, if you don't cache AllocString string model, use directly the string with pev_viewmodel2 instead pev_viewmodel. |
Re: Proplem with setting view model
But i want to change the model when the player is using scope, does ham_item_deploy only run when the player pick up a weapon?
|
Re: Proplem with setting view model
try with CurWeapon :) and add check:
new wpn = read_data(2); if (wpn!=get_user_weapon(id)) return; :) |
Re: Proplem with setting view model
Quote:
Your statement will always be false IIRC. |
Re: Proplem with setting view model
Quote:
|
Re: Proplem with setting view model
Quote:
Best thing is to use ConnorMcLeod's method. |
Re: Proplem with setting view model
But... does the ham_item_deploy run when i toggle zooming on/off ?
|
Re: Proplem with setting view model
Hook Fov event then, with right filters.
|
Re: Proplem with setting view model
Quote:
|
| All times are GMT -4. The time now is 08:29. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.