Hey, newbie here.
So basically, I looked up a simple teleport example (see concommand.Add in sh_tp.lua) and then tried to hook it so when a player says “/tp” it is supposed to teleport the player just as the concommand does, however when using /tp it teleports you into a offset position which is from my knowledge completley random, so I am wondering what I would have to do to fix this issue and where I have gone wrong?
I can add that this is being included in an autorun init as a shared .lua.
concommand.Add( "oam_teleport", function( player, command ) if ( !GAMEMODE.IsSandboxDerived ) then return end if ( !player:IsAdmin() ) then return end player:SetPos( player:GetEyeTrace().HitPos + Vector(0,0,40) ); end) hook.Add( "PlayerSay", "OAM.TP", function(player, msg) if msg == "/tp" and player:IsAdmin() then concommand.Run ( player, "oam_teleport" ) end end)
Help would be greatly appreciated!