Advertisement
incinirate

lotto

Jun 25th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local API = args[1]
  4. local user = args[2]
  5. local mode = tonumber(args[3])
  6. local amount = tonumber(args[4])
  7.  
  8.  
  9. if API.getLottoRunning() then
  10.   if amount > 0 then
  11.     if API.getLBC( user ) >= amount then
  12.       if not API.LottoUsers[user] then
  13.         API.LottoUsers[user] = 0
  14.       end
  15.       for i=1,amount do
  16.         table.insert(API.LottoTickets, user)
  17.       end
  18.       API.LottoUsers[user] = API.LottoUsers[user] + amount
  19.       API.message( mode, user, "You added ".. amount .." LittleBigCoins to the pot!")
  20.       for k,v in pairs(API.LottoUsers) do
  21.         print("Telling")
  22.         API.tell( k, "You currently have a ".. (math.floor(v)/#API.LottoTickets)*(100) .."% chance to win!")
  23.       end
  24.       API.setLBC( user, API.getLBC(user) - amount )
  25.     else
  26.       API.message( mode, user, "You can't put in more LBC than you have!")
  27.     end
  28.   else
  29.     API.message( mode, user, "You can't enter a negative or nonpositive amount of money!")
  30.   end
  31. else
  32.   API.message( mode, user, "No lotto is running, user '..startlotto <time>' to make one!")
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement