Available Weapon models

Unpaid Requests, Public Plugins
User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#21

Post by Mark » 5 years ago

Try this!
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32.  
  33. public plugin_init()
  34. {
  35.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  36.     register_forward(FM_EmitSound,"Sound_Hook")
  37.     register_forward(FM_SetModel,"W_Model_Hook",1)
  38.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  39. }
  40.  
  41. public plugin_precache()
  42. {
  43.     new configfile[200]
  44.     new configsdir[200]
  45.     new map[32]
  46.     get_configsdir(configsdir,199)
  47.     get_mapname(map,31)
  48.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  49.     if(file_exists(configfile))
  50.     {
  51.         load_models(configfile)
  52.     }
  53.     else
  54.     {
  55.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  56.         load_models(configfile)
  57.     }
  58. }
  59.  
  60. public load_models(configfile[])
  61. {
  62.     if(file_exists(configfile))
  63.     {
  64.         new read[96], left[48], right[48], right2[32], trash, team
  65.         for(new i=0;i<file_size(configfile,1);i++)
  66.         {
  67.             read_file(configfile,i,read,95,trash)
  68.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  69.             {
  70.                 argbreak(read,left,47,right,47)
  71.                 team=0
  72.                 if(containi(right," ")!=-1)
  73.                 {
  74.                     argbreak(right,right,47,right2,31)
  75.                     replace_all(right2,31,"^"","")
  76.                     if(
  77.                     equali(right2,"T") ||
  78.                     equali(right2,"Terrorist") ||
  79.                     equali(right2,"Terrorists") ||
  80.                     equali(right2,"Blue") ||
  81.                     equali(right2,"B") ||
  82.                     equali(right2,"Allies") ||
  83.                     equali(right2,"1")
  84.                     ) team=1
  85.                     else if(
  86.                     equali(right2,"CT") ||
  87.                     equali(right2,"Counter") ||
  88.                     equali(right2,"Counter-Terrorist") ||
  89.                     equali(right2,"Counter-Terrorists") ||
  90.                     equali(right2,"CounterTerrorists") ||
  91.                     equali(right2,"CounterTerrorist") ||
  92.                     equali(right2,"Red") ||
  93.                     equali(right2,"R") ||
  94.                     equali(right2,"Axis") ||
  95.                     equali(right2,"2")
  96.                     ) team=2
  97.                     else if(
  98.                     equali(right2,"Yellow") ||
  99.                     equali(right2,"Y") ||
  100.                     equali(right2,"3")
  101.                     ) team=3
  102.                     else if(
  103.                     equali(right2,"Green") ||
  104.                     equali(right2,"G") ||
  105.                     equali(right2,"4")
  106.                     ) team=4
  107.                 }
  108.                 replace_all(right,47,"^"","")
  109.                 if(file_exists(right))
  110.                 {
  111.                     if(containi(right,".mdl")==strlen(right)-4)
  112.                     {
  113.                         if(!precache_model(right))
  114.                         {
  115.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  116.                         }
  117.                         else if(containi(left,"models/p_")==0)
  118.                         {
  119.                             format(new_p_models[p_modelsnum],47,right)
  120.                             format(old_p_models[p_modelsnum],47,left)
  121.                             p_models_team[p_modelsnum]=team
  122.                             p_modelsnum++
  123.                         }
  124.                         else if(containi(left,"models/v_")==0)
  125.                         {
  126.                             format(new_v_models[v_modelsnum],47,right)
  127.                             format(old_v_models[v_modelsnum],47,left)
  128.                             v_models_team[v_modelsnum]=team
  129.                             v_modelsnum++
  130.                         }
  131.                         else if(containi(left,"models/w_")==0)
  132.                         {
  133.                             format(new_w_models[w_modelsnum],47,right)
  134.                             format(old_w_models[w_modelsnum],47,left)
  135.                             w_models_team[w_modelsnum]=team
  136.                             w_modelsnum++
  137.                         }
  138.                         else
  139.                         {
  140.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  141.                         }
  142.                     }
  143.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  144.                     {
  145.                         replace(right,47,"sound/","")
  146.                         replace(left,47,"sound/","")
  147.                         if(!precache_sound(right))
  148.                         {
  149.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  150.                         }
  151.                         else
  152.                         {
  153.                             format(new_sounds[soundsnum],47,right)
  154.                             format(old_sounds[soundsnum],47,left)
  155.                             sounds_team[soundsnum]=team
  156.                             soundsnum++
  157.                         }
  158.                     }
  159.                     else
  160.                     {
  161.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  162.                     }
  163.                 }
  164.                 else
  165.                 {
  166.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  167.                 }
  168.                 /*if(!file_exists(left))
  169.                 {
  170.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  171.                 }*/
  172.             }
  173.         }
  174.     }
  175. }
  176.  
  177. public Changeweapon_Hook(id)
  178. {
  179.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  180.     {
  181.         return PLUGIN_CONTINUE
  182.     }
  183.     static model[32], i, team
  184.  
  185.     team = get_user_team(id)
  186.  
  187.     pev(id,pev_viewmodel2,model,31)
  188.     for(i=0;i<v_modelsnum;i++)
  189.     {
  190.         if(equali(model,old_v_models[i]))
  191.         {
  192.             if(v_models_team[i]==team || !v_models_team[i])
  193.             {
  194.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  195.                 break;
  196.             }
  197.         }
  198.     }
  199.  
  200.     pev(id,pev_weaponmodel2,model,31)
  201.     for(i=0;i<p_modelsnum;i++)
  202.     {
  203.         if(equali(model,old_p_models[i]))
  204.         {
  205.             if(p_models_team[i]==team || !p_models_team[i])
  206.             {
  207.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  208.                 break;
  209.             }
  210.         }
  211.     }
  212.     return PLUGIN_CONTINUE
  213. }
  214.  
  215. public Sound_Hook(id,channel,sample[])
  216. {
  217.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  218.     {
  219.         return FMRES_IGNORED
  220.     }
  221.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  222.     {
  223.         return FMRES_IGNORED
  224.     }
  225.  
  226.     static i, team
  227.  
  228.     team = get_user_team(id)
  229.  
  230.     for(i=0;i<soundsnum;i++)
  231.     {
  232.         if(equali(sample,old_sounds[i]))
  233.         {
  234.             if(sounds_team[i]==team || !sounds_team[i])
  235.             {
  236.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  237.                 return FMRES_SUPERCEDE
  238.             }
  239.         }
  240.     }
  241.     return FMRES_IGNORED
  242. }
  243.  
  244. public W_Model_Hook(iEnt,model[])
  245. {
  246.    
  247.     if(!pev_valid(iEnt) || !(get_user_flags(iEnt) & ADMIN_LEVEL_H))
  248.     {
  249.         return FMRES_IGNORED
  250.     }
  251.    
  252.     static i
  253.     for(i=0;i<w_modelsnum;i++)
  254.     {
  255.         if(equali(model,old_w_models[i]))
  256.         {
  257.             engfunc(EngFunc_SetModel,iEnt,new_w_models[i])
  258.             return FMRES_SUPERCEDE
  259.         }
  260.     }
  261.     return FMRES_IGNORED
  262. }
  263.  
  264. /*public newround()
  265. {
  266.     static ent, classname[8], model[32]
  267.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  268.     while(ent)
  269.     {
  270.         if(pev_valid(ent))
  271.         {
  272.             pev(ent,pev_classname,classname,7)
  273.             if(containi(classname,"armoury")!=-1)
  274.             {
  275.                 pev(ent,pev_model,model,31)
  276.                 W_Model_Hook(ent,model)
  277.             }
  278.         }
  279.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  280.     }
  281. }*/

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#22

Post by sPe3doN » 5 years ago

Mark wrote: 5 years ago Try this!
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32.  
  33. public plugin_init()
  34. {
  35.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  36.     register_forward(FM_EmitSound,"Sound_Hook")
  37.     register_forward(FM_SetModel,"W_Model_Hook",1)
  38.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  39. }
  40.  
  41. public plugin_precache()
  42. {
  43.     new configfile[200]
  44.     new configsdir[200]
  45.     new map[32]
  46.     get_configsdir(configsdir,199)
  47.     get_mapname(map,31)
  48.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  49.     if(file_exists(configfile))
  50.     {
  51.         load_models(configfile)
  52.     }
  53.     else
  54.     {
  55.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  56.         load_models(configfile)
  57.     }
  58. }
  59.  
  60. public load_models(configfile[])
  61. {
  62.     if(file_exists(configfile))
  63.     {
  64.         new read[96], left[48], right[48], right2[32], trash, team
  65.         for(new i=0;i<file_size(configfile,1);i++)
  66.         {
  67.             read_file(configfile,i,read,95,trash)
  68.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  69.             {
  70.                 argbreak(read,left,47,right,47)
  71.                 team=0
  72.                 if(containi(right," ")!=-1)
  73.                 {
  74.                     argbreak(right,right,47,right2,31)
  75.                     replace_all(right2,31,"^"","")
  76.                     if(
  77.                     equali(right2,"T") ||
  78.                     equali(right2,"Terrorist") ||
  79.                     equali(right2,"Terrorists") ||
  80.                     equali(right2,"Blue") ||
  81.                     equali(right2,"B") ||
  82.                     equali(right2,"Allies") ||
  83.                     equali(right2,"1")
  84.                     ) team=1
  85.                     else if(
  86.                     equali(right2,"CT") ||
  87.                     equali(right2,"Counter") ||
  88.                     equali(right2,"Counter-Terrorist") ||
  89.                     equali(right2,"Counter-Terrorists") ||
  90.                     equali(right2,"CounterTerrorists") ||
  91.                     equali(right2,"CounterTerrorist") ||
  92.                     equali(right2,"Red") ||
  93.                     equali(right2,"R") ||
  94.                     equali(right2,"Axis") ||
  95.                     equali(right2,"2")
  96.                     ) team=2
  97.                     else if(
  98.                     equali(right2,"Yellow") ||
  99.                     equali(right2,"Y") ||
  100.                     equali(right2,"3")
  101.                     ) team=3
  102.                     else if(
  103.                     equali(right2,"Green") ||
  104.                     equali(right2,"G") ||
  105.                     equali(right2,"4")
  106.                     ) team=4
  107.                 }
  108.                 replace_all(right,47,"^"","")
  109.                 if(file_exists(right))
  110.                 {
  111.                     if(containi(right,".mdl")==strlen(right)-4)
  112.                     {
  113.                         if(!precache_model(right))
  114.                         {
  115.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  116.                         }
  117.                         else if(containi(left,"models/p_")==0)
  118.                         {
  119.                             format(new_p_models[p_modelsnum],47,right)
  120.                             format(old_p_models[p_modelsnum],47,left)
  121.                             p_models_team[p_modelsnum]=team
  122.                             p_modelsnum++
  123.                         }
  124.                         else if(containi(left,"models/v_")==0)
  125.                         {
  126.                             format(new_v_models[v_modelsnum],47,right)
  127.                             format(old_v_models[v_modelsnum],47,left)
  128.                             v_models_team[v_modelsnum]=team
  129.                             v_modelsnum++
  130.                         }
  131.                         else if(containi(left,"models/w_")==0)
  132.                         {
  133.                             format(new_w_models[w_modelsnum],47,right)
  134.                             format(old_w_models[w_modelsnum],47,left)
  135.                             w_models_team[w_modelsnum]=team
  136.                             w_modelsnum++
  137.                         }
  138.                         else
  139.                         {
  140.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  141.                         }
  142.                     }
  143.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  144.                     {
  145.                         replace(right,47,"sound/","")
  146.                         replace(left,47,"sound/","")
  147.                         if(!precache_sound(right))
  148.                         {
  149.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  150.                         }
  151.                         else
  152.                         {
  153.                             format(new_sounds[soundsnum],47,right)
  154.                             format(old_sounds[soundsnum],47,left)
  155.                             sounds_team[soundsnum]=team
  156.                             soundsnum++
  157.                         }
  158.                     }
  159.                     else
  160.                     {
  161.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  162.                     }
  163.                 }
  164.                 else
  165.                 {
  166.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  167.                 }
  168.                 /*if(!file_exists(left))
  169.                 {
  170.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  171.                 }*/
  172.             }
  173.         }
  174.     }
  175. }
  176.  
  177. public Changeweapon_Hook(id)
  178. {
  179.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  180.     {
  181.         return PLUGIN_CONTINUE
  182.     }
  183.     static model[32], i, team
  184.  
  185.     team = get_user_team(id)
  186.  
  187.     pev(id,pev_viewmodel2,model,31)
  188.     for(i=0;i<v_modelsnum;i++)
  189.     {
  190.         if(equali(model,old_v_models[i]))
  191.         {
  192.             if(v_models_team[i]==team || !v_models_team[i])
  193.             {
  194.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  195.                 break;
  196.             }
  197.         }
  198.     }
  199.  
  200.     pev(id,pev_weaponmodel2,model,31)
  201.     for(i=0;i<p_modelsnum;i++)
  202.     {
  203.         if(equali(model,old_p_models[i]))
  204.         {
  205.             if(p_models_team[i]==team || !p_models_team[i])
  206.             {
  207.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  208.                 break;
  209.             }
  210.         }
  211.     }
  212.     return PLUGIN_CONTINUE
  213. }
  214.  
  215. public Sound_Hook(id,channel,sample[])
  216. {
  217.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  218.     {
  219.         return FMRES_IGNORED
  220.     }
  221.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  222.     {
  223.         return FMRES_IGNORED
  224.     }
  225.  
  226.     static i, team
  227.  
  228.     team = get_user_team(id)
  229.  
  230.     for(i=0;i<soundsnum;i++)
  231.     {
  232.         if(equali(sample,old_sounds[i]))
  233.         {
  234.             if(sounds_team[i]==team || !sounds_team[i])
  235.             {
  236.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  237.                 return FMRES_SUPERCEDE
  238.             }
  239.         }
  240.     }
  241.     return FMRES_IGNORED
  242. }
  243.  
  244. public W_Model_Hook(iEnt,model[])
  245. {
  246.    
  247.     if(!pev_valid(iEnt) || !(get_user_flags(iEnt) & ADMIN_LEVEL_H))
  248.     {
  249.         return FMRES_IGNORED
  250.     }
  251.    
  252.     static i
  253.     for(i=0;i<w_modelsnum;i++)
  254.     {
  255.         if(equali(model,old_w_models[i]))
  256.         {
  257.             engfunc(EngFunc_SetModel,iEnt,new_w_models[i])
  258.             return FMRES_SUPERCEDE
  259.         }
  260.     }
  261.     return FMRES_IGNORED
  262. }
  263.  
  264. /*public newround()
  265. {
  266.     static ent, classname[8], model[32]
  267.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  268.     while(ent)
  269.     {
  270.         if(pev_valid(ent))
  271.         {
  272.             pev(ent,pev_classname,classname,7)
  273.             if(containi(classname,"armoury")!=-1)
  274.             {
  275.                 pev(ent,pev_model,model,31)
  276.                 W_Model_Hook(ent,model)
  277.             }
  278.         }
  279.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  280.     }
  281. }*/
same error

Code: Select all

L 09/15/2018 - 18:45:49: Start of error session.
L 09/15/2018 - 18:45:49: Info (map "ze_egypt") (file "addons/amxmodx/logs/error_20180915.log")
L 09/15/2018 - 18:45:49: Invalid player id 263
Image

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#23

Post by Mark » 5 years ago

sPe3doN wrote: 5 years ago
Mark wrote: 5 years ago Try this!
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32.  
  33. public plugin_init()
  34. {
  35.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  36.     register_forward(FM_EmitSound,"Sound_Hook")
  37.     register_forward(FM_SetModel,"W_Model_Hook",1)
  38.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  39. }
  40.  
  41. public plugin_precache()
  42. {
  43.     new configfile[200]
  44.     new configsdir[200]
  45.     new map[32]
  46.     get_configsdir(configsdir,199)
  47.     get_mapname(map,31)
  48.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  49.     if(file_exists(configfile))
  50.     {
  51.         load_models(configfile)
  52.     }
  53.     else
  54.     {
  55.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  56.         load_models(configfile)
  57.     }
  58. }
  59.  
  60. public load_models(configfile[])
  61. {
  62.     if(file_exists(configfile))
  63.     {
  64.         new read[96], left[48], right[48], right2[32], trash, team
  65.         for(new i=0;i<file_size(configfile,1);i++)
  66.         {
  67.             read_file(configfile,i,read,95,trash)
  68.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  69.             {
  70.                 argbreak(read,left,47,right,47)
  71.                 team=0
  72.                 if(containi(right," ")!=-1)
  73.                 {
  74.                     argbreak(right,right,47,right2,31)
  75.                     replace_all(right2,31,"^"","")
  76.                     if(
  77.                     equali(right2,"T") ||
  78.                     equali(right2,"Terrorist") ||
  79.                     equali(right2,"Terrorists") ||
  80.                     equali(right2,"Blue") ||
  81.                     equali(right2,"B") ||
  82.                     equali(right2,"Allies") ||
  83.                     equali(right2,"1")
  84.                     ) team=1
  85.                     else if(
  86.                     equali(right2,"CT") ||
  87.                     equali(right2,"Counter") ||
  88.                     equali(right2,"Counter-Terrorist") ||
  89.                     equali(right2,"Counter-Terrorists") ||
  90.                     equali(right2,"CounterTerrorists") ||
  91.                     equali(right2,"CounterTerrorist") ||
  92.                     equali(right2,"Red") ||
  93.                     equali(right2,"R") ||
  94.                     equali(right2,"Axis") ||
  95.                     equali(right2,"2")
  96.                     ) team=2
  97.                     else if(
  98.                     equali(right2,"Yellow") ||
  99.                     equali(right2,"Y") ||
  100.                     equali(right2,"3")
  101.                     ) team=3
  102.                     else if(
  103.                     equali(right2,"Green") ||
  104.                     equali(right2,"G") ||
  105.                     equali(right2,"4")
  106.                     ) team=4
  107.                 }
  108.                 replace_all(right,47,"^"","")
  109.                 if(file_exists(right))
  110.                 {
  111.                     if(containi(right,".mdl")==strlen(right)-4)
  112.                     {
  113.                         if(!precache_model(right))
  114.                         {
  115.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  116.                         }
  117.                         else if(containi(left,"models/p_")==0)
  118.                         {
  119.                             format(new_p_models[p_modelsnum],47,right)
  120.                             format(old_p_models[p_modelsnum],47,left)
  121.                             p_models_team[p_modelsnum]=team
  122.                             p_modelsnum++
  123.                         }
  124.                         else if(containi(left,"models/v_")==0)
  125.                         {
  126.                             format(new_v_models[v_modelsnum],47,right)
  127.                             format(old_v_models[v_modelsnum],47,left)
  128.                             v_models_team[v_modelsnum]=team
  129.                             v_modelsnum++
  130.                         }
  131.                         else if(containi(left,"models/w_")==0)
  132.                         {
  133.                             format(new_w_models[w_modelsnum],47,right)
  134.                             format(old_w_models[w_modelsnum],47,left)
  135.                             w_models_team[w_modelsnum]=team
  136.                             w_modelsnum++
  137.                         }
  138.                         else
  139.                         {
  140.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  141.                         }
  142.                     }
  143.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  144.                     {
  145.                         replace(right,47,"sound/","")
  146.                         replace(left,47,"sound/","")
  147.                         if(!precache_sound(right))
  148.                         {
  149.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  150.                         }
  151.                         else
  152.                         {
  153.                             format(new_sounds[soundsnum],47,right)
  154.                             format(old_sounds[soundsnum],47,left)
  155.                             sounds_team[soundsnum]=team
  156.                             soundsnum++
  157.                         }
  158.                     }
  159.                     else
  160.                     {
  161.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  162.                     }
  163.                 }
  164.                 else
  165.                 {
  166.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  167.                 }
  168.                 /*if(!file_exists(left))
  169.                 {
  170.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  171.                 }*/
  172.             }
  173.         }
  174.     }
  175. }
  176.  
  177. public Changeweapon_Hook(id)
  178. {
  179.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  180.     {
  181.         return PLUGIN_CONTINUE
  182.     }
  183.     static model[32], i, team
  184.  
  185.     team = get_user_team(id)
  186.  
  187.     pev(id,pev_viewmodel2,model,31)
  188.     for(i=0;i<v_modelsnum;i++)
  189.     {
  190.         if(equali(model,old_v_models[i]))
  191.         {
  192.             if(v_models_team[i]==team || !v_models_team[i])
  193.             {
  194.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  195.                 break;
  196.             }
  197.         }
  198.     }
  199.  
  200.     pev(id,pev_weaponmodel2,model,31)
  201.     for(i=0;i<p_modelsnum;i++)
  202.     {
  203.         if(equali(model,old_p_models[i]))
  204.         {
  205.             if(p_models_team[i]==team || !p_models_team[i])
  206.             {
  207.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  208.                 break;
  209.             }
  210.         }
  211.     }
  212.     return PLUGIN_CONTINUE
  213. }
  214.  
  215. public Sound_Hook(id,channel,sample[])
  216. {
  217.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  218.     {
  219.         return FMRES_IGNORED
  220.     }
  221.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  222.     {
  223.         return FMRES_IGNORED
  224.     }
  225.  
  226.     static i, team
  227.  
  228.     team = get_user_team(id)
  229.  
  230.     for(i=0;i<soundsnum;i++)
  231.     {
  232.         if(equali(sample,old_sounds[i]))
  233.         {
  234.             if(sounds_team[i]==team || !sounds_team[i])
  235.             {
  236.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  237.                 return FMRES_SUPERCEDE
  238.             }
  239.         }
  240.     }
  241.     return FMRES_IGNORED
  242. }
  243.  
  244. public W_Model_Hook(iEnt,model[])
  245. {
  246.    
  247.     if(!pev_valid(iEnt) || !(get_user_flags(iEnt) & ADMIN_LEVEL_H))
  248.     {
  249.         return FMRES_IGNORED
  250.     }
  251.    
  252.     static i
  253.     for(i=0;i<w_modelsnum;i++)
  254.     {
  255.         if(equali(model,old_w_models[i]))
  256.         {
  257.             engfunc(EngFunc_SetModel,iEnt,new_w_models[i])
  258.             return FMRES_SUPERCEDE
  259.         }
  260.     }
  261.     return FMRES_IGNORED
  262. }
  263.  
  264. /*public newround()
  265. {
  266.     static ent, classname[8], model[32]
  267.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  268.     while(ent)
  269.     {
  270.         if(pev_valid(ent))
  271.         {
  272.             pev(ent,pev_classname,classname,7)
  273.             if(containi(classname,"armoury")!=-1)
  274.             {
  275.                 pev(ent,pev_model,model,31)
  276.                 W_Model_Hook(ent,model)
  277.             }
  278.         }
  279.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  280.     }
  281. }*/
same error

Code: Select all

L 09/15/2018 - 18:45:49: Start of error session.
L 09/15/2018 - 18:45:49: Info (map "ze_egypt") (file "addons/amxmodx/logs/error_20180915.log")
L 09/15/2018 - 18:45:49: Invalid player id 263
this?
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32. new maxplayers
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  37.     register_forward(FM_EmitSound,"Sound_Hook")
  38.     register_forward(FM_SetModel,"W_Model_Hook",1)
  39.     register_logevent("newround",2,"1=Round_Start")
  40.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  41.     maxplayers = get_maxplayers()
  42. }
  43.  
  44. public plugin_precache()
  45. {
  46.     new configfile[200]
  47.     new configsdir[200]
  48.     new map[32]
  49.     get_configsdir(configsdir,199)
  50.     get_mapname(map,31)
  51.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  52.     if(file_exists(configfile))
  53.     {
  54.         load_models(configfile)
  55.     }
  56.     else
  57.     {
  58.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  59.         load_models(configfile)
  60.     }
  61. }
  62.  
  63. public load_models(configfile[])
  64. {
  65.     if(file_exists(configfile))
  66.     {
  67.         new read[96], left[48], right[48], right2[32], trash, team
  68.         for(new i=0;i<file_size(configfile,1);i++)
  69.         {
  70.             read_file(configfile,i,read,95,trash)
  71.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  72.             {
  73.                 argbreak(read,left,47,right,47)
  74.                 team=0
  75.                 if(containi(right," ")!=-1)
  76.                 {
  77.                     argbreak(right,right,47,right2,31)
  78.                     replace_all(right2,31,"^"","")
  79.                     if(
  80.                     equali(right2,"T") ||
  81.                     equali(right2,"Terrorist") ||
  82.                     equali(right2,"Terrorists") ||
  83.                     equali(right2,"Blue") ||
  84.                     equali(right2,"B") ||
  85.                     equali(right2,"Allies") ||
  86.                     equali(right2,"1")
  87.                     ) team=1
  88.                     else if(
  89.                     equali(right2,"CT") ||
  90.                     equali(right2,"Counter") ||
  91.                     equali(right2,"Counter-Terrorist") ||
  92.                     equali(right2,"Counter-Terrorists") ||
  93.                     equali(right2,"CounterTerrorists") ||
  94.                     equali(right2,"CounterTerrorist") ||
  95.                     equali(right2,"Red") ||
  96.                     equali(right2,"R") ||
  97.                     equali(right2,"Axis") ||
  98.                     equali(right2,"2")
  99.                     ) team=2
  100.                     else if(
  101.                     equali(right2,"Yellow") ||
  102.                     equali(right2,"Y") ||
  103.                     equali(right2,"3")
  104.                     ) team=3
  105.                     else if(
  106.                     equali(right2,"Green") ||
  107.                     equali(right2,"G") ||
  108.                     equali(right2,"4")
  109.                     ) team=4
  110.                 }
  111.                 replace_all(right,47,"^"","")
  112.                 if(file_exists(right))
  113.                 {
  114.                     if(containi(right,".mdl")==strlen(right)-4)
  115.                     {
  116.                         if(!precache_model(right))
  117.                         {
  118.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  119.                         }
  120.                         else if(containi(left,"models/p_")==0)
  121.                         {
  122.                             format(new_p_models[p_modelsnum],47,right)
  123.                             format(old_p_models[p_modelsnum],47,left)
  124.                             p_models_team[p_modelsnum]=team
  125.                             p_modelsnum++
  126.                         }
  127.                         else if(containi(left,"models/v_")==0)
  128.                         {
  129.                             format(new_v_models[v_modelsnum],47,right)
  130.                             format(old_v_models[v_modelsnum],47,left)
  131.                             v_models_team[v_modelsnum]=team
  132.                             v_modelsnum++
  133.                         }
  134.                         else if(containi(left,"models/w_")==0)
  135.                         {
  136.                             format(new_w_models[w_modelsnum],47,right)
  137.                             format(old_w_models[w_modelsnum],47,left)
  138.                             w_models_team[w_modelsnum]=team
  139.                             w_modelsnum++
  140.                         }
  141.                         else
  142.                         {
  143.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  144.                         }
  145.                     }
  146.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  147.                     {
  148.                         replace(right,47,"sound/","")
  149.                         replace(left,47,"sound/","")
  150.                         if(!precache_sound(right))
  151.                         {
  152.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  153.                         }
  154.                         else
  155.                         {
  156.                             format(new_sounds[soundsnum],47,right)
  157.                             format(old_sounds[soundsnum],47,left)
  158.                             sounds_team[soundsnum]=team
  159.                             soundsnum++
  160.                         }
  161.                     }
  162.                     else
  163.                     {
  164.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  165.                     }
  166.                 }
  167.                 else
  168.                 {
  169.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  170.                 }
  171.                 /*if(!file_exists(left))
  172.                 {
  173.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  174.                 }*/
  175.             }
  176.         }
  177.     }
  178. }
  179.  
  180. public Changeweapon_Hook(id)
  181. {
  182.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  183.     {
  184.         return PLUGIN_CONTINUE
  185.     }
  186.     static model[32], i, team
  187.  
  188.     team = get_user_team(id)
  189.  
  190.     pev(id,pev_viewmodel2,model,31)
  191.     for(i=0;i<v_modelsnum;i++)
  192.     {
  193.         if(equali(model,old_v_models[i]))
  194.         {
  195.             if(v_models_team[i]==team || !v_models_team[i])
  196.             {
  197.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  198.                 break;
  199.             }
  200.         }
  201.     }
  202.  
  203.     pev(id,pev_weaponmodel2,model,31)
  204.     for(i=0;i<p_modelsnum;i++)
  205.     {
  206.         if(equali(model,old_p_models[i]))
  207.         {
  208.             if(p_models_team[i]==team || !p_models_team[i])
  209.             {
  210.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  211.                 break;
  212.             }
  213.         }
  214.     }
  215.     return PLUGIN_CONTINUE
  216. }
  217.  
  218. public Sound_Hook(id,channel,sample[])
  219. {
  220.     if(!is_user_alive(id))
  221.     {
  222.         return FMRES_IGNORED
  223.     }
  224.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  225.     {
  226.         return FMRES_IGNORED
  227.     }
  228.  
  229.     static i, team
  230.  
  231.     team = get_user_team(id)
  232.  
  233.     for(i=0;i<soundsnum;i++)
  234.     {
  235.         if(equali(sample,old_sounds[i]))
  236.         {
  237.             if(sounds_team[i]==team || !sounds_team[i])
  238.             {
  239.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  240.                 return FMRES_SUPERCEDE
  241.             }
  242.         }
  243.     }
  244.     return FMRES_IGNORED
  245. }
  246.  
  247. public W_Model_Hook(ent,model[])
  248. {
  249.     if(!pev_valid(ent))
  250.     {
  251.         return FMRES_IGNORED
  252.     }
  253.     static i
  254.     for(i=0;i<w_modelsnum;i++)
  255.     {
  256.         if(equali(model,old_w_models[i]))
  257.         {
  258.             engfunc(EngFunc_SetModel,ent,new_w_models[i])
  259.             return FMRES_SUPERCEDE
  260.         }
  261.     }
  262.     return FMRES_IGNORED
  263. }
  264.  
  265. public newround()
  266. {
  267.     static ent, classname[8], model[32]
  268.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  269.     while(ent)
  270.     {
  271.         if(pev_valid(ent))
  272.         {
  273.             pev(ent,pev_classname,classname,7)
  274.             if(containi(classname,"armoury")!=-1)
  275.             {
  276.                 pev(ent,pev_model,model,31)
  277.                 W_Model_Hook(ent,model)
  278.             }
  279.         }
  280.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  281.     }
  282. }
IF that don't work try this.
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32. new maxplayers
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  37.     register_forward(FM_EmitSound,"Sound_Hook")
  38.     register_forward(FM_SetModel,"W_Model_Hook",1)
  39.     register_logevent("newround",2,"1=Round_Start")
  40.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  41.     maxplayers = get_maxplayers()
  42. }
  43.  
  44. public plugin_precache()
  45. {
  46.     new configfile[200]
  47.     new configsdir[200]
  48.     new map[32]
  49.     get_configsdir(configsdir,199)
  50.     get_mapname(map,31)
  51.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  52.     if(file_exists(configfile))
  53.     {
  54.         load_models(configfile)
  55.     }
  56.     else
  57.     {
  58.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  59.         load_models(configfile)
  60.     }
  61. }
  62.  
  63. public load_models(configfile[])
  64. {
  65.     if(file_exists(configfile))
  66.     {
  67.         new read[96], left[48], right[48], right2[32], trash, team
  68.         for(new i=0;i<file_size(configfile,1);i++)
  69.         {
  70.             read_file(configfile,i,read,95,trash)
  71.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  72.             {
  73.                 argbreak(read,left,47,right,47)
  74.                 team=0
  75.                 if(containi(right," ")!=-1)
  76.                 {
  77.                     argbreak(right,right,47,right2,31)
  78.                     replace_all(right2,31,"^"","")
  79.                     if(
  80.                     equali(right2,"T") ||
  81.                     equali(right2,"Terrorist") ||
  82.                     equali(right2,"Terrorists") ||
  83.                     equali(right2,"Blue") ||
  84.                     equali(right2,"B") ||
  85.                     equali(right2,"Allies") ||
  86.                     equali(right2,"1")
  87.                     ) team=1
  88.                     else if(
  89.                     equali(right2,"CT") ||
  90.                     equali(right2,"Counter") ||
  91.                     equali(right2,"Counter-Terrorist") ||
  92.                     equali(right2,"Counter-Terrorists") ||
  93.                     equali(right2,"CounterTerrorists") ||
  94.                     equali(right2,"CounterTerrorist") ||
  95.                     equali(right2,"Red") ||
  96.                     equali(right2,"R") ||
  97.                     equali(right2,"Axis") ||
  98.                     equali(right2,"2")
  99.                     ) team=2
  100.                     else if(
  101.                     equali(right2,"Yellow") ||
  102.                     equali(right2,"Y") ||
  103.                     equali(right2,"3")
  104.                     ) team=3
  105.                     else if(
  106.                     equali(right2,"Green") ||
  107.                     equali(right2,"G") ||
  108.                     equali(right2,"4")
  109.                     ) team=4
  110.                 }
  111.                 replace_all(right,47,"^"","")
  112.                 if(file_exists(right))
  113.                 {
  114.                     if(containi(right,".mdl")==strlen(right)-4)
  115.                     {
  116.                         if(!precache_model(right))
  117.                         {
  118.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  119.                         }
  120.                         else if(containi(left,"models/p_")==0)
  121.                         {
  122.                             format(new_p_models[p_modelsnum],47,right)
  123.                             format(old_p_models[p_modelsnum],47,left)
  124.                             p_models_team[p_modelsnum]=team
  125.                             p_modelsnum++
  126.                         }
  127.                         else if(containi(left,"models/v_")==0)
  128.                         {
  129.                             format(new_v_models[v_modelsnum],47,right)
  130.                             format(old_v_models[v_modelsnum],47,left)
  131.                             v_models_team[v_modelsnum]=team
  132.                             v_modelsnum++
  133.                         }
  134.                         else if(containi(left,"models/w_")==0)
  135.                         {
  136.                             format(new_w_models[w_modelsnum],47,right)
  137.                             format(old_w_models[w_modelsnum],47,left)
  138.                             w_models_team[w_modelsnum]=team
  139.                             w_modelsnum++
  140.                         }
  141.                         else
  142.                         {
  143.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  144.                         }
  145.                     }
  146.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  147.                     {
  148.                         replace(right,47,"sound/","")
  149.                         replace(left,47,"sound/","")
  150.                         if(!precache_sound(right))
  151.                         {
  152.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  153.                         }
  154.                         else
  155.                         {
  156.                             format(new_sounds[soundsnum],47,right)
  157.                             format(old_sounds[soundsnum],47,left)
  158.                             sounds_team[soundsnum]=team
  159.                             soundsnum++
  160.                         }
  161.                     }
  162.                     else
  163.                     {
  164.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  165.                     }
  166.                 }
  167.                 else
  168.                 {
  169.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  170.                 }
  171.                 /*if(!file_exists(left))
  172.                 {
  173.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  174.                 }*/
  175.             }
  176.         }
  177.     }
  178. }
  179.  
  180. public Changeweapon_Hook(id)
  181. {
  182.     if(!is_user_alive(id) || !(get_user_flags(id) && ADMIN_LEVEL_H))
  183.     {
  184.         return PLUGIN_CONTINUE
  185.     }
  186.     static model[32], i, team
  187.  
  188.     team = get_user_team(id)
  189.  
  190.     pev(id,pev_viewmodel2,model,31)
  191.     for(i=0;i<v_modelsnum;i++)
  192.     {
  193.         if(equali(model,old_v_models[i]))
  194.         {
  195.             if(v_models_team[i]==team || !v_models_team[i])
  196.             {
  197.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  198.                 break;
  199.             }
  200.         }
  201.     }
  202.  
  203.     pev(id,pev_weaponmodel2,model,31)
  204.     for(i=0;i<p_modelsnum;i++)
  205.     {
  206.         if(equali(model,old_p_models[i]))
  207.         {
  208.             if(p_models_team[i]==team || !p_models_team[i])
  209.             {
  210.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  211.                 break;
  212.             }
  213.         }
  214.     }
  215.     return PLUGIN_CONTINUE
  216. }
  217.  
  218. public Sound_Hook(id,channel,sample[])
  219. {
  220.     if(!is_user_alive(id))
  221.     {
  222.         return FMRES_IGNORED
  223.     }
  224.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  225.     {
  226.         return FMRES_IGNORED
  227.     }
  228.  
  229.     static i, team
  230.  
  231.     team = get_user_team(id)
  232.  
  233.     for(i=0;i<soundsnum;i++)
  234.     {
  235.         if(equali(sample,old_sounds[i]))
  236.         {
  237.             if(sounds_team[i]==team || !sounds_team[i])
  238.             {
  239.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  240.                 return FMRES_SUPERCEDE
  241.             }
  242.         }
  243.     }
  244.     return FMRES_IGNORED
  245. }
  246.  
  247. public W_Model_Hook(ent,model[])
  248. {
  249.     if(!pev_valid(ent))
  250.     {
  251.         return FMRES_IGNORED
  252.     }
  253.     static i
  254.     for(i=0;i<w_modelsnum;i++)
  255.     {
  256.         if(equali(model,old_w_models[i]))
  257.         {
  258.             engfunc(EngFunc_SetModel,ent,new_w_models[i])
  259.             return FMRES_SUPERCEDE
  260.         }
  261.     }
  262.     return FMRES_IGNORED
  263. }
  264.  
  265. public newround()
  266. {
  267.     static ent, classname[8], model[32]
  268.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  269.     while(ent)
  270.     {
  271.         if(pev_valid(ent))
  272.         {
  273.             pev(ent,pev_classname,classname,7)
  274.             if(containi(classname,"armoury")!=-1)
  275.             {
  276.                 pev(ent,pev_model,model,31)
  277.                 W_Model_Hook(ent,model)
  278.             }
  279.         }
  280.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  281.     }
  282. }

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#24

Post by sPe3doN » 5 years ago

Mark wrote: 5 years ago
sPe3doN wrote: 5 years ago
Mark wrote: 5 years ago Try this!
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32.  
  33. public plugin_init()
  34. {
  35.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  36.     register_forward(FM_EmitSound,"Sound_Hook")
  37.     register_forward(FM_SetModel,"W_Model_Hook",1)
  38.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  39. }
  40.  
  41. public plugin_precache()
  42. {
  43.     new configfile[200]
  44.     new configsdir[200]
  45.     new map[32]
  46.     get_configsdir(configsdir,199)
  47.     get_mapname(map,31)
  48.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  49.     if(file_exists(configfile))
  50.     {
  51.         load_models(configfile)
  52.     }
  53.     else
  54.     {
  55.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  56.         load_models(configfile)
  57.     }
  58. }
  59.  
  60. public load_models(configfile[])
  61. {
  62.     if(file_exists(configfile))
  63.     {
  64.         new read[96], left[48], right[48], right2[32], trash, team
  65.         for(new i=0;i<file_size(configfile,1);i++)
  66.         {
  67.             read_file(configfile,i,read,95,trash)
  68.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  69.             {
  70.                 argbreak(read,left,47,right,47)
  71.                 team=0
  72.                 if(containi(right," ")!=-1)
  73.                 {
  74.                     argbreak(right,right,47,right2,31)
  75.                     replace_all(right2,31,"^"","")
  76.                     if(
  77.                     equali(right2,"T") ||
  78.                     equali(right2,"Terrorist") ||
  79.                     equali(right2,"Terrorists") ||
  80.                     equali(right2,"Blue") ||
  81.                     equali(right2,"B") ||
  82.                     equali(right2,"Allies") ||
  83.                     equali(right2,"1")
  84.                     ) team=1
  85.                     else if(
  86.                     equali(right2,"CT") ||
  87.                     equali(right2,"Counter") ||
  88.                     equali(right2,"Counter-Terrorist") ||
  89.                     equali(right2,"Counter-Terrorists") ||
  90.                     equali(right2,"CounterTerrorists") ||
  91.                     equali(right2,"CounterTerrorist") ||
  92.                     equali(right2,"Red") ||
  93.                     equali(right2,"R") ||
  94.                     equali(right2,"Axis") ||
  95.                     equali(right2,"2")
  96.                     ) team=2
  97.                     else if(
  98.                     equali(right2,"Yellow") ||
  99.                     equali(right2,"Y") ||
  100.                     equali(right2,"3")
  101.                     ) team=3
  102.                     else if(
  103.                     equali(right2,"Green") ||
  104.                     equali(right2,"G") ||
  105.                     equali(right2,"4")
  106.                     ) team=4
  107.                 }
  108.                 replace_all(right,47,"^"","")
  109.                 if(file_exists(right))
  110.                 {
  111.                     if(containi(right,".mdl")==strlen(right)-4)
  112.                     {
  113.                         if(!precache_model(right))
  114.                         {
  115.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  116.                         }
  117.                         else if(containi(left,"models/p_")==0)
  118.                         {
  119.                             format(new_p_models[p_modelsnum],47,right)
  120.                             format(old_p_models[p_modelsnum],47,left)
  121.                             p_models_team[p_modelsnum]=team
  122.                             p_modelsnum++
  123.                         }
  124.                         else if(containi(left,"models/v_")==0)
  125.                         {
  126.                             format(new_v_models[v_modelsnum],47,right)
  127.                             format(old_v_models[v_modelsnum],47,left)
  128.                             v_models_team[v_modelsnum]=team
  129.                             v_modelsnum++
  130.                         }
  131.                         else if(containi(left,"models/w_")==0)
  132.                         {
  133.                             format(new_w_models[w_modelsnum],47,right)
  134.                             format(old_w_models[w_modelsnum],47,left)
  135.                             w_models_team[w_modelsnum]=team
  136.                             w_modelsnum++
  137.                         }
  138.                         else
  139.                         {
  140.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  141.                         }
  142.                     }
  143.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  144.                     {
  145.                         replace(right,47,"sound/","")
  146.                         replace(left,47,"sound/","")
  147.                         if(!precache_sound(right))
  148.                         {
  149.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  150.                         }
  151.                         else
  152.                         {
  153.                             format(new_sounds[soundsnum],47,right)
  154.                             format(old_sounds[soundsnum],47,left)
  155.                             sounds_team[soundsnum]=team
  156.                             soundsnum++
  157.                         }
  158.                     }
  159.                     else
  160.                     {
  161.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  162.                     }
  163.                 }
  164.                 else
  165.                 {
  166.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  167.                 }
  168.                 /*if(!file_exists(left))
  169.                 {
  170.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  171.                 }*/
  172.             }
  173.         }
  174.     }
  175. }
  176.  
  177. public Changeweapon_Hook(id)
  178. {
  179.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  180.     {
  181.         return PLUGIN_CONTINUE
  182.     }
  183.     static model[32], i, team
  184.  
  185.     team = get_user_team(id)
  186.  
  187.     pev(id,pev_viewmodel2,model,31)
  188.     for(i=0;i<v_modelsnum;i++)
  189.     {
  190.         if(equali(model,old_v_models[i]))
  191.         {
  192.             if(v_models_team[i]==team || !v_models_team[i])
  193.             {
  194.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  195.                 break;
  196.             }
  197.         }
  198.     }
  199.  
  200.     pev(id,pev_weaponmodel2,model,31)
  201.     for(i=0;i<p_modelsnum;i++)
  202.     {
  203.         if(equali(model,old_p_models[i]))
  204.         {
  205.             if(p_models_team[i]==team || !p_models_team[i])
  206.             {
  207.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  208.                 break;
  209.             }
  210.         }
  211.     }
  212.     return PLUGIN_CONTINUE
  213. }
  214.  
  215. public Sound_Hook(id,channel,sample[])
  216. {
  217.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  218.     {
  219.         return FMRES_IGNORED
  220.     }
  221.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  222.     {
  223.         return FMRES_IGNORED
  224.     }
  225.  
  226.     static i, team
  227.  
  228.     team = get_user_team(id)
  229.  
  230.     for(i=0;i<soundsnum;i++)
  231.     {
  232.         if(equali(sample,old_sounds[i]))
  233.         {
  234.             if(sounds_team[i]==team || !sounds_team[i])
  235.             {
  236.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  237.                 return FMRES_SUPERCEDE
  238.             }
  239.         }
  240.     }
  241.     return FMRES_IGNORED
  242. }
  243.  
  244. public W_Model_Hook(iEnt,model[])
  245. {
  246.    
  247.     if(!pev_valid(iEnt) || !(get_user_flags(iEnt) & ADMIN_LEVEL_H))
  248.     {
  249.         return FMRES_IGNORED
  250.     }
  251.    
  252.     static i
  253.     for(i=0;i<w_modelsnum;i++)
  254.     {
  255.         if(equali(model,old_w_models[i]))
  256.         {
  257.             engfunc(EngFunc_SetModel,iEnt,new_w_models[i])
  258.             return FMRES_SUPERCEDE
  259.         }
  260.     }
  261.     return FMRES_IGNORED
  262. }
  263.  
  264. /*public newround()
  265. {
  266.     static ent, classname[8], model[32]
  267.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  268.     while(ent)
  269.     {
  270.         if(pev_valid(ent))
  271.         {
  272.             pev(ent,pev_classname,classname,7)
  273.             if(containi(classname,"armoury")!=-1)
  274.             {
  275.                 pev(ent,pev_model,model,31)
  276.                 W_Model_Hook(ent,model)
  277.             }
  278.         }
  279.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  280.     }
  281. }*/
same error

Code: Select all

L 09/15/2018 - 18:45:49: Start of error session.
L 09/15/2018 - 18:45:49: Info (map "ze_egypt") (file "addons/amxmodx/logs/error_20180915.log")
L 09/15/2018 - 18:45:49: Invalid player id 263
this?
  1. #include <zombie_escape>
  2.  
  3. #define VERSION "1.3"
  4.  
  5. #define MAX_SOUNDS  50
  6. #define MAX_p_MODELS    50
  7. #define MAX_v_MODELS    50
  8. #define MAX_w_MODELS    50
  9.  
  10. #define MAP_CONFIGS 1
  11.  
  12. new new_sounds[MAX_SOUNDS][48]
  13. new old_sounds[MAX_SOUNDS][48]
  14. new sounds_team[MAX_SOUNDS]
  15. new soundsnum
  16.  
  17. new new_p_models[MAX_p_MODELS][48]
  18. new old_p_models[MAX_p_MODELS][48]
  19. new p_models_team[MAX_p_MODELS]
  20. new p_modelsnum
  21.  
  22. new new_v_models[MAX_v_MODELS][48]
  23. new old_v_models[MAX_v_MODELS][48]
  24. new v_models_team[MAX_p_MODELS]
  25. new v_modelsnum
  26.  
  27. new new_w_models[MAX_w_MODELS][48]
  28. new old_w_models[MAX_w_MODELS][48]
  29. new w_models_team[MAX_p_MODELS]
  30. new w_modelsnum
  31.  
  32. new maxplayers
  33.  
  34. public plugin_init()
  35. {
  36.     register_plugin("Weapon Model + Sound Replacement",VERSION,"GHW_Chronic")
  37.     register_forward(FM_EmitSound,"Sound_Hook")
  38.     register_forward(FM_SetModel,"W_Model_Hook",1)
  39.     register_logevent("newround",2,"1=Round_Start")
  40.     register_event("CurWeapon","Changeweapon_Hook","be","1=1")
  41.     maxplayers = get_maxplayers()
  42. }
  43.  
  44. public plugin_precache()
  45. {
  46.     new configfile[200]
  47.     new configsdir[200]
  48.     new map[32]
  49.     get_configsdir(configsdir,199)
  50.     get_mapname(map,31)
  51.     format(configfile,199,"%s/new_weapons_%s.ini",configsdir,map)
  52.     if(file_exists(configfile))
  53.     {
  54.         load_models(configfile)
  55.     }
  56.     else
  57.     {
  58.         format(configfile,199,"%s/new_weapons.ini",configsdir)
  59.         load_models(configfile)
  60.     }
  61. }
  62.  
  63. public load_models(configfile[])
  64. {
  65.     if(file_exists(configfile))
  66.     {
  67.         new read[96], left[48], right[48], right2[32], trash, team
  68.         for(new i=0;i<file_size(configfile,1);i++)
  69.         {
  70.             read_file(configfile,i,read,95,trash)
  71.             if(containi(read,";")!=0 && containi(read," ")!=-1)
  72.             {
  73.                 argbreak(read,left,47,right,47)
  74.                 team=0
  75.                 if(containi(right," ")!=-1)
  76.                 {
  77.                     argbreak(right,right,47,right2,31)
  78.                     replace_all(right2,31,"^"","")
  79.                     if(
  80.                     equali(right2,"T") ||
  81.                     equali(right2,"Terrorist") ||
  82.                     equali(right2,"Terrorists") ||
  83.                     equali(right2,"Blue") ||
  84.                     equali(right2,"B") ||
  85.                     equali(right2,"Allies") ||
  86.                     equali(right2,"1")
  87.                     ) team=1
  88.                     else if(
  89.                     equali(right2,"CT") ||
  90.                     equali(right2,"Counter") ||
  91.                     equali(right2,"Counter-Terrorist") ||
  92.                     equali(right2,"Counter-Terrorists") ||
  93.                     equali(right2,"CounterTerrorists") ||
  94.                     equali(right2,"CounterTerrorist") ||
  95.                     equali(right2,"Red") ||
  96.                     equali(right2,"R") ||
  97.                     equali(right2,"Axis") ||
  98.                     equali(right2,"2")
  99.                     ) team=2
  100.                     else if(
  101.                     equali(right2,"Yellow") ||
  102.                     equali(right2,"Y") ||
  103.                     equali(right2,"3")
  104.                     ) team=3
  105.                     else if(
  106.                     equali(right2,"Green") ||
  107.                     equali(right2,"G") ||
  108.                     equali(right2,"4")
  109.                     ) team=4
  110.                 }
  111.                 replace_all(right,47,"^"","")
  112.                 if(file_exists(right))
  113.                 {
  114.                     if(containi(right,".mdl")==strlen(right)-4)
  115.                     {
  116.                         if(!precache_model(right))
  117.                         {
  118.                             log_amx("Error attempting to precache model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  119.                         }
  120.                         else if(containi(left,"models/p_")==0)
  121.                         {
  122.                             format(new_p_models[p_modelsnum],47,right)
  123.                             format(old_p_models[p_modelsnum],47,left)
  124.                             p_models_team[p_modelsnum]=team
  125.                             p_modelsnum++
  126.                         }
  127.                         else if(containi(left,"models/v_")==0)
  128.                         {
  129.                             format(new_v_models[v_modelsnum],47,right)
  130.                             format(old_v_models[v_modelsnum],47,left)
  131.                             v_models_team[v_modelsnum]=team
  132.                             v_modelsnum++
  133.                         }
  134.                         else if(containi(left,"models/w_")==0)
  135.                         {
  136.                             format(new_w_models[w_modelsnum],47,right)
  137.                             format(old_w_models[w_modelsnum],47,left)
  138.                             w_models_team[w_modelsnum]=team
  139.                             w_modelsnum++
  140.                         }
  141.                         else
  142.                         {
  143.                             log_amx("Model type(p_ / v_ / w_) unknown for model: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  144.                         }
  145.                     }
  146.                     else if(containi(right,".wav")==strlen(right)-4 || containi(right,".mp3")==strlen(right)-4)
  147.                     {
  148.                         replace(right,47,"sound/","")
  149.                         replace(left,47,"sound/","")
  150.                         if(!precache_sound(right))
  151.                         {
  152.                             log_amx("Error attempting to precache sound: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  153.                         }
  154.                         else
  155.                         {
  156.                             format(new_sounds[soundsnum],47,right)
  157.                             format(old_sounds[soundsnum],47,left)
  158.                             sounds_team[soundsnum]=team
  159.                             soundsnum++
  160.                         }
  161.                     }
  162.                     else
  163.                     {
  164.                         log_amx("Invalid File: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  165.                     }
  166.                 }
  167.                 else
  168.                 {
  169.                     log_amx("File Inexistent: ^"%s^" (Line %d of new_weapons.ini)",right,i+1)
  170.                 }
  171.                 /*if(!file_exists(left))
  172.                 {
  173.                     log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1)
  174.                 }*/
  175.             }
  176.         }
  177.     }
  178. }
  179.  
  180. public Changeweapon_Hook(id)
  181. {
  182.     if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H))
  183.     {
  184.         return PLUGIN_CONTINUE
  185.     }
  186.     static model[32], i, team
  187.  
  188.     team = get_user_team(id)
  189.  
  190.     pev(id,pev_viewmodel2,model,31)
  191.     for(i=0;i<v_modelsnum;i++)
  192.     {
  193.         if(equali(model,old_v_models[i]))
  194.         {
  195.             if(v_models_team[i]==team || !v_models_team[i])
  196.             {
  197.                 set_pev(id,pev_viewmodel2,new_v_models[i])
  198.                 break;
  199.             }
  200.         }
  201.     }
  202.  
  203.     pev(id,pev_weaponmodel2,model,31)
  204.     for(i=0;i<p_modelsnum;i++)
  205.     {
  206.         if(equali(model,old_p_models[i]))
  207.         {
  208.             if(p_models_team[i]==team || !p_models_team[i])
  209.             {
  210.                 set_pev(id,pev_weaponmodel2,new_p_models[i])
  211.                 break;
  212.             }
  213.         }
  214.     }
  215.     return PLUGIN_CONTINUE
  216. }
  217.  
  218. public Sound_Hook(id,channel,sample[])
  219. {
  220.     if(!is_user_alive(id))
  221.     {
  222.         return FMRES_IGNORED
  223.     }
  224.     if(channel!=CHAN_WEAPON && channel!=CHAN_ITEM)
  225.     {
  226.         return FMRES_IGNORED
  227.     }
  228.  
  229.     static i, team
  230.  
  231.     team = get_user_team(id)
  232.  
  233.     for(i=0;i<soundsnum;i++)
  234.     {
  235.         if(equali(sample,old_sounds[i]))
  236.         {
  237.             if(sounds_team[i]==team || !sounds_team[i])
  238.             {
  239.                 engfunc(EngFunc_EmitSound,id,CHAN_WEAPON,new_sounds[i],1.0,ATTN_NORM,0,PITCH_NORM)
  240.                 return FMRES_SUPERCEDE
  241.             }
  242.         }
  243.     }
  244.     return FMRES_IGNORED
  245. }
  246.  
  247. public W_Model_Hook(ent,model[])
  248. {
  249.     if(!pev_valid(ent))
  250.     {
  251.         return FMRES_IGNORED
  252.     }
  253.     static i
  254.     for(i=0;i<w_modelsnum;i++)
  255.     {
  256.         if(equali(model,old_w_models[i]))
  257.         {
  258.             engfunc(EngFunc_SetModel,ent,new_w_models[i])
  259.             return FMRES_SUPERCEDE
  260.         }
  261.     }
  262.     return FMRES_IGNORED
  263. }
  264.  
  265. public newround()
  266. {
  267.     static ent, classname[8], model[32]
  268.     ent = engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0)
  269.     while(ent)
  270.     {
  271.         if(pev_valid(ent))
  272.         {
  273.             pev(ent,pev_classname,classname,7)
  274.             if(containi(classname,"armoury")!=-1)
  275.             {
  276.                 pev(ent,pev_model,model,31)
  277.                 W_Model_Hook(ent,model)
  278.             }
  279.         }
  280.         ent = engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0)
  281.     }
  282. }
Thx man this work :D
Image

Post Reply

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

Register

Sign in

Who is online

Users browsing this forum: No registered users and 5 guests