Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root <- "models/weapons/";
- me <- null;
- function Precache(what)
- {
- ent <- null;
- while((ent = Entities.FindByClassname(ent, "*")) != null)
- {
- try
- {
- ent.PrecacheModel("w_pist_hkp2000.mdl");
- me <- ent;
- break;
- }
- catch(exception)
- {
- continue;
- }
- }
- me.PrecacheModel(root + "v_" + CheckExtension(".mdl", what));
- me.PrecacheModel(root + "w_" + CheckExtension(".mdl", what));
- }
- function Change(what, result)
- {
- if(what == result)
- return;
- Precache(what);
- result = CheckExtension(".mdl", result);
- what = CheckExtension(".mdl", what);
- SetModel("v_", what, result);
- SetModel("w_", what, result);
- }
- function SetModel(prefix, what, result)
- {
- wep <- null;
- while((wep = Entities.FindByModel(wep, root + prefix + what)) != null)
- {
- wep.SetModel(root + prefix + result);
- }
- }
- function CheckExtension(ext, result)
- {
- if(result.find(ext) == null)
- result = result + ext;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement