|
Senior Member
Join Date: Jun 2014
Location: israel
|

06-21-2014
, 07:35
Re: Problem on my plugin
|
#1
|
Quote:
Originally Posted by HamletEagle
As I can see, you don't understand very well what you are doing.
1.
PHP Code:
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1");
You have to use this, if not weapon model will reset. Search more about this event on wiki,inc files provided with amxmodx or here.
2. Another thing that I don't understand is why you set default models when he press "Normal".
3. Also cache get_user_weapon ( index ) so you won't check it so many times.
4. Your code won't work correctly,because you are not understanding what you are doing.
Flick3rR you guess wrong,there is no unknow read_data ( 2 ).
PHP Code:
#include <amxmodx> #include <cstrike> #include <fakemeta>
new bool: HasCustomWeaponsModel [ 33 ]
public plugin_precache(){ precache_model("models/HNSmodelsBySerMajor/v_knife.mdl") precache_model("models/HNSmodelsBySerMajor/p_knife.mdl") precache_model("models/HNSmodelsBySerMajor/v_hegrenade.mdl") precache_model("models/HNSmodelsBySerMajor/p_hegrenade.mdl") precache_model("models/HNSmodelsBySerMajor/v_flashbang.mdl") precache_model("models/HNSmodelsBySerMajor/p_flashbang.mdl") precache_model("models/HNSmodelsBySerMajor/v_smokegrenade.mdl") precache_model("models/HNSmodelsBySerMajor/p_smokegrenade.mdl") }
public plugin_init() { register_plugin("HnsMdlMod", "1.0", "SerMajor") register_clcmd("say /hnsmdl", "MenuShow") register_event("CurWeapon", "Event_CurWeapon", "be", "1=1"); }
public MenuShow(id) { new menu = menu_create("Hns Model Menu By SerMajor", "MenuHandler") // ?????? , MenuHandler ?????. menu_additem(menu, " Hns", "1", 0) menu_additem(menu, "Normal", "2", 0) menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu, 0) }
public MenuHandler(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], szName[33]; new acces, callback; menu_item_getinfo(menu, item, acces, data,charsmax(data), szName,charsmax(szName), callback) new key = str_to_num(data); switch(key) { case 1: { HasCustomWeaponsModel [ id ] = true client_print(id, print_chat, "You Do The HNS Models!") } case 2: { client_print(id, print_chat, "You DO The Normal Models!") return 1; } } menu_destroy(menu); return PLUGIN_HANDLED; }
public Event_CurWeapon ( id ) { new weapon = get_user_weapon ( id ) if ( ! HasCustomWeaponsModel [ id ] ) return switch ( weapon ) { case CSW_KNIFE : { set_pev(id, pev_viewmodel2, "models/HNSmodelsBySerMajor/v_knife.mdl") set_pev(id, pev_weaponmodel2, "models/HNSmodelsBySerMajor/p_knife.mdl") } case CSW_HEGRENADE : { set_pev(id, pev_viewmodel2, "models/HNSmodelsBySerMajor/v_hegrenade.mdl") set_pev(id, pev_weaponmodel2, "models/HNSmodelsBySerMajor/p_hegrenade.mdl") } case CSW_FLASHBANG : { set_pev(id, pev_viewmodel2, "models/HNSmodelsBySerMajor/v_flashbang.mdl") set_pev(id, pev_weaponmodel2, "models/HNSmodelsBySerMajor/p_flashbang.mdl") } case CSW_SMOKEGRENADE : { set_pev(id, pev_viewmodel2, "models/HNSmodelsBySerMajor/v_smokegrenade.mdl") set_pev(id, pev_weaponmodel2, "models/HNSmodelsBySerMajor/p_smokegrenade.mdl") } } }
Try this....
|
hamelteagle the mod work great but when i try default models is just stay on hns models he not equip to default.
and again sorry about my bad english.
|
|