GetAllPlayers: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:PlayerFunctions}} |
Revision as of 16:57, 13 December 2019
Description
Get all players on the server. Useful for loops.
Syntax
GetAllPlayers()
Parameters
- This function has no parameters.
Return Value
- Returns a table of all players.
Example
function cmd_healall(player)
if (PlayerData[player].admin < 4) then
return AddPlayerChat(player, "Insufficient permission")
end
for _, v in pairs(GetAllPlayers()) do
SetPlayerHealth(v, 100.0)
end
AddPlayerChatAll("Admin "..GetPlayerName(player).." has healed all players!")
end
AddCommand("healall", cmd_healall)