Raised This Month: $ Target: $400
 0% 

Custom Weapon Drop & Pickup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-05-2013 , 03:40   Re: Custom Weapon Drop
Reply With Quote #1

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Golden Weapons"
#define VERSION "1.0"
#define AUTHOR "Blizzard"

new g_weaponModels[][] = {
	"w_ak47.mdl",
	"w_m4a1.mdl",
	"w_deagle.mdl"
};

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("CurWeapon","event_curweapon","be", "1=1");
	
	register_forward(FM_SetModel, "fw_SetModel" );    
}

public plugin_precache() {    
    precache_model("models/golden/v_ak47.mdl");
    precache_model("models/golden/p_ak47.mdl");
    precache_model("models/golden/v_m4a1.mdl");
    precache_model("models/golden/p_m4a1.mdl");
    precache_model("models/golden/v_deagle.mdl");
    precache_model("models/golden/p_deagle.mdl");
	
	for(new i = 0; i < sizeof g_weaponModels; i++)
	{
		static modelPatch[124];
		formatex(modelPatch, charsmax(modelPatch), "models/golden/%s", g_weaponModels[i]);
		precache_model(modelPatch);
	}
} 

public event_curweapon(id) { 
    new clip, ammo, weapon = get_user_weapon(id, clip, ammo);
    
    if(weapon == CSW_AK47) { 
        set_pev(id, pev_viewmodel2, "models/golden/v_ak47.mdl");
        set_pev(id, pev_weaponmodel2, "models/golden/p_ak47.mdl");
        
        if(pev(id, pev_button) & IN_ATTACK) {
            set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
        }
    }
    if(weapon == CSW_M4A1) {
        set_pev(id, pev_viewmodel2, "models/golden/v_m4a1.mdl");
        set_pev(id, pev_weaponmodel2, "models/golden/p_m4a1.mdl");
        
        if(pev(id, pev_button) & IN_ATTACK)  {   
            set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
        }
    }
    if(weapon == CSW_DEAGLE) {
        set_pev(id, pev_viewmodel2, "models/golden/v_deagle.mdl");
        set_pev(id, pev_weaponmodel2, "models/golden/p_deagle.mdl");
        
        if(pev(id, pev_button) & IN_ATTACK) {   
            set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0});
        }
    }
    return PLUGIN_CONTINUE;
}

public fw_SetModel(ent, const model[]) {
	for(new i = 0; i < sizeof g_weaponModels; i++) {
		if(equal(model[7], g_weaponModels[i])) {
			static newModel[32];
			formatex(newModel, charsmax(newModel), "models/golden/%s", g_weaponModels[i]);
			engfunc(EngFunc_SetModel, ent, newModel);
			return FMRES_SUPERCEDE;
		}
	}
	return FMRES_IGNORED;
}
btw, you can check any w model
TheDS1337 is offline
Reply



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:27.


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