Advertisement
errur

Untitled

Oct 11th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. root <- "models/weapons/";
  2. me <- null;
  3.  
  4.  
  5. function Precache(what)
  6. {
  7. ent <- null;
  8. while((ent = Entities.FindByClassname(ent, "*")) != null)
  9. {
  10. try
  11. {
  12. ent.PrecacheModel("w_pist_hkp2000.mdl");
  13. me <- ent;
  14. break;
  15. }
  16. catch(exception)
  17. {
  18. continue;
  19. }
  20. }
  21. me.PrecacheModel(root + "v_" + CheckExtension(".mdl", what));
  22. me.PrecacheModel(root + "w_" + CheckExtension(".mdl", what));
  23. }
  24.  
  25. function Change(what, result)
  26. {
  27. if(what == result)
  28. return;
  29.  
  30. Precache(what);
  31.  
  32. result = CheckExtension(".mdl", result);
  33. what = CheckExtension(".mdl", what);
  34. SetModel("v_", what, result);
  35. SetModel("w_", what, result);
  36. }
  37.  
  38. function SetModel(prefix, what, result)
  39. {
  40. wep <- null;
  41. while((wep = Entities.FindByModel(wep, root + prefix + what)) != null)
  42. {
  43. wep.SetModel(root + prefix + result);
  44. }
  45. }
  46.  
  47. function CheckExtension(ext, result)
  48. {
  49. if(result.find(ext) == null)
  50. result = result + ext;
  51. return result;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement