Skip to content
DizzasTeR edited this page Nov 5, 2020 · 20 revisions

Player


Class Static Functions

  • Player.type() — Returns entity type (string "Player")
  • Player.findByID(int id) — Returns a Player with the matching id, nil otherwise
  • Player.count() — Returns the total number of Player objects right now (Player count)

Methods

  • msg(string text) — Sends a chat message to the player
  • setOption(PlayerOption option, bool status) — Sets state of a player option
  • getOption(PlayerOption option) — Gets the state of a player option
  • isPlayerStreamed(Player otherPlayer)
  • setWeapon(int weaponID, int ammo)
  • giveWeapon(int weaponID, int ammo)

Read-Only Methods

  • getType() — Same as static type
  • getID() — Return player's ID
  • getIP() — Return player's IP (string)
  • getUID() — Return player's Unique ID (string)
  • getUID2() — Return player's Secondary Unique ID (string)
  • getKey() — Return player's key (int)
  • getState() — Return the player's state (int)
  • getUniqueWorld() — Return the player's unique world (int)
  • getClass() — Return player's class
  • isOnline() — Checks if the player is online or not (bool)
  • isSpawned() — Is the player spawned or not (bool)
  • isTyping() — Is the player typing (chatbox open) (bool)
  • isCrouching() — Is the player crouching (bool)
  • getPing() — Return player's ping (int)
  • getFPS() — Return player's FPS (float)
  • getModules() — Requests modules from player and calls the module event

Properties

  • position — Table
  • angle — float
  • admin — bool
  • world — int
  • secondaryWorld — int
  • team — int
  • skin — int
  • color — int
  • cash — int
  • score — int
  • wantedLevel — int
  • Immunity — int
  • health — int
  • armour — int
  • name — string
  • vehicle — Vehicle
  • weaponSlot — int
  • spectateTarget — Player

General Example

local player = Player.findByID(0)
if player then
    player.health = 200
    player:msg("Your health is now: "..player.health.."%")
else
    Logger.warn("Player with id 0 not found. Total players in-game: "..Player.count())
end

Clone this wiki locally