I edited Falcos Mapprop add, to spawn entities, but yeah, they are untouchable and nocollided(Im sure its becaus ive set no parameters) and they are only the model not the sent :<
But one of them worked(shown its 3D2D panel) after i spawned a duplicate via qmenu
Would be awesome if someone could make it usable :<
[lua]sql.Query(“CREATE TABLE IF NOT EXISTS cobra_mapentities(‘map’ TEXT NOT NULL, ‘model’ TEXT NOT NULL, ‘entity’ TEXT NOT NULL, ‘x’ INTEGER NOT NULL, ‘y’ INTEGER NOT NULL, ‘z’ INTEGER NOT NULL, ‘pitch’ INTEGER NOT NULL, ‘yaw’ INTEGER NOT NULL, ‘roll’ INTEGER NOT NULL, PRIMARY KEY(‘map’));”)
function AddWorldProp(ply)
local ent = ply:GetEyeTrace().Entity
if not ValidEntity(ent) or not ply:IsSuperAdmin() then return end
local pos = ent:GetPos()
pos = Vector(math.Round(pos.x), math.Round(pos.y), math.Round(pos.z))
ent:SetPos(pos)
local ang = ent:EyeAngles()
ang = Angle(math.Round(ang.p), math.Round(ang.y), math.Round(ang.r))
ent:SetAngles(ang)
local map = string.lower(game.GetMap())
local model = ent:GetModel()
local entity = ent:GetClass()
local data = sql.Query("SELECT * FROM cobra_mapentities;") or {}
sql.Query("INSERT INTO cobra_mapentities VALUES("..sql.SQLStr(map..tostring(table.Count(data) + 1))..", "..sql.SQLStr(model)..", "..sql.SQLStr(entity)..", "..sql.SQLStr(pos.x)..", "..sql.SQLStr(pos.y)..", "..sql.SQLStr(pos.z)..", "..sql.SQLStr(ang.p)..", "..sql.SQLStr(ang.y)..", "..sql.SQLStr(ang.r)..");")
ply:ChatPrint("added "..entity)
end
concommand.Add(“cobra_addmapentities”, AddWorldProp)
function RestoreMapItems(ply)
if ply and not ply:IsSuperAdmin() then return end
timer.Simple(1, function()
local data = sql.Query(“SELECT * FROM cobra_mapentities;”)
if not data then return end
for k,v in pairs(data) do
if string.find(v.map, string.lower(game.GetMap())) == 1 then
local ent = ents.Create(v.entity)
ent:SetPos(Vector(tonumber(v.x), tonumber(v.y), tonumber(v.z)))
ent:SetAngles(Angle(v.pitch, v.yaw, v.roll))
ent:SetModel(v.model)
end
end
end)
end
hook.Add( “InitPostEntity”, “cobra_RestoreMapEntities”, RestoreMapItems)
concommand.Add(“cobra_restoremapentities”, RestoreMapItems)
function ClearMapEnts(ply,cmd,args)
if not ply:IsSuperAdmin() then return end
local data = sql.Query(“SELECT * FROM cobra_mapentities;”) or {}
for k,v in pairs(data) do
if string.find(v.map, string.lower(game.GetMap())) == 1 then
sql.Query(“DELETE FROM cobra_mapentities WHERE map = “…sql.SQLStr(v.map)…”;”)
end
end
end
concommand.Add(“cobra_clearmapentities”, ClearMapEnts)[/LUA]