This is a list of all methods only available for players. It is also possible to call Entity functions on the Player.
Returns the player's AccountID aka SteamID3. ([U:1:AccountID]) See Player:SteamID for the text representation of the full SteamID. See Player:SteamID64 for a 64bit representation of the full SteamID. Unlike other variations of SteamID, SteamID3 does not include the "Account Type" and "Account Instance" part of the SteamID. In a -multirun environment, this will return no value for all "copies" of a player because they are not authenticated with Steam. For bots this will return values starting with 0 for the first bot, 1 for the second bot and so on.
Player:AddCount( string str, Entity ent )
See GetCount for list of types Adds an entity to the total count of entities of same type.
Player:AddFrozenPhysicsObject( Entity ent, PhysObj physobj )
Adds a entity to the player's list of frozen objects.
Player:AddPlayerOption( string name, number timeout, function vote_callback, function draw_callback )
Sets up the voting system for the player. This is a really barebone system. By calling this a vote gets started, when the player presses 0-9 the callback function gets called along with the key the player pressed. Use the draw callback to draw the vote panel.
Player:AddVCDSequenceToGestureSlot( number slot, number sequenceId, number cycle, boolean autokill = false )
Plays a sequence directly from a sequence number, similar to Player:AnimRestartGesture. This function has the advantage to play sequences that haven't been bound to an existing Enums/ACT
Player:AllowFlashlight( boolean canFlashlight )
Sets if the player can toggle their flashlight. Function exists on both the server and client but has no effect when ran on the client.
Player:AnimRestartGesture( number slot, number activity, boolean autokill = false )
Restart a gesture on a player, within a gesture slot. This is not automatically networked. This function has to be called on the client to be seen by said client.
Restarts the main animation on the player, has the same effect as calling Entity:SetCycle( 0 ).
Player:AnimSetGestureSequence( number slot, number sequenceID )
Sets the sequence of the animation playing in the given gesture slot.
Player:AnimSetGestureWeight( number slot, number weight )
Sets the weight of the animation playing in the given gesture slot.
Player:Ban( number minutes, boolean kick = false )
Bans the player from the server for a certain amount of minutes.
Returns true if the player's flashlight hasn't been disabled by Player:AllowFlashlight. This is not synchronized between clients and server automatically!
Player:ChatPrint( string message )
Prints a string to the chatbox of the client. Just like the usermessage, this function is affected by the 255 byte limit!
boolean Player:CheckLimit( string limitType )
Checks if the limit is hit or not. If it is, it will throw a notification saying so.
Player:ConCommand( string command )
Runs the concommand on the player. This does not work on bots. If you wish to directly modify the movement input of bots, use GM:StartCommand instead. Some commands/convars are blocked from being ran/changed using this function, usually to prevent harm/annoyance to clients. For a list of blocked commands, see Blocked ConCommands.On clientside running a ConCommand on an other player will not throw any warnings or errors but will run the ConCommand on LocalPlayer() instead.
Creates the player's death ragdoll entity and deletes the old one. This is normally used when a player dies, to create their death ragdoll. The ragdoll will be created with the player's properties such as Position, Angles, PlayerColor, Velocity and Model. You can retrieve the entity this creates with Player:GetRagdollEntity.
Disables the default player's crosshair. Can be reenabled with Player:CrosshairEnable. This will affect WEAPON:DoDrawCrosshair.
Enables the player's crosshair, if it was previously disabled via Player:CrosshairDisable.
Prints the players' name and position to the console.
Detonates all tripmines belonging to the player.
Player:DisableWorldClicking( boolean disable )
Disables world clicking for given player. See Panel:SetWorldClicker and Player:IsWorldClickingDisabled.
Player:DoAnimationEvent( number data )
Sends a third person animation event to the player. Calls GM:DoAnimationEvent with PLAYERANIMEVENT_CUSTOM_GESTURE as the event, data as the given data.
Starts the player's attack animation. The attack animation is determined by the weapon's HoldType. Similar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_ATTACK_PRIMARY as the event and no extra data.
Player:DoCustomAnimEvent( number event, number data )
Sends a specified third person animation event to the player. Calls GM:DoAnimationEvent with specified arguments.
Sends a third person reload animation event to the player. Similar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_RELOAD as the event and no extra data.
Sends a third person secondary fire animation event to the player. Similar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_ATTACK_SECONDARY as the event and no extra data.
Player:DropNamedWeapon( string class, Vector target = nil, Vector velocity = nil )
Drops the players' weapon of a specific class.
Drops any object the player is currently holding with either gravitygun or +Use (E key)
Player:DropWeapon( Weapon weapon = nil, Vector target = nil, Vector velocity = nil )
Forces the player to drop the specified weapon
Equips the player with the HEV suit. Allows the player to zoom, walk slowly, sprint, pickup armor batteries, use the health and armor stations and also shows the HUD. The player also emits a flatline sound on death, which can be overridden with GM:PlayerDeathSound. The player is automatically equipped with the suit on spawn, if you wish to stop that, use Player:RemoveSuit.
Makes the player exit the vehicle if they're in one.
Player:Flashlight( boolean isOn )
Enables/Disables the player's flashlight.Player:CanUseFlashlight must be true in order for the player's flashlight to be changed.
Returns the amount of frags a player has. The value will change depending on the player's kill or suicide: +1 for a kill, -1 for a suicide.
Player:Freeze( boolean frozen = false )
Freeze the player. Frozen players cannot move, look around, or attack. Key bindings are still called. Similar to Player:Lock but the player can still take damage. Adds or removes the FL_FROZEN flag from the player. Frozen bots will still be able to look around.
Returns the player's active weapon. If used on a LocalPlayer() and the player is spectating another player with OBS_MODE_IN_EYE, the weapon returned will be of the spectated player.
Returns true if the players' model is allowed to rotate around the pitch and roll axis.
Returns whether the player is allowed to use their weapons in a vehicle or not.
number Player:GetCount( string type, number minus = 0 )
Gets total count of entities of same type. Default types: balloons buttons cameras dynamite emitters hoverballs lamps lights props ragdolls thrusters wheels
Returns the crouched walk speed multiplier. See also Player:GetWalkSpeed and Player:SetCrouchedWalkSpeed.
Returns the last command which was sent by the specified player. This can only be called on the player which GetPredictionPlayer() returns. When called clientside in singleplayer during WEAPON:Think, it will return nothing as the hook is not technically predicted in that instance. See the note on the page.This will fail in GM:StartCommand.Issue Tracker: 3302
Gets the actual view offset which equals the difference between the players actual position and their view when standing. Do not confuse with Player:GetViewOffset and Player:GetViewOffsetDucked
Gets the entity the player is currently driving via the drive library.
Returns the entity the player is currently using, like func_tank mounted turrets or +use prop pickups.
Returns a table with information of what the player is looking at. The results of this function are cached clientside every frame. Uses util.GetPlayerTrace internally and is therefore bound by its limits. See also Player:GetEyeTraceNoCursor.
Returns the trace according to the players view direction, ignoring their mouse (holding c and moving the mouse in Sandbox). The results of this function are cached clientside every frame. Uses util.GetPlayerTrace internally and is therefore bound by its limits. See also Player:GetEyeTrace.
Vector, Vector Player:GetHullDuck()
Gets the bottom base and the top base size of the player's crouch hull.
string Player:GetInfo( string cVarName )
Retrieves the value of a client-side ConVar. The ConVar must have a FCVAR_USERINFO flag for this to work. The returned value is truncated to 31 bytes.
number Player:GetInfoNum( string cVarName, number default )
Retrieves the numeric value of a client-side convar, returns nil if value is not convertible to a number. The ConVar must have a FCVAR_USERINFO flag for this to work.
Returns the player's ladder climbing speed. See Player:GetWalkSpeed for normal walking speed, Player:GetRunSpeed for sprinting speed and Player:GetSlowWalkSpeed for slow walking speed.
Returns the maximum amount of armor the player should have. Default value is 100.
Returns the player's maximum movement speed. See also Player:SetMaxSpeed, Player:GetWalkSpeed and Player:GetRunSpeed.
Returns the player's name, this is an alias of Player:Nick. This function overrides Entity:GetName (in the Lua metatable, not in c++), keep it in mind when dealing with ents.FindByName or any engine function which requires the mapping name.
Returns whenever the player is set not to collide with their teammates.
Returns the entity the player is currently observing. Set using Player:SpectateEntity.
string Player:GetPData( string key, any default = nil )
Returns a Player Data key-value pair from the SQL database. (sv.db when called on server, cl.db when called on client) Internally uses the sql. This function internally uses Player:UniqueID, which can cause collisions (two or more players sharing the same PData entry). It's recommended that you don't use it. See the related wiki page for more information.PData is not networked from servers to clients!
Returns a player model's color. The part of the model that is colored is determined by the model itself, and is different for each model. The format is Vector(r,g,b), and each color should be between 0 and 1.
Angle Player:GetPreferredCarryAngles( Entity carryEnt )
Returns the preferred carry angles of an object, if any are set. Calls GM:GetPreferredCarryAngles with the target entity and returns the carry angles.
Returns the widget entity the player is using. Having a pressed widget stops the player from firing their weapon to allow input to be passed onto the widget.
We advise against using this. It may be changed or removed in a future update. You should use Player:GetViewPunchAngles instead. Returns players screen punch effect angle. See Player:ViewPunch and Player:SetViewPunchAngles
Returns players death ragdoll. The ragdoll is created by Player:CreateRagdoll.
Returns the player's sprint speed. See also Player:SetRunSpeed, Player:GetWalkSpeed and Player:GetMaxSpeed.
Returns the position of a Player's view This is the same as calling Entity:EyePos on the player.
Returns the player's slow walking speed, which is activated via +walk keybind. See Player:GetWalkSpeed for normal walking speed, Player:GetRunSpeed for sprinting speed and Player:GetLadderClimbSpeed for ladder climb speed.
Returns the player's HEV suit power. This will only work for the local player when used clientside.Issue Tracker: 3449
Returns the number of seconds that the player has been timing out for. You can check if a player is timing out with Player:IsTimingOut. This function is relatively useless because it is tied to the value of the sv_timeout ConVar, which is irrelevant to the description above. This is not considered as a bug.
table Player:GetTool( string mode = "nil" )
Returns TOOL table of players current tool, or of the one specified.
Returns the entity the player would use if they would press their +use keybind. Because entity physics objects usually do not exist on the client, the client's use entity will resolve to whatever the crosshair is placed on within a little less than 72 units of the player's eye position. This differs from the entity returned by the server, which has fully physical use checking. See util.TraceHull. Issue tracker: 5027
Returns the player's user group. By default, player user groups are loaded from garrysmod/settings/users. txt.
Gets the vehicle the player is driving, returns NULL ENTITY if the player is not driving.
Returns the entity the player is using to see from (such as the player itself, the camera, or another entity). This function will return a [NULL Entity] until Player:SetViewEntity has been used
Entity Player:GetViewModel( number index = 0 )
Returns the player's view model entity by the index. Each player has 3 view models by default, but only the first one is used. To use the other viewmodels in your SWEP, see Entity:SetWeaponModel. In the Client realm, other players' viewmodels are not available unless they are being spectated.
Returns the view offset of the player which equals the difference between the players actual position and their view. See also Player:GetViewOffsetDucked.
Returns the view offset of the player which equals the difference between the players actual position and their view when ducked. See also Player:GetViewOffset.
Returns client's view punch velocity. See Player:ViewPunch and Player:SetViewPunchVelocity
Returns the current voice volume scale for given player on client.
Returns the player's normal walking speed. Not sprinting, not slow walking. (+walk) See also Player:SetWalkSpeed, Player:GetMaxSpeed and Player:GetRunSpeed.
Returns a player's weapon color. The part of the model that is colored is determined by the model itself, and is different for each model. The format is Vector(r,g,b), and each color should be between 0 and 1.
Weapon Player:Give( string weaponClassName, boolean bNoAmmo = false )
Gives the player a weapon. While this function is meant for weapons/pickupables only, it is not restricted to weapons. Any entity can be spawned using this function, including NPCs and SENTs.
Disables god mode on the player.
Enables god mode on the player.
Returns whether the player has god mode or not, contolled by Player:GodEnable and Player:GodDisable. This is not synced between the client and server. This will cause the client to always return false even in godmode.Issue Tracker: 2038
Returns the player's IP address and connection port in ip:port form Returns Error! for bots.
Returns whether the player is an admin or not. It will also return true if the player is Player:IsSuperAdmin by default. Internally this is determined by Player:IsUserGroup.
Returns true from the point when the player is sending client info but not fully in the game until they disconnect.
Used to find out if a player is currently 'driving' an entity (by which we mean 'right click > drive' ).
Returns whether the players movement is currently frozen, controlled by Player:Freeze.
Returns whether the player identity was confirmed by the steam network. See also GM:PlayerAuthed.
Returns whenever the player is heard by the local player clientside, or if the player is speaking serverside.
Returns whether the player is currently sprinting or not, specifically if they are holding their sprint key and are allowed to sprint. This will not check if the player is currently sprinting into a wall. (i.e. holding their sprint key but not moving)
Returns whenever the player is equipped with the suit item. This will only work for the local player when used clientside.Issue Tracker: 3449
Returns whether the player is a super admin. Internally this is determined by Player:IsUserGroup. See also Player:IsAdmin.
Returns true if the player is timing out (i.e. is losing connection), false otherwise. A player is considered timing out when more than 4 seconds has elapsed since a network packet was received from given player.
Returns whether the player is typing in their chat. This may not work properly if the server uses a custom chatbox.
boolean Player:IsUserGroup( string groupname )
Returns true/false if the player is in specified group or not. See Player:GetUserGroup for a way to get player's usergroup.
Returns if the player is in the context menu. Although this is shared, it will only work properly on the CLIENT for the local player. Using this serverside or on other players will return false.
Returns whether the world clicking is disabled for given player or not. See Player:DisableWorldClicking. This value is meant to be networked to the client, but is not currently.
boolean Player:KeyDown( number key )
Gets whether a key is down. This is not networked to other players, meaning only the local client can see the keys they are pressing.
Player:Kick( string reason = "No reason given" )
Kicks the player from the server. This can not be run before the player has fully joined in. Use game.KickID for that.
Kills a player and calls GM:PlayerDeath.
Kills a player without notifying the rest of the server. This will call GM:PlayerSilentDeath instead of GM:PlayerDeath.
Player:LagCompensation( boolean lagCompensation )
This allows the server to mitigate the lag of the player by moving back all the entities that can be lag compensated to the time the player attacked with his weapon. This technique is most commonly used on things that hit other entities instantaneously, such as traces. Entity:FireBullets calls this function internally. Lag compensation only works for players and entities that have been enabled with Entity:SetLagCompensated Despite being defined shared, it can only be used server-side in a Predicted Hook. This function NEEDS to be disabled after you're done with it or it will break the movement of the entities affected!Lag compensation does not support pose parameters. Issue Tracker: 3683
Player:LimitHit( string type )
Shows "limit hit" notification in sandbox. This function is only available in Sandbox and its derivatives.
Returns the direction a player is looking as a entity/local-oriented angle. Unlike Entity:EyeAngles, this function does not include angles of the Player's Entity:GetParent.
Stops a player from using any inputs, such as moving, turning, or attacking. Key binds are still called. Similar to Player:Freeze but the player takes no damage. Adds the FL_FROZEN and FL_GODMODE flags to the player. Frozen bots will still be able to look around.
Returns the 64-bit SteamID aka CommunityID of the Steam Account that owns the Garry's Mod license this player is using. This is useful for detecting players using Steam Family Sharing. If player is not using Steam Family Sharing, this will return the player's actual SteamID64(). This data will only be available after the player has fully authenticated with Steam. See Player:IsFullyAuthenticated.
Returns the packet loss of the client. It is not networked so it only returns 0 when run clientside.
Unfreezes the props player is looking at. This is essentially the same as pressing reload with the physics gun, including double press for unfreeze all.
Player:PickupObject( Entity entity )
This makes the player hold ( same as pressing e on a small prop ) the provided entity. Don't get this confused with picking up items like ammo or health kitsThis picks up the passed entity regardless of its mass or distance from the player
boolean Player:PickupWeapon( Weapon wep, boolean ammoOnly = false )
Forces the player to pickup an existing weapon entity. The player will not pick up the weapon if they already own a weapon of given type, or if the player could not normally have this weapon in their inventory. This function will bypass GM:PlayerCanPickupWeapon.
Player:PlayStepSound( number volume )
Plays the correct step sound according to what the player is staying on.
Player:PrintMessage( number type, string message )
Displays a message either in their chat, console, or center of the screen. See also PrintMessage. When called serverside, this uses the archaic user message system (the umsg) and hence is limited to ≈250 characters. HUD_PRINTCENTER will not work when this is called clientside.
Removes all ammo from a certain player
Removes all weapons and ammo from the player.
Player:RemoveAmmo( number ammoCount, string ammoName )
Removes the amount of the specified ammo from the player.
boolean Player:RemovePData( string key )
Removes a Player Data key-value pair from the SQL database. (sv.db when called on server, cl.db when called on client) Internally uses the sql. This function internally uses Player:UniqueID, which can cause collisions (two or more players sharing the same PData entry). It's recommended that you don't use it. See the related wiki page for more information.
Strips the player's suit item.
Resets both normal and duck hulls to their default values.
Player:Say( string text, boolean teamOnly = false )
Forces the player to say whatever the first argument is. Works on bots too. This function ignores the default chat message cooldown
Player:ScreenFade( number flags, number clr = color_white, number fadeTime, number fadeHold )
Fades the screen
Player:SelectWeapon( string className )
Sets the active weapon of the player by its class name. This will switch the weapon out of prediction, causing delay on the client and WEAPON:Deploy and WEAPON:Holster to be called out of prediction. Try using CUserCmd:SelectWeapon or input.SelectWeapon, instead.This will trigger the weapon switch event and associated animations. To switch weapons silently, use Player:SetActiveWeapon.
Player:SendHint( string name, number delay )
Sends a hint to a player. This function is only available in Sandbox and its derivatives. Since this adds #Hint_ to the beginning of each message, you should only use it with default hint messages, or those cached with language.Add. For hints with custom text, look at notification.AddLegacy.
Player:SendLua( string script )
Executes a simple Lua string on the player. If you need to use this function more than once consider using net library. Send net message and make the entire code you want to execute in net.Receive on client.The string is limited to 254 bytes. Consider using the net library for more advanced server-client interaction.
Player:SetActiveWeapon( Weapon weapon )
Sets the player's active weapon. You should use CUserCmd:SelectWeapon or Player:SelectWeapon, instead in most cases. This function will not trigger the weapon switch events or associated equip animations. It will bypass GM:PlayerSwitchWeapon and the currently active weapon's WEAPON:Holster return value.
Player:SetAllowFullRotation( boolean Allowed )
Set if the players' model is allowed to rotate around the pitch and roll axis.
Player:SetAllowWeaponsInVehicle( boolean allow )
Allows player to use their weapons in a vehicle. You need to call this before entering a vehicle. Shooting in a vehicle fires two bullets. Issue Tracker: 1277
Player:SetAmmo( number ammoCount, any ammoType )
Sets the amount of the specified ammo for the player.
Player:SetAvoidPlayers( boolean avoidPlayers )
Pushes the player away from another player whenever it's inside the other players bounding box.
Player:SetCanWalk( boolean abletowalk )
Set if the player should be allowed to walk using the (default) alt key.
Player:SetCanZoom( boolean canZoom )
Sets whether the player can use the HL2 suit zoom ("+zoom" bind) or not.
Player:SetCrouchedWalkSpeed( number speed )
Sets the crouched walk speed multiplier. Doesn't work for values above 1. See also Player:SetWalkSpeed and Player:GetCrouchedWalkSpeed.
Player:SetCurrentViewOffset( Vector viewOffset )
Sets the actual view offset which equals the difference between the players actual position and their view when standing. Do not confuse with Player:SetViewOffset and Player:SetViewOffsetDucked
Player:SetDrivingEntity( Entity drivingEntity = NULL, number drivingMode )
This is used internally - although you're able to use it you probably shouldn't. Sets the driving entity and driving mode. Use drive.PlayerStartDriving instead, see Entity Driving.
Player:SetDSP( number soundFilter, boolean fastReset )
Applies the specified sound filter to the player.
Player:SetDuckSpeed( number duckSpeed )
Sets how quickly a player ducks. This will not work for values >= 1.Issue Tracker: 2722
Player:SetEyeAngles( Angle angle )
Sets the local angle of the player's view (may rotate body too if angular difference is large)
Player:SetFOV( number fov, number time = 0, Entity requester = self )
Set a player's FOV (Field Of View) over a certain amount of time.
Player:SetHands( Entity hands )
Sets the hands entity of a player. The hands entity is an entity introduced in Garry's Mod 13 and it's used to show the player's hands attached to the viewmodel. This is similar to the approach used in L4D and CS:GO, for more information on how to implement this system in your gamemode visit Using Viewmodel Hands.
Player:SetHoveredWidget( Entity widget = NULL )
Sets the widget that is currently hovered by the player's mouse.
Player:SetHull( Vector hullMins, Vector hullMaxs )
Sets the mins and maxs of the AABB of the players collision. See Player:SetHullDuck for the hull while crouching/ducking.
Player:SetHullDuck( Vector hullMins, Vector hullMaxs )
Sets the mins and maxs of the AABB of the players collision when ducked. See Player:SetHull for setting the hull while standing.
Player:SetJumpPower( number jumpPower )
Sets the jump power, eg. the velocity that will be applied to the player when they jump.
Player:SetLadderClimbSpeed( number speed )
Sets the player's ladder climbing speed. See Player:SetWalkSpeed for normal walking speed, Player:SetRunSpeed for sprinting speed and Player:SetSlowWalkSpeed for slow walking speed.
Player:SetLaggedMovementValue( number timescale )
Slows down the player movement simulation by the timescale, this is used internally in the HL2 weapon stripping sequence. It achieves such behavior by multiplying the FrameTime by the specified timescale at the start of the movement simulation and then restoring it afterwards. This is reset to 1 on spawn. There is no weapon counterpart to this, you'll have to hardcode the multiplier in the weapon or call Weapon:SetNextPrimaryFire / Weapon:SetNextSecondaryFire manually from a.
Player:SetMaxArmor( number maxarmor )
Sets the maximum amount of armor the player should have. This affects default built-in armor pickups, but not Player:SetArmor.
Player:SetMaxSpeed( number walkSpeed )
Sets the maximum speed which the player can move at. This is called automatically by the engine. If you wish to limit player speed without setting their run/sprint speeds, see CMoveData:SetMaxClientSpeed.
Player:SetNoCollideWithTeammates( boolean shouldNotCollide )
Sets whenever the player should not collide with their teammates. This will only work for teams with ID 1 to 4 due to internal Engine limitations. This causes traces with COLLISION_GROUP_PLAYER to pass through players.
Player:SetNoTarget( boolean visibility )
Sets the players visibility towards NPCs. Internally this toggles the FL_NOTARGET flag, which you can manually test for using Entity:IsFlagSet
Player:SetObserverMode( number mode )
Sets the players observer mode. You must start the spectating first with Player:Spectate.
boolean Player:SetPData( string key, any value )
Writes a Player Data key-value pair to the SQL database. (sv.db when called on server, cl.db when called on client) Internally uses the sql. This function internally uses Player:UniqueID, which can cause collisions (two or more players sharing the same PData entry). It's recommended that you don't use it. See the related wiki page for more information.PData is not networked from servers to clients!
Player:SetPlayerColor( Vector Color )
Sets the player model's color. The part of the model that is colored is determined by the model itself, and is different for each model.
Player:SetPressedWidget( Entity pressedWidget = NULL )
Sets the widget that is currently in use by the player's mouse. Having a pressed widget stops the player from firing their weapon to allow input to be passed onto the widget.
Player:SetRunSpeed( number runSpeed )
Sets the player's sprint speed. See also Player:GetRunSpeed, Player:SetWalkSpeed and Player:SetMaxSpeed. player_default class run speed is: 600
Player:SetSlowWalkSpeed( number speed )
Sets the player's slow walking speed, which is activated via +walk keybind. See Player:SetWalkSpeed for normal walking speed, Player:SetRunSpeed for sprinting speed and Player:SetLadderClimbSpeed for ladder climb speed.
Player:SetStepSize( number stepHeight )
Sets the maximum height a player can step onto without jumping.
Player:SetSuitPower( number power )
Sets the player's HEV suit power. This will only work for the local player when used clientside.Issue Tracker: 3449
Player:SetSuppressPickupNotices( boolean doSuppress )
Sets whenever to suppress the pickup notification for the player.
Player:SetupHands( Entity ent )
Sets up the players view model hands. Calls GM:PlayerSetHandsModel to set the model of the hands.
Player:SetUserGroup( string groupName )
Sets the usergroup of the player. Same as Player:SetNWString('UserGroup',string groupName).
Player:SetViewEntity( Entity viewEntity )
Attaches the players view to the position and angles of the specified entity.
Player:SetViewOffset( Vector viewOffset )
Sets the desired view offset which equals the difference between the players actual position and their view when standing. If you want to set actual view offset, use Player:SetCurrentViewOffset See also Player:SetViewOffsetDucked for desired view offset when crouching.
Player:SetViewOffsetDucked( Vector viewOffset )
Sets the desired view offset which equals the difference between the players actual position and their view when crouching. If you want to set actual view offset, use Player:SetCurrentViewOffset See also Player:SetViewOffset for desired view offset when standing.
Player:SetViewPunchAngles( Angle punchAngle )
Sets client's view punch angle, but not the velocity. See Player:ViewPunch
Player:SetViewPunchVelocity( Angle punchVel )
Sets client's view punch velocity. See Player:ViewPunch and Player:SetViewPunchAngles
Player:SetVoiceVolumeScale( number )
Sets the voice volume scale for given player on client. This value will persist from server to server, but will be reset when the game is shut down. This doesn't work on bots, their scale will always be 1.
Player:SetWalkSpeed( number walkSpeed )
Sets the player's normal walking speed. Not sprinting, not slow walking +walk. See also Player:SetSlowWalkSpeed, Player:GetWalkSpeed, Player:SetCrouchedWalkSpeed, Player:SetMaxSpeed and Player:SetRunSpeed. Using a speed of 0 can lead to prediction errors. Issue Tracker: 2030player_default class walk speed is: 400
Player:SetWeaponColor( Vector Color )
Sets the player weapon's color. The part of the model that is colored is determined by the model itself, and is different for each model.
Returns whether the player's player model will be drawn at the time the function is called.
Player:ShouldDropWeapon( boolean drop )
Sets whether the player's current weapon should drop on death. This is reset on spawn to the player class's DropWeaponOnDie field by player_manager.OnPlayerSpawn.
Opens the player steam profile page in the steam overlay browser.
Player:SimulateGravGunPickup( Entity ent )
Signals the entity that it was picked up by the gravity gun. This call is only required if you want to simulate the situation of picking up objects.
Player:Spectate( number mode )
Starts spectate mode for given player. This will also affect the players movetype in some cases. Using this function while spectating the player's own ragdoll will cause it to teleport it to the center of the map. You will spectate the ragdoll even after it's been teleported. This only happens on the client of the player spectating the ragdoll and is purely client-side.Issue Tracker: 4608
Player:SpectateEntity( Entity entity )
Makes the player spectate the entity. To get the applied spectated entity, use Player:GetObserverTarget.
Disables the sprint on the player. Not working - use Player:SetRunSpeed or CMoveData:SetMaxSpeed in a GM:Move hook, instead.Issue Tracker: 2390
Enables the sprint on the player. Not working - use Player:SetRunSpeed or CMoveData:SetMaxSpeed in a GM:Move hook, instead.Issue Tracker: 2390
We advise against using this. It may be changed or removed in a future update. This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect. Doesn't appear to do anything.
We advise against using this. It may be changed or removed in a future update. This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect. When used in a GM:SetupMove hook, this function will force the player to walk, as well as preventing the player from sprinting.
Returns the player's SteamID. See Player:AccountID for a shorter version of the SteamID and Player:SteamID64 for the Community/Profile formatted SteamID. In a -multirun environment, this will return STEAM_0:0:0 (serverside) or NULL (clientside) for all "copies" of a player because they are not authenticated with Steam. For Bots this will return BOT on the server and on the client it returns NULL.
Returns the player's 64-bit SteamID aka CommunityID. See Player:AccountID for a shorter version of the SteamID and Player:SteamID for the normal version of the SteamID. In a -multirun environment, this will return nil for all "copies" of a player because they are not authenticated with Steam. For bots, this will return 90071996842377216 (equivalent to STEAM_0:0:0) for the first bot to join. For each additional bot, the number increases by 1. So the next bot will be 90071996842377217 (STEAM_0:1:0..
We advise against using this. It may be changed or removed in a future update. This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect. When used in a GM:SetupMove hook, this function will prevent the player from sprinting. When +walk is engaged, the player will still be able to sprint to half speed (normal run speed) as opposed to full sprint speed without this function.
We advise against using this. It may be changed or removed in a future update. This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect. When used in a GM:SetupMove hook, this function behaves unexpectedly by preventing the player from sprinting similar to Player:StopSprinting.
Turns off the zoom mode of the player. (+zoom console command) Basically equivalent of entering "-zoom" into player's console.
Removes all ammo from the player.
Player:StripWeapon( string weapon )
Removes the specified weapon class from a certain player this function will call the Entity:OnRemove but if you try use Entity:GetOwner it will return nil
Removes all weapons from a certain player
Player:SuppressHint( string name )
Prevents a hint from showing up. This function is only available in Sandbox and its derivatives
Attempts to switch the player weapon to the one specified in the "cl_defaultweapon" convar, if the player does not own the specified weapon nothing will happen. If you want to switch to a specific weapon, use: Player:SetActiveWeapon
Returns the player's team ID. Returns 0 clientside when the game is not fully loaded.
Returns the time in seconds since the player connected. Bots will always return value 0.
Entity Player:TraceHullAttack( Vector startPos, Vector endPos, Vector mins, Vector maxs, number damage, number damageFlags, number damageForce, boolean damageAllNPCs )
Performs a trace hull and applies damage to the entities hit, returns the first entity hit. Hitting the victim entity with this function in ENTITY:OnTakeDamage can cause infinite loops.
number Player:TranslateWeaponActivity( number act )
Translates Enums/ACT according to the holdtype of players currently held weapon.
Unfreezes all objects the player has frozen with their Physics Gun. Same as double pressing R while holding Physics Gun.
We advise against using this. It may be changed or removed in a future update. Use Player:SteamID64, Player:SteamID or Player:AccountID to uniquely identify players instead.This function has collisions, where more than one player has the same UniqueID. It is highly recommended to use Player:AccountID, Player:SteamID or Player:SteamID64 instead, which are guaranteed to be unique to each player. Returns a 32 bit integer that remains constant for a player across joins/leaves and across different servers. Th..
table Player:UniqueIDTable( any key )
We advise against using this. It may be changed or removed in a future update. This is based on Player:UniqueID which is deprecated and vulnerable to collisions. Returns a table that will stay allocated for the specific player between connects until the server shuts down. This table is not synchronized between client and server.
Unlocks the player movement if locked previously. Will disable godmode for the player if locked previously.
Stops the player from spectating another entity.
Player:ViewPunch( Angle PunchAngle )
Simulates a push on the client's screen. This adds view punch velocity, and does not touch the current view punch angle, for which you can use Player:SetViewPunchAngles.
Player:ViewPunchReset( number tolerance = 0 )
Resets the player's view punch (and the view punch velocity, read more at Player:ViewPunch) effect back to normal.