🍏Local Player

Contains all functions from Local player namespace.

-- Returns the index of the local player entity.
-- The index is calculated based on the player's index within the pmove structure,
-- which is incremented by 1 before being returned to match the indexing convention used by Lua.
-- Returns:
--     An integer representing the index of the local player entity.
LocalPlayer.GetIndex()
-- Retrieves the team of the local player.
-- Returns:
--     An integer representing the team of the local player.
LocalPlayer.GetTeam()
-- Get the current flags of the local player, which represents its current state.
-- Returns:
--     An integer value that represents the current flags of the local player. These flags can be used to determine if the player is on the ground, underwater, jumping, etc.
LocalPlayer.GetFlags()
-- Checks whether a player has a specific flag set or not.
-- Parameters:
--     : an integer value representing the flag to be checked.
-- Returns:
--     True if the flag is set, false otherwise.
LocalPlayer.CheckFlag()
-- Returns the button bit flags of the player's current input command.
-- Each bit represents a different button.
-- Returns:
--     An integer value representing the player's button bit flags.
LocalPlayer.GetButtons()
-- Check if a specific button is pressed in the given user command structure.
-- Parameters:
--     cmd: pointer to a usercmd_s structure, representing the user's input command.
--     : the button flag to be checked.
-- Returns:
--     True if the button is pressed in the user command, false otherwise.
LocalPlayer.CheckButton(cmd, )
-- Sets the specified button as pressed in the given user command.
-- Parameters:
--     cmd: pointer to a usercmd_s structure representing the user command.
--     : integer value representing the button to be pressed.
LocalPlayer.PressButton(cmd, )
-- Releases a button in the user command.
-- Parameters:
--     cmd: pointer to a usercmd_s struct representing the user's input.
--     : integer representing the button to release.
LocalPlayer.ReleaseButton(cmd, )
-- Checks whether the local player is alive or not.
-- Returns:
--     True if the local player is alive, false otherwise.
LocalPlayer.IsAlive()
-- Check whether the local player is currently scoped with their weapon.
-- Returns:
--     True if the local player is scoped, false otherwise.
LocalPlayer.IsScoped()
-- Starts fixing player movement to prevent "jittery" movement behavior caused by the game engine.
-- This function calls the ::FixMoveStart function, which is a lower-level function that directly modifies the usercmd_s structure.
-- Usefull for anti aims.
-- Parameters:
--     cmd: pointer to the usercmd_s structure to be fixed.
LocalPlayer.FixMoveStart(cmd)
-- Fixes the movement commands at the end of the usercmd processing.
-- This function is intended to be called after all other functions that modify
-- the usercmd structure, to ensure that the resulting movement commands are valid.
-- Usefull for anti aims.
-- Parameters:
--     cmd: pointer to the usercmd_s structure to be fixed.
LocalPlayer.FixMoveEnd(cmd)
-- Returns the view angles of the local player.
-- Returns:
--     A vector representing the view angles of the local player.
LocalPlayer.GetViewAngles()
-- Sets the view angles of the local player.
-- Parameters:
--     angles: a Vector representing the new view angles to set.
LocalPlayer.SetViewAngles(angles)
-- Returns the position of the local player's eyes in the game world.
-- This is calculated by adding the player's origin to their view offset.
-- Returns:
--     A 3D vector representing the position of the local player's eyes.
LocalPlayer.GetEyePosition()
-- Checks if the player's current weapon is a knife.
-- Returns true if the current weapon is a knife, false otherwise.
LocalPlayer.IsCurWeaponKnife()
-- Checks if the player's current weapon is a pistol.
-- Returns true if the current weapon is a pistol, false otherwise.
LocalPlayer.IsCurWeaponPistol()
-- Checks if the player's current weapon is a grenade.
-- Returns true if the current weapon is a grenade, false otherwise.
LocalPlayer.IsCurWeaponNade()
-- Checks if the player's current weapon is a sniper rifle.
-- Returns true if the current weapon is a sniper rifle, false otherwise.
LocalPlayer.IsCurWeaponSniper()
-- Checks if the player's current weapon is a rifle.
-- Returns true if the current weapon is a rifle, false otherwise.
LocalPlayer.IsCurWeaponRifle()
-- Checks if the player's current weapon is a shotgun.
-- Returns true if the current weapon is a shotgun, false otherwise.
LocalPlayer.IsCurWeaponShotGun()
-- Checks if the player's current weapon is a machine gun.
-- Returns true if the current weapon is a machine gun, false otherwise.
LocalPlayer.IsCurWeaponMachineGun()
-- Checks if the player's current weapon is a machine gun.
-- Returns true if the current weapon is a machine gun, false otherwise.
LocalPlayer.IsCurWeaponSubMachineGun()
-- Returns the name of the weapon that the local player is currently holding.
-- The name is returned as a string.
-- Returns "Unknown" if the local player is not currently holding a weapon or is dead.
LocalPlayer.GetWeaponName()
-- Get the ID of the weapon that the local player is currently holding.
-- Returns:
--     An integer representing the weapon ID. If the local player is not holding a weapon,
--     or if the function fails to retrieve the ID, then it returns 0.
LocalPlayer.GetWeaponID()
-- Executes a client command with a string parameter.
-- Parameters:
--     command: the name of the command to execute,
--     value: the string parameter to pass to the command.
LocalPlayer.ExecuteCommand(command, value)
-- Gets the current value of a console variable as a string.
-- Parameters:
--     command: the name of the console variable
-- Returns:
--     a string containing the current value of the console variable.
LocalPlayer.GetCommandString(command)
-- Gets the current value of a console variable as a string.
-- Parameters:
--     command: the name of the console variable
-- Returns:
--     a float containing the current value of the console variable.
LocalPlayer.GetCommandFloat(command)

Last updated