ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getRandomPlayer

Function

getRandomPlayer

ServerPlayersIdentical to MTA:SA

Returns a random player from the server.

Syntax

player getRandomPlayer()

Returns

A player, or false when nobody is online.

Example

setTimer(function()
    local lucky = getRandomPlayer()
    if lucky then
        givePlayerMoney(lucky, 1000)
        outputChatBox(getPlayerName(lucky) .. " wygrał $1000 w loterii!")
    end
end, 600000, 0)