Advertisement
Silverlan

Untitled

Oct 8th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local nextName
  2. local tbNPCs = {}
  3. hook.Add("PlayerSpawnNPC","npcspawngetname",function(pl,name,wepName) nextName = name end)
  4.  
  5. hook.Add("PlayerSpawnedNPC","npcspawnupdatemodel",function(pl,npc)
  6.     if(!nextName) then return end
  7.     if(tbNPCs[nextName]) then
  8.         local min,max = npc:GetCollisionBounds()
  9.         local hull = npc:GetHullType()
  10.         npc:SetModel(tbNPCs[nextName])
  11.         npc:SetSolid(SOLID_BBOX)
  12.         npc:SetHullType(hull)
  13.         npc:SetHullSizeNormal()
  14.         npc:SetCollisionBounds(min,max)
  15.     end
  16.     nextName = nil
  17. end)
  18.  
  19. local function AddNPC(category,name,class,model,keyvalues,skin)
  20.     list.Set("NPC",name,{Name = name,Class = class,Skin = skin,Model = model,Category = category,KeyValues = keyvalues})
  21.     tbNPCs[name] = model
  22. end
  23. AddNPC("Some Category","Metro 1","npc_metropolice","models/stalker.mdl",{["manhacks"] = 2},1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement