AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Model toggle help (https://forums.alliedmods.net/showthread.php?t=45575)

10Stars 10-06-2006 06:46

Model toggle help
 
MMmk this was completely private, but i think ill release it if i can get it so that when someone says /nosource that it removes the source models:::*Yet i highly doubt it would be approved, due to the fact that it will only let users toggle between 1.6 models and CSS models.

Code:
#include <amxmodx> #include <fakemeta> #include <engine> #include <cstrike> new PLUGIN_NAME[] = "Countermodels" new PLUGIN_VERSION[] =  "6.2" new PLUGIN_AUTHOR[] =   "10$74|2$" new hasModels[33] public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")     register_clcmd("say /source", "cmdModels", 0) } public cmdModels(id) {     hasModels[id] = 1 } public client_connect(id) {     hasModels[id] = 0 } public plugin_precache() {     precache_model("models/CSS/v_ak47.mdl") } public Event_CurWeapon(id) {     if(!is_user_alive(id) || !hasModels[id])         return PLUGIN_CONTINUE         new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])     if(weapon == CSW_KNIFE)     {         entity_set_string(id, EV_SZ_viewmodel,"models/CSS/v_knife.mdl")     }         return PLUGIN_CONTINUE }

I stopped at 6.2 because i couldnt figure out how to remove the models once a user has switched to them.

Any help o.o

Xanimos 10-06-2006 07:58

Re: Model toggle help
 
Ok, here is a simple way to do it. I have a global array (set up in the same order they are for CSW_* constants) You can take this array and copy and paste and change the v_ to p_ and another for w_ so you have all three if you like, this was just an example. I gave you two ways of doing this, one through engine like you had it, and the other through FM (if you are planning on doing w_ models you need to use FM anyway)

Code:
enum {     DefModel = 0,     CSSModel } new g_szViewModels[MAX_WEAPONS][2][] = {     {"",""},     {"models/v_p228.mdl","models/CSS/v_p228.mdl"},     {"",""},     {"models/v_scout.mdl","models/CSS/v_scout.mdl"},     {"models/v_hegrenade.mdl","models/CSS/v_hegrenade.mdl"},     {"models/v_xm1014.mdl","models/CSS/v_xm1014.mdl"},     {"models/v_c4.mdl","models/CSS/v_c4.mdl"},     {"models/v_mac10.mdl","models/CSS/v_mac10.mdl"},     {"models/v_aug.mdl","models/CSS/v_aug.mdl"},     {"models/v_smokegrenade.mdl","models/CSS/v_smokegrenade.mdl"},     {"models/v_elite.mdl","models/CSS/v_elite.mdl"},     {"models/v_fiveseven.mdl","models/CSS/v_fiveseven.mdl"},     {"models/v_ump45.mdl","models/CSS/v_ump45.mdl"},     {"models/v_sg550.mdl","models/CSS/v_sg550.mdl"},     {"models/v_galil.mdl","models/CSS/v_galil.mdl"},     {"models/v_famas.mdl","models/CSS/v_famas.mdl"},     {"models/v_usp.mdl","models/CSS/v_usp.mdl"},     {"models/v_glock.mdl","models/CSS/v_glock.mdl"},     {"models/v_awp.mdl","models/CSS/v_awp.mdl"},     {"models/v_mp5.mdl","models/CSS/v_mp5.mdl"},     {"models/v_m249.mdl","models/CSS/v_m249.mdl"},     {"models/v_m3.mdl","models/CSS/v_m3.mdl"},     {"models/v_m4a1.mdl","models/CSS/v_m4a1.mdl"},     {"models/v_tmp.mdl","models/CSS/v_tmp.mdl"},     {"models/v_g3sg1.mdl","models/CSS/v_g3sg1.mdl"},     {"models/v_flashbang.mdl","models/CSS/v_flashbang.mdl"},     {"models/v_deagle.mdl","models/CSS/v_deagle.mdl"},     {"models/v_sg552.mdl","models/CSS/v_sg552.mdl"},     {"models/v_ak47.mdl","models/CSS/v_ak47.mdl"},     {"models/v_knife.mdl","models/CSS/v_knife.mdl"},     {"models/v_p90.mdl","models/CSS/v_p90.mdl"} } //..... public Event_CurWeapon(id) {     if(!is_user_alive(id))         return PLUGIN_CONTINUE             //Engine     entity_set_string(id, EV_SZ_viewmodel, g_szViewModels[read_data(2)][(hasModels[id]) ? CSSModel : DefModel] )     //FM     set_pev(id, pev_viewmodel2, g_szViewModels[read_data(2)][(hasModels[id]) ? CSSModel : DefModel] )         return PLUGIN_CONTINUE }


All times are GMT -4. The time now is 04:47.

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