Plugin Available Weapon models
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
Weapon models
Is there any way how to give weapon models only for VIP's ? If som one know please help https://forums.alliedmods.net/showthread.php?t=43979
- Raheem
- Mod Developer
- Posts: 2211
- Joined: 6 Years Ago
- Has thanked: 55 times
- Been thanked: 176 times
- Age: 25
- Contact:
OH, sorry
:
Required flag: VIP_A

Code: Select all
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 06-12-08
*
* ============
* Changelog:
* ============
*
* v1.3
* -Bug Fixes
*
* v1.0
* -Initial Release
*
*/
#define VERSION "1.3"
#include <ze_vip>
#define MAX_SOUNDS 50
#define MAX_p_MODELS 50
#define MAX_v_MODELS 50
#define MAX_w_MODELS 50
#define MAP_CONFIGS 1
new new_sounds[MAX_SOUNDS][48]
new old_sounds[MAX_SOUNDS][48]
new sounds_team[MAX_SOUNDS]
new soundsnum
new new_p_models[MAX_p_MODELS][48]
new old_p_models[MAX_p_MODELS][48]
new p_models_team[MAX_p_MODELS]
new p_modelsnum
new new_v_models[MAX_v_MODELS][48]
new old_v_models[MAX_v_MODELS][48]
new v_models_team[MAX_p_MODELS]
new v_modelsnum
new new_w_models[MAX_w_MODELS][48]
new old_w_models[MAX_w_MODELS][48]
new w_models_team[MAX_p_MODELS]
new w_modelsnum
new maxplayers
public plugin_init()
{
register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
register_forward(FM_EmitSound,"Sound_Hook")
register_forward(FM_SetModel,"W_Model_Hook",1)
//register_logevent("newround",2,"1=Round_Start")
register_event("CurWeapon","Changeweapon_Hook","be","1=1")
maxplayers = get_maxplayers()
}
public plugin_precache()
{
new configfile[200]
new configsdir[200]
new map[32]
get_configsdir(configsdir,199)
get_mapname(map,31)
format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
if(file_exists(configfile))
{
load_models(configfile)
}
else
{
format(configfile,199,"%s/new_weapons.ini",configsdir)
load_models(configfile)
}
}
public load_models(configfile[])
{
if(file_exists(configfile))
{
new read[96], left[48], right[48], right2[32], trash, team
for(new i=0;i<file_size(configfile,1);i++)
{
read_file(configfile,i,read,95,trash)
if(containi(read,";")!=0 && containi(read," ")!=-1)
{
strbreak(read,left,47,right,47)
team=0
if(containi(right," ")!=-1)
{
strbreak(right,right,47,right2,31)
replace_all(right2,31,"^"","")
if(
equali(right2,"T") ||
equali(right2,"Terrorist") ||
equali(right2,"Terrorists") ||
equali(right2,"Blue") ||
equali(right2,"B") ||
equali(right2,"Allies") ||
equali(right2,"1")
) team=1
else if(
equali(right2,"CT") ||
equali(right2,"Counter") ||
equali(right2,"Counter-Terrorist") ||
equali(right2,"Counter-Terrorists") ||
equali(right2,"CounterTerrorists") ||
equali(right2,"CounterTerrorist") ||
equali(right2,"Red") ||
equali(right2,"R") ||
equali(right2,"Axis") ||
equali(right2,"2")
) team=2
else if(
equali(right2,"Yellow") ||
equali(right2,"Y") ||
equali(right2,"3")
) team=3
else if(
equali(right2,"Green") ||
equali(right2,"G") ||
equali(right2,"4")
) team=4
}
replace_all(right,47,"^"","")
if(file_exists(right))
{
if(containi(right,".mdl")==strlen(right)-4)
{
if(!precache_model(right))
{
log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
else if(containi(left,"models/p_")==0)
{
format(new_p_models[p_modelsnum],47,right)
format(old_p_models[p_modelsnum],47,left)
p_models_team[p_modelsnum]=team
p_modelsnum++
}
else if(containi(left,"models/v_")==0)
{
format(new_v_models[v_modelsnum],47,right)
format(old_v_models[v_modelsnum],47,left)
v_models_team[v_modelsnum]=team
v_modelsnum++
}
else if(containi(left,"models/w_")==0)
{
format(new_w_models[w_modelsnum],47,right)
format(old_w_models[w_modelsnum],47,left)
w_models_team[w_modelsnum]=team
w_modelsnum++
}
else
{
log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
}
else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
{
replace(right,47,"sound/","")
replace(left,47,"sound/","")
if(!precache_sound(right))
{
log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
else
{
format(new_sounds[soundsnum],47,right)
format(old_sounds[soundsnum],47,left)
sounds_team[soundsnum]=team
soundsnum++
}
}
else
{
log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
}
else
{
log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
/*if(!file_exists(left))
{
log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
}*/
}
}
}
}
public Changeweapon_Hook(id)
{
if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
{
return PLUGIN_CONTINUE
}
static model[32], i, team
team = get_user_team(id)
pev(id,pev_viewmodel2,model,31)
for(i=0;i<v_modelsnum;i++)
{
if(equali(model,old_v_models[i]))
{
if(v_models_team[i]==team || !v_models_team[i])
{
set_pev(id,pev_viewmodel2,new_v_models[i])
break;
}
}
}
pev(id,pev_weaponmodel2,model,31)
for(i=0;i<p_modelsnum;i++)
{
if(equali(model,old_p_models[i]))
{
if(p_models_team[i]==team || !p_models_team[i])
{
set_pev(id,pev_weaponmodel2,new_p_models[i])
break;
}
}
}
return PLUGIN_CONTINUE
}
public Sound_Hook(id,channel,sample[])
{
if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
{
return FMRES_IGNORED
}
if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
{
return FMRES_IGNORED
}
static i, team
team = get_user_team(id)
for(i=0;i<soundsnum;i++)
{
if(equali(sample,old_sounds[i]))
{
if(sounds_team[i]==team || !sounds_team[i])
{
engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public W_Model_Hook(ent,model[])
{
new iOwner = get_entvar(ent, var_owner);
if(!pev_valid(ent) && !(ze_get_vip_flags(id) & iOwner))
{
return FMRES_IGNORED
}
static i
for(i=0;i<w_modelsnum;i++)
{
if(equali(model,old_w_models[i]))
{
engfunc(EngFunc_SetModel,ent,new_w_models[i])
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
/*public newround()
{
static ent, classname[8], model[32]
ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
while(ent)
{
if(pev_valid(ent))
{
pev(ent,pev_classname,classname,7)
if(containi(classname,"armoury")!=-1)
{
pev(ent,pev_model,model,31)
W_Model_Hook(ent,model)
}
}
ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
}
}*/
He who fails to plan is planning to fail
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 6 Years Ago
- Location: Egypt
- Has thanked: 39 times
- Been thanked: 58 times
- Age: 23
- Contact:
Updated code:
- #define VERSION "1.3"
- #include <zombie_escape>
- #include <ze_vip>
- #define MAX_SOUNDS 50
- #define MAX_p_MODELS 50
- #define MAX_v_MODELS 50
- #define MAX_w_MODELS 50
- #define MAP_CONFIGS 1
- new new_sounds[MAX_SOUNDS][48]
- new old_sounds[MAX_SOUNDS][48]
- new sounds_team[MAX_SOUNDS]
- new soundsnum
- new new_p_models[MAX_p_MODELS][48]
- new old_p_models[MAX_p_MODELS][48]
- new p_models_team[MAX_p_MODELS]
- new p_modelsnum
- new new_v_models[MAX_v_MODELS][48]
- new old_v_models[MAX_v_MODELS][48]
- new v_models_team[MAX_p_MODELS]
- new v_modelsnum
- new new_w_models[MAX_w_MODELS][48]
- new old_w_models[MAX_w_MODELS][48]
- new w_models_team[MAX_p_MODELS]
- new w_modelsnum
- new maxplayers
- public plugin_init()
- {
- register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
- register_forward(FM_EmitSound,"Sound_Hook")
- register_forward(FM_SetModel,"W_Model_Hook",1)
- register_event("CurWeapon","Changeweapon_Hook","be","1=1")
- maxplayers = get_maxplayers()
- }
- public plugin_precache()
- {
- new configfile[200]
- new configsdir[200]
- new map[32]
- get_configsdir(configsdir,199)
- get_mapname(map,31)
- format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
- if(file_exists(configfile))
- {
- load_models(configfile)
- }
- else
- {
- format(configfile,199,"%s/new_weapons.ini",configsdir)
- load_models(configfile)
- }
- }
- public load_models(configfile[])
- {
- if(file_exists(configfile))
- {
- new read[96], left[48], right[48], right2[32], trash, team
- for(new i=0;i<file_size(configfile,1);i++)
- {
- read_file(configfile,i,read,95,trash)
- if(containi(read,";")!=0 && containi(read," ")!=-1)
- {
- strbreak(read,left,47,right,47)
- team=0
- if(containi(right," ")!=-1)
- {
- strbreak(right,right,47,right2,31)
- replace_all(right2,31,"^"","")
- if(
- equali(right2,"T") ||
- equali(right2,"Terrorist") ||
- equali(right2,"Terrorists") ||
- equali(right2,"Blue") ||
- equali(right2,"B") ||
- equali(right2,"Allies") ||
- equali(right2,"1")
- ) team=1
- else if(
- equali(right2,"CT") ||
- equali(right2,"Counter") ||
- equali(right2,"Counter-Terrorist") ||
- equali(right2,"Counter-Terrorists") ||
- equali(right2,"CounterTerrorists") ||
- equali(right2,"CounterTerrorist") ||
- equali(right2,"Red") ||
- equali(right2,"R") ||
- equali(right2,"Axis") ||
- equali(right2,"2")
- ) team=2
- else if(
- equali(right2,"Yellow") ||
- equali(right2,"Y") ||
- equali(right2,"3")
- ) team=3
- else if(
- equali(right2,"Green") ||
- equali(right2,"G") ||
- equali(right2,"4")
- ) team=4
- }
- replace_all(right,47,"^"","")
- if(file_exists(right))
- {
- if(containi(right,".mdl")==strlen(right)-4)
- {
- if(!precache_model(right))
- {
- log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else if(containi(left,"models/p_")==0)
- {
- format(new_p_models[p_modelsnum],47,right)
- format(old_p_models[p_modelsnum],47,left)
- p_models_team[p_modelsnum]=team
- p_modelsnum++
- }
- else if(containi(left,"models/v_")==0)
- {
- format(new_v_models[v_modelsnum],47,right)
- format(old_v_models[v_modelsnum],47,left)
- v_models_team[v_modelsnum]=team
- v_modelsnum++
- }
- else if(containi(left,"models/w_")==0)
- {
- format(new_w_models[w_modelsnum],47,right)
- format(old_w_models[w_modelsnum],47,left)
- w_models_team[w_modelsnum]=team
- w_modelsnum++
- }
- else
- {
- log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
- {
- replace(right,47,"sound/","")
- replace(left,47,"sound/","")
- if(!precache_sound(right))
- {
- log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else
- {
- format(new_sounds[soundsnum],47,right)
- format(old_sounds[soundsnum],47,left)
- sounds_team[soundsnum]=team
- soundsnum++
- }
- }
- else
- {
- log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else
- {
- log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- /*if(!file_exists(left))
- {
- log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
- }*/
- }
- }
- }
- }
- public Changeweapon_Hook(id)
- {
- if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
- {
- return PLUGIN_CONTINUE
- }
- static model[32], i, team
- team = get_user_team(id)
- pev(id,pev_viewmodel2,model,31)
- for(i=0;i<v_modelsnum;i++)
- {
- if(equali(model,old_v_models[i]))
- {
- if(v_models_team[i]==team || !v_models_team[i])
- {
- set_pev(id,pev_viewmodel2,new_v_models[i])
- break;
- }
- }
- }
- pev(id,pev_weaponmodel2,model,31)
- for(i=0;i<p_modelsnum;i++)
- {
- if(equali(model,old_p_models[i]))
- {
- if(p_models_team[i]==team || !p_models_team[i])
- {
- set_pev(id,pev_weaponmodel2,new_p_models[i])
- break;
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public Sound_Hook(id,channel,sample[])
- {
- if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
- {
- return FMRES_IGNORED
- }
- if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
- {
- return FMRES_IGNORED
- }
- static i, team
- team = get_user_team(id)
- for(i=0;i<soundsnum;i++)
- {
- if(equali(sample,old_sounds[i]))
- {
- if(sounds_team[i]==team || !sounds_team[i])
- {
- engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
- return FMRES_SUPERCEDE
- }
- }
- }
- return FMRES_IGNORED
- }
- public W_Model_Hook(ent,model[])
- {
- new iOwner = get_entvar(ent, var_owner);
- if(!pev_valid(ent) && !(ze_get_vip_flags(id) & iOwner))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,ent,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
can you fix itJack GamePlay wrote: ↑4 Years AgoUpdated code:
#define VERSION "1.3" #include <zombie_escape> #include <ze_vip> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds[MAX_SOUNDS][48] new old_sounds[MAX_SOUNDS][48] new sounds_team[MAX_SOUNDS] new soundsnum new new_p_models[MAX_p_MODELS][48] new old_p_models[MAX_p_MODELS][48] new p_models_team[MAX_p_MODELS] new p_modelsnum new new_v_models[MAX_v_MODELS][48] new old_v_models[MAX_v_MODELS][48] new v_models_team[MAX_p_MODELS] new v_modelsnum new new_w_models[MAX_w_MODELS][48] new old_w_models[MAX_w_MODELS][48] new w_models_team[MAX_p_MODELS] new w_modelsnum new maxplayers public plugin_init() { register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic") register_forward(FM_EmitSound,"Sound_Hook") register_forward(FM_SetModel,"W_Model_Hook",1) register_event("CurWeapon","Changeweapon_Hook","be","1=1") maxplayers = get_maxplayers() } public plugin_precache() { new configfile[200] new configsdir[200] new map[32] get_configsdir(configsdir,199) get_mapname(map,31) format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map) if(file_exists(configfile)) { load_models(configfile) } else { format(configfile,199,"%s/new_weapons.ini",configsdir) load_models(configfile) } } public load_models(configfile[]) { if(file_exists(configfile)) { new read[96], left[48], right[48], right2[32], trash, team for(new i=0;i<file_size(configfile,1);i++) { read_file(configfile,i,read,95,trash) if(containi(read,";")!=0 && containi(read," ")!=-1) { strbreak(read,left,47,right,47) team=0 if(containi(right," ")!=-1) { strbreak(right,right,47,right2,31) replace_all(right2,31,"^"","") if( equali(right2,"T") || equali(right2,"Terrorist") || equali(right2,"Terrorists") || equali(right2,"Blue") || equali(right2,"B") || equali(right2,"Allies") || equali(right2,"1") ) team=1 else if( equali(right2,"CT") || equali(right2,"Counter") || equali(right2,"Counter-Terrorist") || equali(right2,"Counter-Terrorists") || equali(right2,"CounterTerrorists") || equali(right2,"CounterTerrorist") || equali(right2,"Red") || equali(right2,"R") || equali(right2,"Axis") || equali(right2,"2") ) team=2 else if( equali(right2,"Yellow") || equali(right2,"Y") || equali(right2,"3") ) team=3 else if( equali(right2,"Green") || equali(right2,"G") || equali(right2,"4") ) team=4 } replace_all(right,47,"^"","") if(file_exists(right)) { if(containi(right,".mdl")==strlen(right)-4) { if(!precache_model(right)) { log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else if(containi(left,"models/p_")==0) { format(new_p_models[p_modelsnum],47,right) format(old_p_models[p_modelsnum],47,left) p_models_team[p_modelsnum]=team p_modelsnum++ } else if(containi(left,"models/v_")==0) { format(new_v_models[v_modelsnum],47,right) format(old_v_models[v_modelsnum],47,left) v_models_team[v_modelsnum]=team v_modelsnum++ } else if(containi(left,"models/w_")==0) { format(new_w_models[w_modelsnum],47,right) format(old_w_models[w_modelsnum],47,left) w_models_team[w_modelsnum]=team w_modelsnum++ } else { log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4) { replace(right,47,"sound/","") replace(left,47,"sound/","") if(!precache_sound(right)) { log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else { format(new_sounds[soundsnum],47,right) format(old_sounds[soundsnum],47,left) sounds_team[soundsnum]=team soundsnum++ } } else { log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else { log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook(id) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) pev(id,pev_viewmodel2,model,31) for(i=0;i<v_modelsnum;i++) { if(equali(model,old_v_models[i])) { if(v_models_team[i]==team || !v_models_team[i]) { set_pev(id,pev_viewmodel2,new_v_models[i]) break; } } } pev(id,pev_weaponmodel2,model,31) for(i=0;i<p_modelsnum;i++) { if(equali(model,old_p_models[i])) { if(p_models_team[i]==team || !p_models_team[i]) { set_pev(id,pev_weaponmodel2,new_p_models[i]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook(id,channel,sample[]) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return FMRES_IGNORED } if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM) { return FMRES_IGNORED } static i, team team = get_user_team(id) for(i=0;i<soundsnum;i++) { if(equali(sample,old_sounds[i])) { if(sounds_team[i]==team || !sounds_team[i]) { engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook(ent,model[]) { new iOwner = get_entvar(ent, var_owner); if(!pev_valid(ent) && !(ze_get_vip_flags(id) & iOwner)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,ent,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }


- Mark
- VIP
- Posts: 283
- Joined: 4 Years Ago
- Location: Des Moines/USA
- Donation: 1x donated in total €10.00
- Has thanked: 6 times
- Been thanked: 22 times
- Age: 37
- Contact:
Try!sPe3doN wrote: ↑4 Years Agocan you fix itJack GamePlay wrote: ↑4 Years AgoUpdated code:
#define VERSION "1.3" #include <zombie_escape> #include <ze_vip> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds[MAX_SOUNDS][48] new old_sounds[MAX_SOUNDS][48] new sounds_team[MAX_SOUNDS] new soundsnum new new_p_models[MAX_p_MODELS][48] new old_p_models[MAX_p_MODELS][48] new p_models_team[MAX_p_MODELS] new p_modelsnum new new_v_models[MAX_v_MODELS][48] new old_v_models[MAX_v_MODELS][48] new v_models_team[MAX_p_MODELS] new v_modelsnum new new_w_models[MAX_w_MODELS][48] new old_w_models[MAX_w_MODELS][48] new w_models_team[MAX_p_MODELS] new w_modelsnum new maxplayers public plugin_init() { register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic") register_forward(FM_EmitSound,"Sound_Hook") register_forward(FM_SetModel,"W_Model_Hook",1) register_event("CurWeapon","Changeweapon_Hook","be","1=1") maxplayers = get_maxplayers() } public plugin_precache() { new configfile[200] new configsdir[200] new map[32] get_configsdir(configsdir,199) get_mapname(map,31) format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map) if(file_exists(configfile)) { load_models(configfile) } else { format(configfile,199,"%s/new_weapons.ini",configsdir) load_models(configfile) } } public load_models(configfile[]) { if(file_exists(configfile)) { new read[96], left[48], right[48], right2[32], trash, team for(new i=0;i<file_size(configfile,1);i++) { read_file(configfile,i,read,95,trash) if(containi(read,";")!=0 && containi(read," ")!=-1) { strbreak(read,left,47,right,47) team=0 if(containi(right," ")!=-1) { strbreak(right,right,47,right2,31) replace_all(right2,31,"^"","") if( equali(right2,"T") || equali(right2,"Terrorist") || equali(right2,"Terrorists") || equali(right2,"Blue") || equali(right2,"B") || equali(right2,"Allies") || equali(right2,"1") ) team=1 else if( equali(right2,"CT") || equali(right2,"Counter") || equali(right2,"Counter-Terrorist") || equali(right2,"Counter-Terrorists") || equali(right2,"CounterTerrorists") || equali(right2,"CounterTerrorist") || equali(right2,"Red") || equali(right2,"R") || equali(right2,"Axis") || equali(right2,"2") ) team=2 else if( equali(right2,"Yellow") || equali(right2,"Y") || equali(right2,"3") ) team=3 else if( equali(right2,"Green") || equali(right2,"G") || equali(right2,"4") ) team=4 } replace_all(right,47,"^"","") if(file_exists(right)) { if(containi(right,".mdl")==strlen(right)-4) { if(!precache_model(right)) { log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else if(containi(left,"models/p_")==0) { format(new_p_models[p_modelsnum],47,right) format(old_p_models[p_modelsnum],47,left) p_models_team[p_modelsnum]=team p_modelsnum++ } else if(containi(left,"models/v_")==0) { format(new_v_models[v_modelsnum],47,right) format(old_v_models[v_modelsnum],47,left) v_models_team[v_modelsnum]=team v_modelsnum++ } else if(containi(left,"models/w_")==0) { format(new_w_models[w_modelsnum],47,right) format(old_w_models[w_modelsnum],47,left) w_models_team[w_modelsnum]=team w_modelsnum++ } else { log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4) { replace(right,47,"sound/","") replace(left,47,"sound/","") if(!precache_sound(right)) { log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else { format(new_sounds[soundsnum],47,right) format(old_sounds[soundsnum],47,left) sounds_team[soundsnum]=team soundsnum++ } } else { log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else { log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook(id) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) pev(id,pev_viewmodel2,model,31) for(i=0;i<v_modelsnum;i++) { if(equali(model,old_v_models[i])) { if(v_models_team[i]==team || !v_models_team[i]) { set_pev(id,pev_viewmodel2,new_v_models[i]) break; } } } pev(id,pev_weaponmodel2,model,31) for(i=0;i<p_modelsnum;i++) { if(equali(model,old_p_models[i])) { if(p_models_team[i]==team || !p_models_team[i]) { set_pev(id,pev_weaponmodel2,new_p_models[i]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook(id,channel,sample[]) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return FMRES_IGNORED } if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM) { return FMRES_IGNORED } static i, team team = get_user_team(id) for(i=0;i<soundsnum;i++) { if(equali(sample,old_sounds[i])) { if(sounds_team[i]==team || !sounds_team[i]) { engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook(ent,model[]) { new iOwner = get_entvar(ent, var_owner); if(!pev_valid(ent) && !(ze_get_vip_flags(id) & iOwner)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,ent,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }![]()
![]()
- #define VERSION "1.3"
- #include <zombie_escape>
- #include <ze_vip>
- #define MAX_SOUNDS 50
- #define MAX_p_MODELS 50
- #define MAX_v_MODELS 50
- #define MAX_w_MODELS 50
- #define MAP_CONFIGS 1
- new new_sounds[MAX_SOUNDS][48]
- new old_sounds[MAX_SOUNDS][48]
- new sounds_team[MAX_SOUNDS]
- new soundsnum
- new new_p_models[MAX_p_MODELS][48]
- new old_p_models[MAX_p_MODELS][48]
- new p_models_team[MAX_p_MODELS]
- new p_modelsnum
- new new_v_models[MAX_v_MODELS][48]
- new old_v_models[MAX_v_MODELS][48]
- new v_models_team[MAX_p_MODELS]
- new v_modelsnum
- new new_w_models[MAX_w_MODELS][48]
- new old_w_models[MAX_w_MODELS][48]
- new w_models_team[MAX_p_MODELS]
- new w_modelsnum
- public plugin_init()
- {
- register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
- register_forward(FM_EmitSound,"Sound_Hook")
- register_forward(FM_SetModel,"W_Model_Hook",1)
- register_event("CurWeapon","Changeweapon_Hook","be","1=1")
- }
- public plugin_precache()
- {
- new configfile[200]
- new configsdir[200]
- new map[32]
- get_configsdir(configsdir,199)
- get_mapname(map,31)
- format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
- if(file_exists(configfile))
- {
- load_models(configfile)
- }
- else
- {
- format(configfile,199,"%s/new_weapons.ini",configsdir)
- load_models(configfile)
- }
- }
- public load_models(configfile[])
- {
- if(file_exists(configfile))
- {
- new read[96], left[48], right[48], right2[32], trash, team
- for(new i=0;i<file_size(configfile,1);i++)
- {
- read_file(configfile,i,read,95,trash)
- if(containi(read,";")!=0 && containi(read," ")!=-1)
- {
- argbreak(read,left,47,right,47)
- team=0
- if(containi(right," ")!=-1)
- {
- argbreak(right,right,47,right2,31)
- replace_all(right2,31,"^"","")
- if(
- equali(right2,"T") ||
- equali(right2,"Terrorist") ||
- equali(right2,"Terrorists") ||
- equali(right2,"Blue") ||
- equali(right2,"B") ||
- equali(right2,"Allies") ||
- equali(right2,"1")
- ) team=1
- else if(
- equali(right2,"CT") ||
- equali(right2,"Counter") ||
- equali(right2,"Counter-Terrorist") ||
- equali(right2,"Counter-Terrorists") ||
- equali(right2,"CounterTerrorists") ||
- equali(right2,"CounterTerrorist") ||
- equali(right2,"Red") ||
- equali(right2,"R") ||
- equali(right2,"Axis") ||
- equali(right2,"2")
- ) team=2
- else if(
- equali(right2,"Yellow") ||
- equali(right2,"Y") ||
- equali(right2,"3")
- ) team=3
- else if(
- equali(right2,"Green") ||
- equali(right2,"G") ||
- equali(right2,"4")
- ) team=4
- }
- replace_all(right,47,"^"","")
- if(file_exists(right))
- {
- if(containi(right,".mdl")==strlen(right)-4)
- {
- if(!precache_model(right))
- {
- log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else if(containi(left,"models/p_")==0)
- {
- format(new_p_models[p_modelsnum],47,right)
- format(old_p_models[p_modelsnum],47,left)
- p_models_team[p_modelsnum]=team
- p_modelsnum++
- }
- else if(containi(left,"models/v_")==0)
- {
- format(new_v_models[v_modelsnum],47,right)
- format(old_v_models[v_modelsnum],47,left)
- v_models_team[v_modelsnum]=team
- v_modelsnum++
- }
- else if(containi(left,"models/w_")==0)
- {
- format(new_w_models[w_modelsnum],47,right)
- format(old_w_models[w_modelsnum],47,left)
- w_models_team[w_modelsnum]=team
- w_modelsnum++
- }
- else
- {
- log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
- {
- replace(right,47,"sound/","")
- replace(left,47,"sound/","")
- if(!precache_sound(right))
- {
- log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else
- {
- format(new_sounds[soundsnum],47,right)
- format(old_sounds[soundsnum],47,left)
- sounds_team[soundsnum]=team
- soundsnum++
- }
- }
- else
- {
- log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else
- {
- log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- /*if(!file_exists(left))
- {
- log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
- }*/
- }
- }
- }
- }
- public Changeweapon_Hook(id)
- {
- if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
- {
- return PLUGIN_CONTINUE
- }
- static model[32], i, team
- team = get_user_team(id)
- pev(id,pev_viewmodel2,model,31)
- for(i=0;i<v_modelsnum;i++)
- {
- if(equali(model,old_v_models[i]))
- {
- if(v_models_team[i]==team || !v_models_team[i])
- {
- set_pev(id,pev_viewmodel2,new_v_models[i])
- break;
- }
- }
- }
- pev(id,pev_weaponmodel2,model,31)
- for(i=0;i<p_modelsnum;i++)
- {
- if(equali(model,old_p_models[i]))
- {
- if(p_models_team[i]==team || !p_models_team[i])
- {
- set_pev(id,pev_weaponmodel2,new_p_models[i])
- break;
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public Sound_Hook(id,channel,sample[])
- {
- if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A))
- {
- return FMRES_IGNORED
- }
- if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
- {
- return FMRES_IGNORED
- }
- static i, team
- team = get_user_team(id)
- for(i=0;i<soundsnum;i++)
- {
- if(equali(sample,old_sounds[i]))
- {
- if(sounds_team[i]==team || !sounds_team[i])
- {
- engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
- return FMRES_SUPERCEDE
- }
- }
- }
- return FMRES_IGNORED
- }
- public W_Model_Hook(id,model[])
- {
- new iOwner = get_entvar(id, var_owner);
- if(!pev_valid(id) && !(ze_get_vip_flags(id) & iOwner))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,id,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- /*public newround()
- {
- static ent, classname[8], model[32]
- ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
- while(ent)
- {
- if(pev_valid(ent))
- {
- pev(ent,pev_classname,classname,7)
- if(containi(classname,"armoury")!=-1)
- {
- pev(ent,pev_model,model,31)
- W_Model_Hook(ent,model)
- }
- }
- ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
- }
- }*/
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
all players get weapon skins :/Jack GamePlay wrote: ↑4 Years AgoUpdated code:
#define VERSION "1.3" #include <zombie_escape> #include <ze_vip> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds[MAX_SOUNDS][48] new old_sounds[MAX_SOUNDS][48] new sounds_team[MAX_SOUNDS] new soundsnum new new_p_models[MAX_p_MODELS][48] new old_p_models[MAX_p_MODELS][48] new p_models_team[MAX_p_MODELS] new p_modelsnum new new_v_models[MAX_v_MODELS][48] new old_v_models[MAX_v_MODELS][48] new v_models_team[MAX_p_MODELS] new v_modelsnum new new_w_models[MAX_w_MODELS][48] new old_w_models[MAX_w_MODELS][48] new w_models_team[MAX_p_MODELS] new w_modelsnum new maxplayers public plugin_init() { register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic") register_forward(FM_EmitSound,"Sound_Hook") register_forward(FM_SetModel,"W_Model_Hook",1) register_event("CurWeapon","Changeweapon_Hook","be","1=1") maxplayers = get_maxplayers() } public plugin_precache() { new configfile[200] new configsdir[200] new map[32] get_configsdir(configsdir,199) get_mapname(map,31) format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map) if(file_exists(configfile)) { load_models(configfile) } else { format(configfile,199,"%s/new_weapons.ini",configsdir) load_models(configfile) } } public load_models(configfile[]) { if(file_exists(configfile)) { new read[96], left[48], right[48], right2[32], trash, team for(new i=0;i<file_size(configfile,1);i++) { read_file(configfile,i,read,95,trash) if(containi(read,";")!=0 && containi(read," ")!=-1) { strbreak(read,left,47,right,47) team=0 if(containi(right," ")!=-1) { strbreak(right,right,47,right2,31) replace_all(right2,31,"^"","") if( equali(right2,"T") || equali(right2,"Terrorist") || equali(right2,"Terrorists") || equali(right2,"Blue") || equali(right2,"B") || equali(right2,"Allies") || equali(right2,"1") ) team=1 else if( equali(right2,"CT") || equali(right2,"Counter") || equali(right2,"Counter-Terrorist") || equali(right2,"Counter-Terrorists") || equali(right2,"CounterTerrorists") || equali(right2,"CounterTerrorist") || equali(right2,"Red") || equali(right2,"R") || equali(right2,"Axis") || equali(right2,"2") ) team=2 else if( equali(right2,"Yellow") || equali(right2,"Y") || equali(right2,"3") ) team=3 else if( equali(right2,"Green") || equali(right2,"G") || equali(right2,"4") ) team=4 } replace_all(right,47,"^"","") if(file_exists(right)) { if(containi(right,".mdl")==strlen(right)-4) { if(!precache_model(right)) { log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else if(containi(left,"models/p_")==0) { format(new_p_models[p_modelsnum],47,right) format(old_p_models[p_modelsnum],47,left) p_models_team[p_modelsnum]=team p_modelsnum++ } else if(containi(left,"models/v_")==0) { format(new_v_models[v_modelsnum],47,right) format(old_v_models[v_modelsnum],47,left) v_models_team[v_modelsnum]=team v_modelsnum++ } else if(containi(left,"models/w_")==0) { format(new_w_models[w_modelsnum],47,right) format(old_w_models[w_modelsnum],47,left) w_models_team[w_modelsnum]=team w_modelsnum++ } else { log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4) { replace(right,47,"sound/","") replace(left,47,"sound/","") if(!precache_sound(right)) { log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else { format(new_sounds[soundsnum],47,right) format(old_sounds[soundsnum],47,left) sounds_team[soundsnum]=team soundsnum++ } } else { log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else { log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook(id) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) pev(id,pev_viewmodel2,model,31) for(i=0;i<v_modelsnum;i++) { if(equali(model,old_v_models[i])) { if(v_models_team[i]==team || !v_models_team[i]) { set_pev(id,pev_viewmodel2,new_v_models[i]) break; } } } pev(id,pev_weaponmodel2,model,31) for(i=0;i<p_modelsnum;i++) { if(equali(model,old_p_models[i])) { if(p_models_team[i]==team || !p_models_team[i]) { set_pev(id,pev_weaponmodel2,new_p_models[i]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook(id,channel,sample[]) { if(!is_user_alive(id) && !(ze_get_vip_flags(id) & VIP_A)) { return FMRES_IGNORED } if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM) { return FMRES_IGNORED } static i, team team = get_user_team(id) for(i=0;i<soundsnum;i++) { if(equali(sample,old_sounds[i])) { if(sounds_team[i]==team || !sounds_team[i]) { engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook(ent,model[]) { new iOwner = get_entvar(ent, var_owner); if(!pev_valid(ent) && !(ze_get_vip_flags(id) & iOwner)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,ent,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 6 Years Ago
- Location: Egypt
- Has thanked: 39 times
- Been thanked: 58 times
- Age: 23
- Contact:
- #define VERSION "1.3"
- #include <zombie_escape>
- #include <ze_vip>
- #define MAX_SOUNDS 50
- #define MAX_p_MODELS 50
- #define MAX_v_MODELS 50
- #define MAX_w_MODELS 50
- #define MAP_CONFIGS 1
- new new_sounds[MAX_SOUNDS][48]
- new old_sounds[MAX_SOUNDS][48]
- new sounds_team[MAX_SOUNDS]
- new soundsnum
- new new_p_models[MAX_p_MODELS][48]
- new old_p_models[MAX_p_MODELS][48]
- new p_models_team[MAX_p_MODELS]
- new p_modelsnum
- new new_v_models[MAX_v_MODELS][48]
- new old_v_models[MAX_v_MODELS][48]
- new v_models_team[MAX_p_MODELS]
- new v_modelsnum
- new new_w_models[MAX_w_MODELS][48]
- new old_w_models[MAX_w_MODELS][48]
- new w_models_team[MAX_p_MODELS]
- new w_modelsnum
- new maxplayers
- public plugin_init()
- {
- register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
- register_forward(FM_EmitSound,"Sound_Hook")
- register_forward(FM_SetModel,"W_Model_Hook",1)
- register_event("CurWeapon","Changeweapon_Hook","be","1=1")
- maxplayers = get_maxplayers()
- }
- public plugin_precache()
- {
- new configfile[200]
- new configsdir[200]
- new map[32]
- get_configsdir(configsdir,199)
- get_mapname(map,31)
- format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
- if(file_exists(configfile))
- {
- load_models(configfile)
- }
- else
- {
- format(configfile,199,"%s/new_weapons.ini",configsdir)
- load_models(configfile)
- }
- }
- public load_models(configfile[])
- {
- if(file_exists(configfile))
- {
- new read[96], left[48], right[48], right2[32], trash, team
- for(new i=0;i<file_size(configfile,1);i++)
- {
- read_file(configfile,i,read,95,trash)
- if(containi(read,";")!=0 && containi(read," ")!=-1)
- {
- argbreak(read,left,47,right,47)
- team=0
- if(containi(right," ")!=-1)
- {
- argbreak(right,right,47,right2,31)
- replace_all(right2,31,"^"","")
- if(
- equali(right2,"T") ||
- equali(right2,"Terrorist") ||
- equali(right2,"Terrorists") ||
- equali(right2,"Blue") ||
- equali(right2,"B") ||
- equali(right2,"Allies") ||
- equali(right2,"1")
- ) team=1
- else if(
- equali(right2,"CT") ||
- equali(right2,"Counter") ||
- equali(right2,"Counter-Terrorist") ||
- equali(right2,"Counter-Terrorists") ||
- equali(right2,"CounterTerrorists") ||
- equali(right2,"CounterTerrorist") ||
- equali(right2,"Red") ||
- equali(right2,"R") ||
- equali(right2,"Axis") ||
- equali(right2,"2")
- ) team=2
- else if(
- equali(right2,"Yellow") ||
- equali(right2,"Y") ||
- equali(right2,"3")
- ) team=3
- else if(
- equali(right2,"Green") ||
- equali(right2,"G") ||
- equali(right2,"4")
- ) team=4
- }
- replace_all(right,47,"^"","")
- if(file_exists(right))
- {
- if(containi(right,".mdl")==strlen(right)-4)
- {
- if(!precache_model(right))
- {
- log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else if(containi(left,"models/p_")==0)
- {
- format(new_p_models[p_modelsnum],47,right)
- format(old_p_models[p_modelsnum],47,left)
- p_models_team[p_modelsnum]=team
- p_modelsnum++
- }
- else if(containi(left,"models/v_")==0)
- {
- format(new_v_models[v_modelsnum],47,right)
- format(old_v_models[v_modelsnum],47,left)
- v_models_team[v_modelsnum]=team
- v_modelsnum++
- }
- else if(containi(left,"models/w_")==0)
- {
- format(new_w_models[w_modelsnum],47,right)
- format(old_w_models[w_modelsnum],47,left)
- w_models_team[w_modelsnum]=team
- w_modelsnum++
- }
- else
- {
- log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
- {
- replace(right,47,"sound/","")
- replace(left,47,"sound/","")
- if(!precache_sound(right))
- {
- log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else
- {
- format(new_sounds[soundsnum],47,right)
- format(old_sounds[soundsnum],47,left)
- sounds_team[soundsnum]=team
- soundsnum++
- }
- }
- else
- {
- log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else
- {
- log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- /*if(!file_exists(left))
- {
- log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
- }*/
- }
- }
- }
- }
- public Changeweapon_Hook(id)
- {
- if(!is_user_alive(id) || !ze_is_user_vip(id))
- {
- return PLUGIN_CONTINUE
- }
- static model[32], i, team
- team = get_user_team(id)
- pev(id,pev_viewmodel2,model,31)
- for(i=0;i<v_modelsnum;i++)
- {
- if(equali(model,old_v_models[i]))
- {
- if(v_models_team[i]==team || !v_models_team[i])
- {
- set_pev(id,pev_viewmodel2,new_v_models[i])
- break;
- }
- }
- }
- pev(id,pev_weaponmodel2,model,31)
- for(i=0;i<p_modelsnum;i++)
- {
- if(equali(model,old_p_models[i]))
- {
- if(p_models_team[i]==team || !p_models_team[i])
- {
- set_pev(id,pev_weaponmodel2,new_p_models[i])
- break;
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public Sound_Hook(id,channel,sample[])
- {
- if(!is_user_alive(id) || !ze_is_user_vip(id))
- {
- return FMRES_IGNORED
- }
- if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
- {
- return FMRES_IGNORED
- }
- static i, team
- team = get_user_team(id)
- for(i=0;i<soundsnum;i++)
- {
- if(equali(sample,old_sounds[i]))
- {
- if(sounds_team[i]==team || !sounds_team[i])
- {
- engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
- return FMRES_SUPERCEDE
- }
- }
- }
- return FMRES_IGNORED
- }
- public W_Model_Hook(ent,model[])
- {
- new iOwner = get_entvar(ent, var_owner);
- if(!pev_valid(ent) || !ze_is_user_vip(id))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,ent,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
Jack GamePlay wrote: ↑4 Years Ago
#define VERSION "1.3" #include <zombie_escape> #include <ze_vip> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds[MAX_SOUNDS][48] new old_sounds[MAX_SOUNDS][48] new sounds_team[MAX_SOUNDS] new soundsnum new new_p_models[MAX_p_MODELS][48] new old_p_models[MAX_p_MODELS][48] new p_models_team[MAX_p_MODELS] new p_modelsnum new new_v_models[MAX_v_MODELS][48] new old_v_models[MAX_v_MODELS][48] new v_models_team[MAX_p_MODELS] new v_modelsnum new new_w_models[MAX_w_MODELS][48] new old_w_models[MAX_w_MODELS][48] new w_models_team[MAX_p_MODELS] new w_modelsnum new maxplayers public plugin_init() { register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic") register_forward(FM_EmitSound,"Sound_Hook") register_forward(FM_SetModel,"W_Model_Hook",1) register_event("CurWeapon","Changeweapon_Hook","be","1=1") maxplayers = get_maxplayers() } public plugin_precache() { new configfile[200] new configsdir[200] new map[32] get_configsdir(configsdir,199) get_mapname(map,31) format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map) if(file_exists(configfile)) { load_models(configfile) } else { format(configfile,199,"%s/new_weapons.ini",configsdir) load_models(configfile) } } public load_models(configfile[]) { if(file_exists(configfile)) { new read[96], left[48], right[48], right2[32], trash, team for(new i=0;i<file_size(configfile,1);i++) { read_file(configfile,i,read,95,trash) if(containi(read,";")!=0 && containi(read," ")!=-1) { argbreak(read,left,47,right,47) team=0 if(containi(right," ")!=-1) { argbreak(right,right,47,right2,31) replace_all(right2,31,"^"","") if( equali(right2,"T") || equali(right2,"Terrorist") || equali(right2,"Terrorists") || equali(right2,"Blue") || equali(right2,"B") || equali(right2,"Allies") || equali(right2,"1") ) team=1 else if( equali(right2,"CT") || equali(right2,"Counter") || equali(right2,"Counter-Terrorist") || equali(right2,"Counter-Terrorists") || equali(right2,"CounterTerrorists") || equali(right2,"CounterTerrorist") || equali(right2,"Red") || equali(right2,"R") || equali(right2,"Axis") || equali(right2,"2") ) team=2 else if( equali(right2,"Yellow") || equali(right2,"Y") || equali(right2,"3") ) team=3 else if( equali(right2,"Green") || equali(right2,"G") || equali(right2,"4") ) team=4 } replace_all(right,47,"^"","") if(file_exists(right)) { if(containi(right,".mdl")==strlen(right)-4) { if(!precache_model(right)) { log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else if(containi(left,"models/p_")==0) { format(new_p_models[p_modelsnum],47,right) format(old_p_models[p_modelsnum],47,left) p_models_team[p_modelsnum]=team p_modelsnum++ } else if(containi(left,"models/v_")==0) { format(new_v_models[v_modelsnum],47,right) format(old_v_models[v_modelsnum],47,left) v_models_team[v_modelsnum]=team v_modelsnum++ } else if(containi(left,"models/w_")==0) { format(new_w_models[w_modelsnum],47,right) format(old_w_models[w_modelsnum],47,left) w_models_team[w_modelsnum]=team w_modelsnum++ } else { log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4) { replace(right,47,"sound/","") replace(left,47,"sound/","") if(!precache_sound(right)) { log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else { format(new_sounds[soundsnum],47,right) format(old_sounds[soundsnum],47,left) sounds_team[soundsnum]=team soundsnum++ } } else { log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else { log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook(id) { if(!is_user_alive(id) || !ze_is_user_vip(id)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) pev(id,pev_viewmodel2,model,31) for(i=0;i<v_modelsnum;i++) { if(equali(model,old_v_models[i])) { if(v_models_team[i]==team || !v_models_team[i]) { set_pev(id,pev_viewmodel2,new_v_models[i]) break; } } } pev(id,pev_weaponmodel2,model,31) for(i=0;i<p_modelsnum;i++) { if(equali(model,old_p_models[i])) { if(p_models_team[i]==team || !p_models_team[i]) { set_pev(id,pev_weaponmodel2,new_p_models[i]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook(id,channel,sample[]) { if(!is_user_alive(id) || !ze_is_user_vip(id)) { return FMRES_IGNORED } if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM) { return FMRES_IGNORED } static i, team team = get_user_team(id) for(i=0;i<soundsnum;i++) { if(equali(sample,old_sounds[i])) { if(sounds_team[i]==team || !sounds_team[i]) { engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook(ent,model[]) { new iOwner = get_entvar(ent, var_owner); if(!pev_valid(ent) || !ze_is_user_vip(id)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,ent,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }

- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
Jack can you fix it
Code: Select all
#include <zombie_escape>
#define VERSION "1.3"
#define MAX_SOUNDS 50
#define MAX_p_MODELS 50
#define MAX_v_MODELS 50
#define MAX_w_MODELS 50
#define MAP_CONFIGS 1
new new_sounds[MAX_SOUNDS][48]
new old_sounds[MAX_SOUNDS][48]
new sounds_team[MAX_SOUNDS]
new soundsnum
new new_p_models[MAX_p_MODELS][48]
new old_p_models[MAX_p_MODELS][48]
new p_models_team[MAX_p_MODELS]
new p_modelsnum
new new_v_models[MAX_v_MODELS][48]
new old_v_models[MAX_v_MODELS][48]
new v_models_team[MAX_p_MODELS]
new v_modelsnum
new new_w_models[MAX_w_MODELS][48]
new old_w_models[MAX_w_MODELS][48]
new w_models_team[MAX_p_MODELS]
new w_modelsnum
public plugin_init()
{
register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
register_forward(FM_EmitSound,"Sound_Hook")
register_forward(FM_SetModel,"W_Model_Hook",1)
register_event("CurWeapon","Changeweapon_Hook","be","1=1")
}
public plugin_precache()
{
new configfile[200]
new configsdir[200]
new map[32]
get_configsdir(configsdir,199)
get_mapname(map,31)
format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
if(file_exists(configfile))
{
load_models(configfile)
}
else
{
format(configfile,199,"%s/new_weapons.ini",configsdir)
load_models(configfile)
}
}
public load_models(configfile[])
{
if(file_exists(configfile))
{
new read[96], left[48], right[48], right2[32], trash, team
for(new i=0;i<file_size(configfile,1);i++)
{
read_file(configfile,i,read,95,trash)
if(containi(read,";")!=0 && containi(read," ")!=-1)
{
argbreak(read,left,47,right,47)
team=0
if(containi(right," ")!=-1)
{
argbreak(right,right,47,right2,31)
replace_all(right2,31,"^"","")
if(
equali(right2,"T") ||
equali(right2,"Terrorist") ||
equali(right2,"Terrorists") ||
equali(right2,"Blue") ||
equali(right2,"B") ||
equali(right2,"Allies") ||
equali(right2,"1")
) team=1
else if(
equali(right2,"CT") ||
equali(right2,"Counter") ||
equali(right2,"Counter-Terrorist") ||
equali(right2,"Counter-Terrorists") ||
equali(right2,"CounterTerrorists") ||
equali(right2,"CounterTerrorist") ||
equali(right2,"Red") ||
equali(right2,"R") ||
equali(right2,"Axis") ||
equali(right2,"2")
) team=2
else if(
equali(right2,"Yellow") ||
equali(right2,"Y") ||
equali(right2,"3")
) team=3
else if(
equali(right2,"Green") ||
equali(right2,"G") ||
equali(right2,"4")
) team=4
}
replace_all(right,47,"^"","")
if(file_exists(right))
{
if(containi(right,".mdl")==strlen(right)-4)
{
if(!precache_model(right))
{
log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
else if(containi(left,"models/p_")==0)
{
format(new_p_models[p_modelsnum],47,right)
format(old_p_models[p_modelsnum],47,left)
p_models_team[p_modelsnum]=team
p_modelsnum++
}
else if(containi(left,"models/v_")==0)
{
format(new_v_models[v_modelsnum],47,right)
format(old_v_models[v_modelsnum],47,left)
v_models_team[v_modelsnum]=team
v_modelsnum++
}
else if(containi(left,"models/w_")==0)
{
format(new_w_models[w_modelsnum],47,right)
format(old_w_models[w_modelsnum],47,left)
w_models_team[w_modelsnum]=team
w_modelsnum++
}
else
{
log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
}
else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
{
replace(right,47,"sound/","")
replace(left,47,"sound/","")
if(!precache_sound(right))
{
log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
else
{
format(new_sounds[soundsnum],47,right)
format(old_sounds[soundsnum],47,left)
sounds_team[soundsnum]=team
soundsnum++
}
}
else
{
log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
}
else
{
log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
}
/*if(!file_exists(left))
{
log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
}*/
}
}
}
}
public Changeweapon_Hook(id)
{
if(!is_user_alive(id) && !(get_user_flags(id) & ADMIN_LEVEL_H))
{
return PLUGIN_CONTINUE
}
static model[32], i, team
team = get_user_team(id)
pev(id,pev_viewmodel2,model,31)
for(i=0;i<v_modelsnum;i++)
{
if(equali(model,old_v_models[i]))
{
if(v_models_team[i]==team || !v_models_team[i])
{
set_pev(id,pev_viewmodel2,new_v_models[i])
break;
}
}
}
pev(id,pev_weaponmodel2,model,31)
for(i=0;i<p_modelsnum;i++)
{
if(equali(model,old_p_models[i]))
{
if(p_models_team[i]==team || !p_models_team[i])
{
set_pev(id,pev_weaponmodel2,new_p_models[i])
break;
}
}
}
return PLUGIN_CONTINUE
}
public Sound_Hook(id,channel,sample[])
{
if(!is_user_alive(id) && !(get_user_flags(id) & ADMIN_LEVEL_H))
{
return FMRES_IGNORED
}
if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
{
return FMRES_IGNORED
}
static i, team
team = get_user_team(id)
for(i=0;i<soundsnum;i++)
{
if(equali(sample,old_sounds[i]))
{
if(sounds_team[i]==team || !sounds_team[i])
{
engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public W_Model_Hook(id,model[])
{
if(!pev_valid(id) && !(get_user_flags(id) & ADMIN_LEVEL_H))
{
return FMRES_IGNORED
}
static i
for(i=0;i<w_modelsnum;i++)
{
if(equali(model,old_w_models[i]))
{
engfunc(EngFunc_SetModel,id,new_w_models[i])
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
/*public newround()
{
static ent, classname[8], model[32]
ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
while(ent)
{
if(pev_valid(ent))
{
pev(ent,pev_classname,classname,7)
if(containi(classname,"armoury")!=-1)
{
pev(ent,pev_model,model,31)
W_Model_Hook(ent,model)
}
}
ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
}
}*/
[ Post made via Android ]

- Night Fury
- Mod Developer
- Posts: 677
- Joined: 6 Years Ago
- Location: Egypt
- Has thanked: 39 times
- Been thanked: 58 times
- Age: 23
- Contact:
- #include <zombie_escape>
- #define VERSION "1.3"
- #define MAX_SOUNDS 50
- #define MAX_p_MODELS 50
- #define MAX_v_MODELS 50
- #define MAX_w_MODELS 50
- #define MAP_CONFIGS 1
- new new_sounds[MAX_SOUNDS][48]
- new old_sounds[MAX_SOUNDS][48]
- new sounds_team[MAX_SOUNDS]
- new soundsnum
- new new_p_models[MAX_p_MODELS][48]
- new old_p_models[MAX_p_MODELS][48]
- new p_models_team[MAX_p_MODELS]
- new p_modelsnum
- new new_v_models[MAX_v_MODELS][48]
- new old_v_models[MAX_v_MODELS][48]
- new v_models_team[MAX_p_MODELS]
- new v_modelsnum
- new new_w_models[MAX_w_MODELS][48]
- new old_w_models[MAX_w_MODELS][48]
- new w_models_team[MAX_p_MODELS]
- new w_modelsnum
- public plugin_init()
- {
- register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
- register_forward(FM_EmitSound,"Sound_Hook")
- register_forward(FM_SetModel,"W_Model_Hook",1)
- register_event("CurWeapon","Changeweapon_Hook","be","1=1")
- }
- public plugin_precache()
- {
- new configfile[200]
- new configsdir[200]
- new map[32]
- get_configsdir(configsdir,199)
- get_mapname(map,31)
- format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
- if(file_exists(configfile))
- {
- load_models(configfile)
- }
- else
- {
- format(configfile,199,"%s/new_weapons.ini",configsdir)
- load_models(configfile)
- }
- }
- public load_models(configfile[])
- {
- if(file_exists(configfile))
- {
- new read[96], left[48], right[48], right2[32], trash, team
- for(new i=0;i<file_size(configfile,1);i++)
- {
- read_file(configfile,i,read,95,trash)
- if(containi(read,";")!=0 && containi(read," ")!=-1)
- {
- argbreak(read,left,47,right,47)
- team=0
- if(containi(right," ")!=-1)
- {
- argbreak(right,right,47,right2,31)
- replace_all(right2,31,"^"","")
- if(
- equali(right2,"T") ||
- equali(right2,"Terrorist") ||
- equali(right2,"Terrorists") ||
- equali(right2,"Blue") ||
- equali(right2,"B") ||
- equali(right2,"Allies") ||
- equali(right2,"1")
- ) team=1
- else if(
- equali(right2,"CT") ||
- equali(right2,"Counter") ||
- equali(right2,"Counter-Terrorist") ||
- equali(right2,"Counter-Terrorists") ||
- equali(right2,"CounterTerrorists") ||
- equali(right2,"CounterTerrorist") ||
- equali(right2,"Red") ||
- equali(right2,"R") ||
- equali(right2,"Axis") ||
- equali(right2,"2")
- ) team=2
- else if(
- equali(right2,"Yellow") ||
- equali(right2,"Y") ||
- equali(right2,"3")
- ) team=3
- else if(
- equali(right2,"Green") ||
- equali(right2,"G") ||
- equali(right2,"4")
- ) team=4
- }
- replace_all(right,47,"^"","")
- if(file_exists(right))
- {
- if(containi(right,".mdl")==strlen(right)-4)
- {
- if(!precache_model(right))
- {
- log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else if(containi(left,"models/p_")==0)
- {
- format(new_p_models[p_modelsnum],47,right)
- format(old_p_models[p_modelsnum],47,left)
- p_models_team[p_modelsnum]=team
- p_modelsnum++
- }
- else if(containi(left,"models/v_")==0)
- {
- format(new_v_models[v_modelsnum],47,right)
- format(old_v_models[v_modelsnum],47,left)
- v_models_team[v_modelsnum]=team
- v_modelsnum++
- }
- else if(containi(left,"models/w_")==0)
- {
- format(new_w_models[w_modelsnum],47,right)
- format(old_w_models[w_modelsnum],47,left)
- w_models_team[w_modelsnum]=team
- w_modelsnum++
- }
- else
- {
- log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
- {
- replace(right,47,"sound/","")
- replace(left,47,"sound/","")
- if(!precache_sound(right))
- {
- log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- else
- {
- format(new_sounds[soundsnum],47,right)
- format(old_sounds[soundsnum],47,left)
- sounds_team[soundsnum]=team
- soundsnum++
- }
- }
- else
- {
- log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- }
- else
- {
- log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
- }
- /*if(!file_exists(left))
- {
- log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
- }*/
- }
- }
- }
- }
- public Changeweapon_Hook(id)
- {
- if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return PLUGIN_CONTINUE
- }
- static model[32], i, team
- team = get_user_team(id)
- pev(id,pev_viewmodel2,model,31)
- for(i=0;i<v_modelsnum;i++)
- {
- if(equali(model,old_v_models[i]))
- {
- if(v_models_team[i]==team || !v_models_team[i])
- {
- set_pev(id,pev_viewmodel2,new_v_models[i])
- break;
- }
- }
- }
- pev(id,pev_weaponmodel2,model,31)
- for(i=0;i<p_modelsnum;i++)
- {
- if(equali(model,old_p_models[i]))
- {
- if(p_models_team[i]==team || !p_models_team[i])
- {
- set_pev(id,pev_weaponmodel2,new_p_models[i])
- break;
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public Sound_Hook(id,channel,sample[])
- {
- if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return FMRES_IGNORED
- }
- if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
- {
- return FMRES_IGNORED
- }
- static i, team
- team = get_user_team(id)
- for(i=0;i<soundsnum;i++)
- {
- if(equali(sample,old_sounds[i]))
- {
- if(sounds_team[i]==team || !sounds_team[i])
- {
- engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
- return FMRES_SUPERCEDE
- }
- }
- }
- return FMRES_IGNORED
- }
- public W_Model_Hook(id,model[])
- {
- if(!pev_valid(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,id,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- /*public newround()
- {
- static ent, classname[8], model[32]
- ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
- while(ent)
- {
- if(pev_valid(ent))
- {
- pev(ent,pev_classname,classname,7)
- if(containi(classname,"armoury")!=-1)
- {
- pev(ent,pev_model,model,31)
- W_Model_Hook(ent,model)
- }
- }
- ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
- }
- }*/
- These users thanked the author Night Fury for the post:
- sPe3doN (4 Years Ago)
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
thx jack <3Jack GamePlay wrote: ↑4 Years Ago
#include <zombie_escape> #define VERSION "1.3" #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds[MAX_SOUNDS][48] new old_sounds[MAX_SOUNDS][48] new sounds_team[MAX_SOUNDS] new soundsnum new new_p_models[MAX_p_MODELS][48] new old_p_models[MAX_p_MODELS][48] new p_models_team[MAX_p_MODELS] new p_modelsnum new new_v_models[MAX_v_MODELS][48] new old_v_models[MAX_v_MODELS][48] new v_models_team[MAX_p_MODELS] new v_modelsnum new new_w_models[MAX_w_MODELS][48] new old_w_models[MAX_w_MODELS][48] new w_models_team[MAX_p_MODELS] new w_modelsnum public plugin_init() { register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic") register_forward(FM_EmitSound,"Sound_Hook") register_forward(FM_SetModel,"W_Model_Hook",1) register_event("CurWeapon","Changeweapon_Hook","be","1=1") } public plugin_precache() { new configfile[200] new configsdir[200] new map[32] get_configsdir(configsdir,199) get_mapname(map,31) format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map) if(file_exists(configfile)) { load_models(configfile) } else { format(configfile,199,"%s/new_weapons.ini",configsdir) load_models(configfile) } } public load_models(configfile[]) { if(file_exists(configfile)) { new read[96], left[48], right[48], right2[32], trash, team for(new i=0;i<file_size(configfile,1);i++) { read_file(configfile,i,read,95,trash) if(containi(read,";")!=0 && containi(read," ")!=-1) { argbreak(read,left,47,right,47) team=0 if(containi(right," ")!=-1) { argbreak(right,right,47,right2,31) replace_all(right2,31,"^"","") if( equali(right2,"T") || equali(right2,"Terrorist") || equali(right2,"Terrorists") || equali(right2,"Blue") || equali(right2,"B") || equali(right2,"Allies") || equali(right2,"1") ) team=1 else if( equali(right2,"CT") || equali(right2,"Counter") || equali(right2,"Counter-Terrorist") || equali(right2,"Counter-Terrorists") || equali(right2,"CounterTerrorists") || equali(right2,"CounterTerrorist") || equali(right2,"Red") || equali(right2,"R") || equali(right2,"Axis") || equali(right2,"2") ) team=2 else if( equali(right2,"Yellow") || equali(right2,"Y") || equali(right2,"3") ) team=3 else if( equali(right2,"Green") || equali(right2,"G") || equali(right2,"4") ) team=4 } replace_all(right,47,"^"","") if(file_exists(right)) { if(containi(right,".mdl")==strlen(right)-4) { if(!precache_model(right)) { log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else if(containi(left,"models/p_")==0) { format(new_p_models[p_modelsnum],47,right) format(old_p_models[p_modelsnum],47,left) p_models_team[p_modelsnum]=team p_modelsnum++ } else if(containi(left,"models/v_")==0) { format(new_v_models[v_modelsnum],47,right) format(old_v_models[v_modelsnum],47,left) v_models_team[v_modelsnum]=team v_modelsnum++ } else if(containi(left,"models/w_")==0) { format(new_w_models[w_modelsnum],47,right) format(old_w_models[w_modelsnum],47,left) w_models_team[w_modelsnum]=team w_modelsnum++ } else { log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4) { replace(right,47,"sound/","") replace(left,47,"sound/","") if(!precache_sound(right)) { log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } else { format(new_sounds[soundsnum],47,right) format(old_sounds[soundsnum],47,left) sounds_team[soundsnum]=team soundsnum++ } } else { log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } } else { log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook(id) { if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) pev(id,pev_viewmodel2,model,31) for(i=0;i<v_modelsnum;i++) { if(equali(model,old_v_models[i])) { if(v_models_team[i]==team || !v_models_team[i]) { set_pev(id,pev_viewmodel2,new_v_models[i]) break; } } } pev(id,pev_weaponmodel2,model,31) for(i=0;i<p_modelsnum;i++) { if(equali(model,old_p_models[i])) { if(p_models_team[i]==team || !p_models_team[i]) { set_pev(id,pev_weaponmodel2,new_p_models[i]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook(id,channel,sample[]) { if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM) { return FMRES_IGNORED } static i, team team = get_user_team(id) for(i=0;i<soundsnum;i++) { if(equali(sample,old_sounds[i])) { if(sounds_team[i]==team || !sounds_team[i]) { engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook(id,model[]) { if(!pev_valid(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,id,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } /*public newround() { static ent, classname[8], model[32] ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0) while(ent) { if(pev_valid(ent)) { pev(ent,pev_classname,classname,7) if(containi(classname,"armoury")!=-1) { pev(ent,pev_model,model,31) W_Model_Hook(ent,model) } } ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0) } }*/
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
Code: Select all
L 09/15/2018 - 01:15:48: Invalid player id 105
L 09/15/2018 - 01:15:48: [AMXX] Displaying debug trace (plugin "vip_weapon.amxx", version "1.3")
L 09/15/2018 - 01:15:48: [AMXX] Run time error 10: native error (native "get_user_flags")
L 09/15/2018 - 01:15:48: [AMXX] [0] vip_weapon.sma::W_Model_Hook (line 246)
[ Post made via Android ]

- Raheem
- Mod Developer
- Posts: 2211
- Joined: 6 Years Ago
- Has thanked: 55 times
- Been thanked: 176 times
- Age: 25
- Contact:
This:
- public W_Model_Hook(id,model[])
- {
- if(!pev_valid(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,id,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- public W_Model_Hook(iEnt,model[])
- {
- static id = get_member(iEnt, m_pPlayer)
- if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return FMRES_IGNORED
- }
- static i
- for(i=0;i<w_modelsnum;i++)
- {
- if(equali(model,old_w_models[i]))
- {
- engfunc(EngFunc_SetModel,id,new_w_models[i])
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- static id = get_member(iEnt, m_pPlayer)
- if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H))
- {
- return FMRES_IGNORED
- }
He who fails to plan is planning to fail
- sPe3doN
- Senior Member
- Posts: 257
- Joined: 6 Years Ago
- Has thanked: 17 times
- Been thanked: 21 times
- Age: 23
- Contact:
Raheem wrote: ↑4 Years AgoThis:Maybe should:
public W_Model_Hook(id,model[]) { if(!pev_valid(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,id,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }But anyway it's useless this check:
public W_Model_Hook(iEnt,model[]) { static id = get_member(iEnt, m_pPlayer) if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,id,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }
static id = get_member(iEnt, m_pPlayer) if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED }

- Mark
- VIP
- Posts: 283
- Joined: 4 Years Ago
- Location: Des Moines/USA
- Donation: 1x donated in total €10.00
- Has thanked: 6 times
- Been thanked: 22 times
- Age: 37
- Contact:
Post the full code after your edits.sPe3doN wrote: ↑4 Years AgoRaheem wrote: ↑4 Years AgoThis:Maybe should:
public W_Model_Hook(id,model[]) { if(!pev_valid(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,id,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }But anyway it's useless this check:
public W_Model_Hook(iEnt,model[]) { static id = get_member(iEnt, m_pPlayer) if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED } static i for(i=0;i<w_modelsnum;i++) { if(equali(model,old_w_models[i])) { engfunc(EngFunc_SetModel,id,new_w_models[i]) return FMRES_SUPERCEDE } } return FMRES_IGNORED }
static id = get_member(iEnt, m_pPlayer) if(!pev_valid(iEnt) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return FMRES_IGNORED }![]()
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 1 guest