Deleting a certain door on the map when the server loads
7 replies, posted
I want a certain door on the map to be deleted when the server loads the map. Will it work if I give the position of the entity or something like that?
Yeah, if you have the position, that would work. You'd use this then:
[lua]local pos = Vector( 1, 2, 3 )
hook.Add( "Initialize", "RemoveDoor", function()
local doors = ents.FindByClass( "prop_door" );
for _, door in ipairs( doors ) do
if ( door:GetPos():Distance( pos ) < 32 ) ) then
door:Remove()
break
end
end
end )[/lua]
That would be a func_door if I am not mistaking, but how can I find the position? Do I type something in the console?
An entity's position is a very ineffective way of recording it. You should just use the entity's index with the max players subtracted for saving. And then add back max players for loading.
So :
[lua]lua_run_cl print(LocalPlayer():GetEyeTrace().Entity:EntIndex() - MaxPlayers())[/lua]
Sorry, you need to Log In to post a reply to this thread.