• 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?
Yes, you type 'getpos'.
Doesn't work
You could also try using the wiremod GPS.
[QUOTE=wanksta11;22954478]Doesn't work[/QUOTE] [lua] lua_run_cl print(LocalPlayer():GetEyeTrace().HitPos) [/lua]
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.