GetRandomPlayer: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→See Also) |
||
(10 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function returns a random [[player]] | {{Server function}} | ||
This function returns a random [[player]]. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">player getRandomPlayer ( )</syntaxhighlight> | <syntaxhighlight lang="lua"> | ||
player getRandomPlayer ( ) | |||
=== | </syntaxhighlight> | ||
'' | {{OOP||[[Player]].getRandom}} | ||
===Returns=== | |||
Returns a random [[player]], ''false'' if the server is empty. | |||
==Example== | ==Example== | ||
This code outputs a random's | This code outputs a random player's name. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
randomPlayer = getRandomPlayer ( ) | local randomPlayer = getRandomPlayer ( ) | ||
outputChatBox ( | outputChatBox ( getPlayerName ( randomPlayer ).." is now the fugitive!" ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions|server}} | ||
[[pl:getRandomPlayer]] |
Latest revision as of 22:42, 6 September 2024
This function returns a random player.
Syntax
player getRandomPlayer ( )
OOP Syntax Help! I don't understand this!
- Method: Player.getRandom(...)
Returns
Returns a random player, false if the server is empty.
Example
This code outputs a random player's name.
local randomPlayer = getRandomPlayer ( ) outputChatBox ( getPlayerName ( randomPlayer ).." is now the fugitive!" )
See Also
- getAlivePlayers
- getDeadPlayers
- getPlayerACInfo
- getPlayerAnnounceValue
- getPlayerCount
- getPlayerIdleTime
- getPlayerIP
- getPlayerVersion
- getRandomPlayer
- isPlayerMuted
- redirectPlayer
- resendPlayerACInfo
- resendPlayerModInfo
- setPlayerAnnounceValue
- setPlayerMuted
- setPlayerScriptDebugLevel
- setPlayerTeam
- setPlayerVoiceBroadcastTo
- setPlayerVoiceIgnoreFrom
- setPlayerWantedLevel
- spawnPlayer
- takePlayerScreenShot
- Shared
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState