Jump to content

Lottery


Recommended Posts

basically all you need is inserting players into a table and in the end of a map select a random one.

local playertable = {}
 
function playLottery(player)
takePlayerMoney(player,100)
table.insert(playertable,player)
end
addCommandHandler("lottery",playLottery)
 
function chooseWinner()
local winner = playertable[math.random(1,#playertable)]
givePlayerMoney(winner,1000)
   playertable = {}
end

of course you have to call that second function at some point

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...