Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MapData = {
- Mapname = {
- {model="models/hunter/plates/plate.mdl", pos=Vector(0,0,0), ang=Angle(0,90,0)},
- {model="models/hunter/plates/plate.mdl", pos=Vector(100,0,-100), ang=Angle(22,35,15)},
- },
- Maname = {
- {model="models/hunter/plates/plate.mdl", pos=Vector(0,0,0), ang=Angle(0,90,0)},
- {type="weapon_smg1", pos=Vector(100,0,-100), ang=Angle(22,35,15),}, --We can set a 'type' to spawn an entity instead of a physics prop
- },
- }
- local function AutospawnProps()
- local mapName = game.GetMap() --Get the name of the map
- local mapData = MapData[mapName] --Check we have data for this map
- if mapData then --If we have data for this map
- --Loop through the stuff
- for _,v in pairs(mapData) do
- --get the type of entity, or default to a physics prop
- local entType = v.type or "prop_physics"
- --spawn it
- local newEnt = ents.Create(entType)
- if v.model then newEnt:SetModel(v.model) end --set model
- if v.ang then newEnt:SetAngle(v.ang) end --set angle
- if v.pos then newEnt:SetPos(v.pos) end --set position
- newEnt:Spawn()
- newEnt:Activate()
- end --End of for-loop
- end --End of check for map data
- end
- hook.Add("InitPostEntity", "Autospawn Props On Load", AutospawnProps)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement