Advertisement
Silverlan

Untitled

Oct 9th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 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.         npc:DropToFloor()
  16.     end
  17.     nextName = nil
  18. end)
  19.  
  20. local function AddNPC(category,name,class,model,keyvalues,skin,weapons)
  21.     list.Set("NPC",name,{Name = name,Class = class,Skin = skin,Model = model,Category = category,KeyValues = keyvalues,Weapons = weapons})
  22.     tbNPCs[name] = model
  23. end
  24. AddNPC("Some Category","Metro 1","npc_metropolice","models/stalker.mdl",{["manhacks"] = 2},1,{"weapon_pistol","weapon_smg1"})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement