-
Notifications
You must be signed in to change notification settings - Fork 1
Player Functions
Necroso edited this page Sep 21, 2022
·
20 revisions
- 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)
- Player.getActive(bool spawnedOnly = false) — Returns a table of all players in-game (Pass true to only get those who are spawned)
- Player.msgAll(string msg [, int color = 0xRRGGBBAA])
- Player.announceAll(string msg [, int type = 0])
- msg(string msg [, int color = 0xRRGGBBAA]) — Sends a chat message to the player
- announce(string msg [, int type = 0]) — Sends a game 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)
- playSound(int sound)
- playSound3D(int sound [, table position OR float x, float y, float z])
- setWeapon(int weaponID, int ammo)
- giveWeapon(int weaponID, int ammo)
- setVehicle(Vehicle vehicle [, int slot = 0])
- redirect(string ip, int port, string serverPassword)
- setCamera:
- setCamera(Table cameraPosition, Table lookAtPosition)
- setCamera(float camX, float camY, float camZ, float lookX, float lookY, float lookZ)
- restoreCamera()
- selectClass() — Forces player to select whatever skin/class is being viewed during class selection
- setAnimation([int groupID = 0, ] int animationID)
- eject() — Eject player from vehicle
- 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
- data — Table
- 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
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