GetRandomPlayer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (fix oop syntax)
Line 7: Line 7:
player getRandomPlayer ( )
player getRandomPlayer ( )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[Player]].getRandom|random|}}
{{OOP||[[Player]].getRandom}}
===Returns===
===Returns===
Returns a random [[player]], ''false'' if the server is empty.
Returns a random [[player]], ''false'' if the server is empty.

Revision as of 04:18, 29 December 2014

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