AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help]custom weapon models with shield (https://forums.alliedmods.net/showthread.php?t=27026)

FL@ME 04-13-2006 10:02

[help]custom weapon models with shield
 
i'm making a custom weapon models plugin
the problem is that when i buy,pick or drop a shield
the weapon returns to it's original model
and when i shoot or swich the weapon and then swich back
it returns to it's custom one

the script :
============================================= =========================
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>

#define PLUGIN "Custom Weapon Models"
#define VERSION "1.0"
#define AUTHOR "FL@ME"

#define OLD_MODEL_DEAGLE_V "models/v_deagle.mdl"
#define NEW_MODEL_DEAGLE_V "models/custom_weapons/v_deagle.mdl"
#define OLD_MODEL_DEAGLE_P "models/p_deagle.mdl"
#define NEW_MODEL_DEAGLE_P "models/custom_weapons/p_deagle.mdl"
#define OLD_MODEL_DEAGLE_W "models/w_deagle.mdl"
#define NEW_MODEL_DEAGLE_W "models/custom_weapons/w_deagle.mdl"
#define OLD_MODEL_DEAGLE_VSH "models/shield/v_shield_deagle.mdl"
#define NEW_MODEL_DEAGLE_VSH "models/custom_weapons/shield/v_shield_deagle.mdl"
#define OLD_MODEL_DEAGLE_PSH "models/shield/p_shield_deagle.mdl"
#define NEW_MODEL_DEAGLE_PSH "models/custom_weapons/shield/p_shield_deagle.mdl"

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_event("CurWeapon","SetCWM","be")
}
public plugin_precache() {
precache_model("models/custom_weapons/v_deagle.mdl")
precache_model("models/custom_weapons/p_deagle.mdl")
precache_model("models/custom_weapons/w_deagle.mdl")
precache_model("models/custom_weapons/shield/v_shield_deagle.mdl")
precache_model("models/custom_weapons/shield/p_shield_deagle.mdl")
register_forward(FM_SetModel,"SetCWMW")
}
public SetCWMW(edict, const model[]) {
if (!is_valid_ent(edict))
return FMRES_IGNORED
if(equal(model, OLD_MODEL_DEAGLE_W))
{
entity_set_model(edict, NEW_MODEL_DEAGLE_W)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public SetCWM(id) {
new vmodel[32],pmodel[32]
entity_get_string(id,EV_SZ_viewmodel,vmodel,1 00)
if (equal(vmodel,OLD_MODEL_DEAGLE_V)) {
entity_set_string(id,EV_SZ_viewmodel,NEW_MODE L_DEAGLE_V)
}
else if (equal(vmodel,OLD_MODEL_DEAGLE_VSH)) {
entity_set_string(id,EV_SZ_viewmodel,NEW_MODE L_DEAGLE_VSH)
}
entity_get_string(id,EV_SZ_weaponmodel,pmodel ,100)
if (equal(pmodel,OLD_MODEL_DEAGLE_P)) {
entity_set_string(id,EV_SZ_weaponmodel,NEW_MO DEL_DEAGLE_P)
}
else if (equal(pmodel,OLD_MODEL_DEAGLE_PSH)) {
entity_set_string(id,EV_SZ_weaponmodel,NEW_MO DEL_DEAGLE_PSH)
}
}
============================================= =========================

v3x 04-13-2006 14:23

http://ghw-amxx.com/viewtopic.php?t=18

GHW_Chronic 04-13-2006 14:42

please use the [small] tag next time you post script.

v3x 04-13-2006 14:44

Hm ... You might want to use the cs_get_user_shield native as well. That is, if you're only using it for shield models.

FL@ME 04-16-2006 11:15

Quote:

Originally Posted by v3x
Hm ... You might want to use the cs_get_user_shield native as well. That is, if you're only using it for shield models.

this command is not in the help doc :(
that's why i didn't know that it's exist :)
thanks... :wink:

v3x 04-16-2006 12:04

Quote:

Originally Posted by v3x
http://ghw-amxx.com/viewtopic.php?t=18



All times are GMT -4. The time now is 05:15.

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