GetRandomPlayer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local randomPlayer = getRandomPlayer ( )
local randomPlayer = getRandomPlayer ( )
outputChatBox ( getClientName ( randomPlayer ).." is now the fugitive!" )
outputChatBox ( getPlayerName ( randomPlayer ).." is now the fugitive!" )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Revision as of 12:14, 27 August 2009

This function returns a random player.

Syntax

player getRandomPlayer ( )

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