trace.Line(start:Vector3, end:Vector3, mask?:number):TraceRay trace a line from start to end.
Trace, playerlist, gamerules: world queries and round state.
trace.Line(start:Vector3, end:Vector3, mask?:number):TraceRay trace a line from start to end.
trace.Hull(start:Vector3, end:Vector3, mins:Vector3, maxs:Vector3, mask?:number):TraceBox trace (hull) from start to end; mask defaults to MASK_SOLID.
playerlist.IsFriend(ent:Entity):booleanWhether the entity is marked as a friend.
playerlist.IsPriority(ent:Entity):booleanWhether the entity has a priority tag.
playerlist.InParty(ent:Entity):booleanWhether the entity is in the party.
playerlist.IsF2P(ent:Entity):booleanWhether the entity is free-to-play.
playerlist.GetPriority(target:Entity|number|string):numberPriority tag of an entity, userID, or SteamID; 0 when none.
playerlist.SetPriority(target:Entity|number|string, priority:number):booleanAssign an assignable priority tag; false when unavailable.
playerlist.GetColor(target:Entity|number|string):numberPacked ARGB tag color of an entity, userID, or SteamID; nil when unknown.
gamerules.GetRoundState():numberCurrent round state.
gamerules.GetWinningTeam():numberTeam number of the round winner.
gamerules.IsTruceActive():booleanWhether a truce is active.
gamerules.IsCompetitive():booleanWhether competitive mode is enabled.
gamerules.IsMannVsMachine():booleanWhether a Mann vs. Machine game is being played.
gamerules.IsMatchmaking():booleanWhether in a matchmaking game.
gamerules.IsInSetup():booleanWhether the round is in setup time.
gamerules.IsInOvertime():booleanWhether the round is in overtime.
gamerules.IsMatchEnded():booleanWhether the match has ended.
gamerules.IsInWaitingForPlayers():booleanWhether waiting for players before a round.
gamerules.GetGameType():numberCurrent game type.
gamerules.GetMatchGroupType():numberCurrent match group type.
gamerules.GetWinReason():numberReason the round was won.
gamerules.IsMatchTypeCasual():booleanWhether the match group is casual.
gamerules.IsMatchTypeCompetitive():booleanWhether the match group is competitive.
gamerules.IsManagedMatchEnded():booleanWhether the match has ended; alias of IsMatchEnded.
gamerules.IsMvM():booleanWhether a Mann vs. Machine game is being played; alias of IsMannVsMachine.
gamerules.GetCurrentMatchGroup():numberCurrent match group.
gamerules.GetTimeLeftInMatch():numberCountdown timer value in seconds; the closest live round clock.
gamerules.IsUsingSpells():booleanWhether Halloween spells are enabled.
gamerules.IsUsingGrapplingHook():booleanWhether the local player has a grappling hook target.
objectives.GetControlPoints(team?:number):tableControl points as {index, owner, locked, canCap, position} array; pass team to include canCap.
objectives.GetCartPosition():Vector3Payload cart origin, or nil when no cart exists.
Prints the round state, payload cart position and the wall in front of you once per second.
local last = 0
callbacks.Register("CreateMove", function()
local tick = globals.TickCount()
if tick - last < 66 then return end
last = tick
local running = gamerules.GetRoundState() == E_RoundState.ROUND_RUNNING
print(string.format("round running=%s setup=%s", tostring(running), tostring(gamerules.IsInSetup())))
local cart = objectives.GetCartPosition()
if cart then
print(string.format("cart at %.0f,%.0f,%.0f", cart.x, cart.y, cart.z))
end
local me = client.GetLocalPlayer()
if me:IsValid() then
local eye = me:GetEyePosition()
local fwd = vector.AngleForward(client.GetViewAngles())
local tr = trace.Line(eye, eye + vector.Multiply(fwd, 2000))
print(string.format("wall ahead at %.0f%%", tr.fraction * 100))
end
end)