Counter Strike Online Wiki
Advertisement

Player object

Inherits all contents of Game.Entity


Tables[]

Game.Player.position[]

Data type representing specific block coordinates
Fields:
  • x: (int) x coordinate
  • y: (int) y coordinate
  • z: (int) z coordinate


Game.Player.velocity[]

Data type representing a specific speed
Fields:
  • x: (number) x axis speed
  • y: (number) y axis speed
  • z: (number) z axis speed


Fields[]

Game.Player.name[]

Get the player's nickname.


Game.Player.death[]

Gets the player's death count.
  • death: (int)


Game.Player.team[]

Get or change a player's team.


Game.Player.coin[]

Import or change a player's studio coins.
You can change from 0 to 1,000,000,000.
  • coin: (int)


Game.Player.model[]

Gets or changes the player's current class.
Game.MODEL.DEFAULT is the class chosen by the player when entering.
When changing to a zombie model, all weapons are automatically removed, and you cannot acquire weapons.


Game.Player.flinch[]

Gets or changes the player's stiffness factor.
It can be from 0.0 to 1.0, the default is 1.0. The existing stiffness is multiplied.
  • flinch: (number)
Usage:
player.finch = 0.8 	-When the default stiffness is 30%, 30% x 0.8 = 24%


Game.Player.knockback[]

Gets or changes the player's knockback scale.
It can be from 0.0 to 3.0, the default is 1.0. The existing knockback is multiplied.
  • knockback: (number)
Usage:
player.knockback = 2.0 	-When the default knockback is 80%, 80% x 2.0 = 160%


Game.Player.maxspeed[]

Gets or changes the player's maximum speed multiplier.
It can be from 0.0 to 10.0, the default is 1.0. The existing value is multiplied. The multiplied value cannot be higher than the maximum speed defined by the game engine.
  • maxspeed: (number)


Game.Player.gravity[]

Gets or changes the player's gravity multiplier.
It can be from 0.0 to 10.0, the default is 1.0. The existing value is multiplied. The multiplied value cannot be higher than the maximum gravity defined by the game engine.
  • gravity: (number)


Game.Player.infiniteclip[]

Changes whether the Player will have infinite clip or not.
  • infiniteclip: (bool)


Methods[]

Game.Player: Create (index)[]

Get the player corresponding to the index number.
Index starts from number one
Parameters:
  • index: (int)
Returns:
(Player or nil) In case of bad index, nil


Game.Player: Respawn ()[]

The player is respawning.


Game.Player: Kill ()[]

Player dies.


Game.Player: Win (exit)[]

The player wins.
Without the exit argument, the game ends after winning.
Parameters:
  • exit: (Optional bool) Whether to end the game after winning


Game.Player: ShowBuymenu ()[]

Displays favorite weapon purchases.


Game.Player: RemoveWeapon ()[]

Remove all players' weapons.


Game.Player: SetGameSave (name, value)[]

Add values ​​to be stored in the group.
This data is stored separately for each player and shared between the same groups.
See help for more information
Parameters:


Game.Player: GetGameSave (name)[]

Get the values ​​stored in the group.
This data is stored separately for each player and shared between the same groups.
See help for details. If name is not found, nil is returned.
Parameters:
Returns:
(number, string, bool or nil) stored value


Game.Player: SetFirstPersonView ()[]

Changes the player's camera to first person view.


Game.Player: SetThirdPersonView (minDist, maxDist)[]

Turns the player's camera into a third person view.
Parameters:
  • minDist: (number) The minimum distance of the camera
  • maxDist: (number) The maximum distance of the camera


Game.Player: SetThirdPersonFixedView (yaw, pitch, minDist, maxDist)[]

Change the player's camera to a third person view and fix the angle.
The mouse pointer is displayed and the user input method is changed to the method using mouse pointer raycast. Refer to Player.SetThirdPersonFixedPlane for how to calculate the raycast. The [Use] and [Acquire] actions are changed from the existing camera viewpoint based to the player position. Weapons using zoom will raise the camera height without zooming in. Among the weapons that fire grenade, such as M32, the aiming method of gravity weapons is changed.
Parameters:
  • yaw: (number) yaw rotation of the camera
  • pitch: (number) Camera's pitch rotation value
  • minDist: (number) The minimum distance of the camera
  • maxDist: (number) The maximum distance of the camera


Game.Player: SetThirdPersonFixedPlane (plane)[]

Modifies how the mouse pointer calculates raycasts in the ThirdPersonFixedView state.
It will not work if it is not a ThirdPersonFixedView. For example, if it is set as XY plane, raycast is performed on the plane corresponding to the Z of the player among planes parallel to the XY plane and the collision point is set as the reference point. The player character always looks at the base point, and when firing a gun, it fires in the direction of the base point. GROUND and XY planes are suitable for the top view game genre, and XZ planes and YZ planes are suitable for the front view game genre.
Parameters:


Game.Player: ShowWeaponInven ()[]

Shows weapon inventory.


Game.Player: ToggleWeaponInven ()[]

Toggles weapon inventory. (If it is open, it is closed. If it is closed, it is opened.)


Game.Player: Signal (signal)[]

Send a random signal to the player.
When a signal is received, a UI.Event.OnSignal event is raised.
Parameters:
  • signal: (int) Any integer value


Game.Player: SetLevelUI (level, expRate)[]

Display and modify the level / experience UI on the player's screen.
Parameters:
  • level: (int) player level
  • expRate: (number) The length ratio of the experience bar. It can be set from 0.0 to 1.0.


Game.Player: SetBuymenuLockedUI (weaponid, uiLocked, level)[]

Set a lock display for each weapon item in the shop window.
Parameters:
  • weaponid: (Common.WEAPON) Weapon id to set the lock indicator
  • uiLocked: (bool) Sets the lock display when true and releases when false.
  • level: (Optional int) Displays level text with a lock mark. If the value is omitted, it is not displayed.


Game.Player: SetWeaponInvenLockedUI (weapon, uiLocked, level)[]

Set a lock mark for each weapon item in the weapon inventory window.
Common.UseWeaponInven must be set.
Parameters:
  • weapon: (Common.WEAPON) Weapon to set the lock indicator
  • uiLocked: (bool) Sets the lock display when true and releases when false.
  • level: (Optional int) Displays level text with a lock mark. If the value is omitted, it is not displayed.


Game.Player: GetPrimaryWeapon ()[]

Brings the primary weapon the player is currently holding.
Nil is returned if you have no main weapon, have never used the Game.Weapon class, or are not in the script weapon list.
Returns:
(Game.Weapon or nil)


Game.Player: GetSecondaryWeapon ()[]

Brings the secondary weapon the player is currently holding.
Nil is returned if there is no secondary weapon, if you have never used the Game.Weapon class, or if it is not in the script weapon list.
Returns:
(Game.Weapon or nil)


Game.Player: GetWeaponInvenList ()[]

Gets a list of weapons that the player currently has in the weapon inventory.
Common.UseWeaponInven must be set. Weapons in your hand are not included. The result table contains Game.Weapons.
Returns:
(table) weaponList


Event Callback[]

Game.Player: OnSpawn ()[]

Event callback that is called when the player spawns.


Game.Player: OnKilled (killer)[]

An event callback that is called when the player dies.
Parameters:
  • killer: (Game.Player or nil) nil if killed for reasons other than player attack


Game.Player: OnAssist (victim, killer)[]

Event callback that is called when the player assists.
Parameters:
  • victim: (Game.Player) attacked player
  • killer: (Game.Player or nil) nil if killed for reasons other than player attack
Advertisement