How would I go about writing lua, to check whether the player is inside a building/structure?
I understand that you would, maybe, trace directly upwards from the player and if it doesn't hit the skybox, then they are inside and return false, if it does hit the skybox then they're outside and return true.
So can someone help me in understanding how I would code this?
[lua]
local _PLAYER = FindMetaTable("Player");
function _PLAYER:IsOutdoor()
local tr = util.TraceLine( util.GetPlayerTrace(self,self:GetUp()) );
return tr.HitSky;
end;
[/lua]
- snip didnt read more than titel
The TTT Headcrab launcher cgecks for that. Look at the code?
Sorry, you need to Log In to post a reply to this thread.