-
Notifications
You must be signed in to change notification settings - Fork 0
Extended: CCSPlayer
How to get this userdata:
Entity()
Player()
GetPlayerByIndex()
GetPlayerByUserId()
GetActiveRandomPlayer()
entity:ToCSPlayer()tostring(player)Format player to a proper string "Player [{index}][{nickname}]".
player:AddAssists(assist)Adds the provided amount to the player's assist count.
assist: number
player:AddDeaths(death)Adds the provided amount to the player's death count.
death: number
player:AddFrags(frag)Adds the provided amount to the player's frag/kill count.
frag: number
player:AddUserFlags(userflag)Adds cso2 user flags to the player.
userflag: number
player:Aimbot(target)Make player aim directly to another player.
target: player
player:Alive()Checks if the player is alive.
Return: true or false
player:Armor()Returns the player's armor.
Return: number
player:Assists()Returns the amount of assists a player has.
Return: number
player:Blink(color, duration, frequency)Make player have blink effect, same as original player:SetBlink() but a simplified version.
color: color. Example: Color(255, 0, 255)
duration: number
frequency: number
player:ChatPrint(message, type)Prints a string to the chatbox of the client, with some types.
message: string
type: number
player:ConCommand(command)Runs the concommand on the player. This does not work on bots.
command: string
player:Crouching()Returns whether the player is crouching or not.
Return: true or false
player:Deaths()Returns the player's death count.
Return: number
player:DrawViewModel(draw)Show/Hide the player's weapon's viewmodel.
draw: bool
player:DrawWorldModel(draw)Show/Hide the player's weapon's worldmodel.
draw: bool
player:DropObject()Drops any object the player is currently holding.
player:Frags()Returns the amount of frags a player has.
Return: number
player:Freeze(frozen)Freeze the player. Frozen players cannot move, look around, or attack. Key bindings are still called.
frozen: bool
player:GetAimVector()Returns the direction that the player is aiming.
Return: vector
player:GetClassID()Returns the player's class id.
Return: number
player:GetDuckLoseSpeed()Get if player should have a slower speed when crouching.
Return: true or false
player:GetEntityInUse()Returns the entity the player is currently using, like func_tank mounted turrets or +use prop pickups.
Return: entity or nil
player:GetEyeTraceSimple()Returns world coordinate of what the player is looking at, with a angles.
Return: vector, angle
player:GetJumpPower()Returns the jump power of the player.
Return: number
player:GetMaxSpeed2()A real version, returns the player's maximum movement speed.
Return: number
player:GetModel()Gets the playermodel of given player.
Return: string
player:GetObserverMode()Returns the the observer mode of the player.
Return: number
player:GetObserverTarget()Returns the player that who is currently observing.
Return: player or nil
player:GetShootPos()Returns the position of a player's view.
Return: vector
player:GetResourcePointer()Get the player statistics (scoreboard) pointer.
Return: number
player:GetStamina()Returns the the stamina of the player.
Return: number
player:GetStepSize()Returns the maximum height player can step onto.
Return: number
player:GetUserCmd()Get the total keys the player is current pressing.
Return: number
player:GetUserFlags()Returns all cso2 user flags of given player.
Return: number
player:GetVehicle()Gets the vehicle the player is driving.
Return: entity or nil
player:GetViewOffset()Returns the view offset of the player which equals the difference between the players actual position and their view.
Return: number
player:GetViewPunchAngles()Returns players screen punch effect angle.
Return: angle
player:GetWalkSpeedScale()Returns the player's walking speed multiplier.
This only affect if player is pressing shift key, i.e. slow walking.
Return: number
player:GetWeapons()Returns a table of the player's weapons.
Return: table
player:Give(weapon)Gives the player a weapon. weapon can be number or string.
weapon: number or string. Example: 160 or weapon_awmgaussplus
player:GodDisable()Disables god mode on the player.
player:GodEnable()Enables god mode on the player.
player:HasGodMode()Returns whether the player has god mode or not.
Return: true or false
player:InVehicle()Returns if the player is in a vehicle.
Return: true or false
player:IsAdmin()NOT FINISHED: This part of code is not finished yet, using this most likely won't help you.
Returns whether the player is an admin or not. By default the listenserver host are always admin.
Return: true or false
player:IsFrozen()Returns whether the players movement is currently frozen.
Return: true or false
player:IsListenServerHost()Returns if a player is the host of the current session.
BUG: This will return false before the host player actually spawnin.
Return: true or false
player:IsUserFlagSet(userflag)Checks if given cso2 user flag(s) is set or not.
Return: true or false
userflag: number
player:KeyDown(key)Returns whether player is pressing this key.
Return: true or false
key: number
player:Kick()Kicks the player from the server.
player:Kill()Kills a player.
player:Name()Returns the players name. This is same as player:Nick().
Return: string
player:Nick()Returns the player's nickname. This is same as player:Name().
Return: string
player:Ping()Returns the player's ping to server.
Return: number
player:PrintMessage(printtype, message)Displays a message either in their chat, console, or on the screen.
printtype: number
message: string
player:ReadResource(type, address, ispointer)Read the player statistics from player resource (scoreboard). ispointer is only for string variables.
Return: any
type: string. Example: int, float or vector
address: number. Example: 0x358
ispointer: bool
player:RemoveUserFlags(userflag)Removes specified cso2 user flag(s) from the player.
userflag: number
player:SelectWeapon(class)Sets the active weapon of the player by its class name.
class: string
player:SetArmor(armor, helmet)Sets the player armor to the argument, and if helmet is present.
armor: number
helmet: bool
player:SetAssists(assist)Sets a player's assists.
assist: number
player:SetDeaths(death)Sets a player's death count.
death: number
player:SetDuckLoseSpeed(lose)Sets if player should have a slower speed when crouching.
lose: bool
player:SetEyeAngles(angle)Sets the local angle of the player's view.
angle: angle
player:SetFrags(frag)Sets a player's frags (kills).
frag: number
player:SetJumpPower(power)Sets the jump power, eg. the velocity that will be applied to the player when they jump.
power: number
player:SetMaxSpeed(speed)Sets the maximum speed which the player can move at.
speed: number
player:SetObserverMode(mode)Sets the players observer mode.
mode: number
player:SetProgressBar(duration)Runs a progress bar on player, the progress bar will show on player's screen.
duration: number
player:SetStamina(stamina)Sets the players stamina.
stamina: number
player:SetStepSize(size)Sets the maximum height a player can step onto without jumping.
size: number
player:SetUserFlags(userflag)Sets cso2 user flag(s) for the player. This overrides any other flags the player might have had. Use player:AddUserFlags() for adding flags.
userflag: number
player:SetVelocity(velocity)Adds the velocity to player's base velocity.
velocity: vector
player:SetViewPunchAngles(angle)Sets client's view punch angle, but not the velocity.
angle: angle
player:SetWalkSpeedScale(scale)Sets the player's walking speed multiplier.
This only affect if player is pressing shift key, i.e. slow walking.
scale: number
player:ShouldBleed(bleed)Sets if player should bleed when being hit.
bleed: bool
player:StripWeapon(class)Removes the specified weapon class from a certain player.
class: string
player:StripWeapons()Removes all weapons from a certain player.
player:UserID()Returns the player's ID. You can use Player() to get the player by their ID.
player:WriteResource(type, address, value, ispointer)Write the player statistics from player resource (scoreboard) to given value. ispointer is only for string variables.
type: string. Example: int, float or vector
address: number. Example: 0x358
value: any
ispointer: bool