Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nextName
- local tbNPCs = {}
- hook.Add("PlayerSpawnNPC","npcspawngetname",function(pl,name,wepName) nextName = name end)
- hook.Add("PlayerSpawnedNPC","npcspawnupdatemodel",function(pl,npc)
- if(!nextName) then return end
- if(tbNPCs[nextName]) then
- local min,max = npc:GetCollisionBounds()
- local hull = npc:GetHullType()
- npc:SetModel(tbNPCs[nextName])
- npc:SetSolid(SOLID_BBOX)
- npc:SetHullType(hull)
- npc:SetHullSizeNormal()
- npc:SetCollisionBounds(min,max)
- end
- nextName = nil
- end)
- local function AddNPC(category,name,class,model,keyvalues,skin)
- list.Set("NPC",name,{Name = name,Class = class,Skin = skin,Model = model,Category = category,KeyValues = keyvalues})
- tbNPCs[name] = model
- end
- AddNPC("Some Category","Metro 1","npc_metropolice","models/stalker.mdl",{["manhacks"] = 2},1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement