Best-Killer Posted January 18, 2016 Share Posted January 18, 2016 anyway to add last number won + last money won !! script function winLottery ( ) local winAccount = nil local winner = nil local num = getLotteryWinningNumber ( ) for i, v in pairs ( lottery ) do if ( v == num ) then winAccount = i end end if ( winAccount ) then for i, v in pairs ( getElementsByType ( "player" ) ) do local a = getPlayerAccount ( v ) if ( not isGuestAccount ( a ) and getAccountName ( a ) == winAccount ) then winner = v end end end if ( winAccount and not winner ) then winner = winaccount.." #ff0000(offline)" elseif ( not winAccount ) then winner = nil end exports.SAEGMessages:sendClientMessage("Lottery Winner is :"..tostring(winner or "Nobody")" Prize :"..tostring(prize), root, 0, 255, 0) if ( winner ~= nil and getElementType ( winner ) == "player" ) then exports.SAEGMessages:sendClientMessage("You won $"..tostring(prize).." from the lottery!", winner, 0, 255, 0) givePlayerMoney ( winner, prize ) end generateNextLottery ( ) end function generateNextLottery ( ) lottery = { } winningNum = math.random ( 1, 30 ) prize = math.random ( 1, 2000000 ) if ( isTimer ( lotTImer ) ) then killTimer ( lotTImer ) lotTImer = nil end lotTImer = setTimer ( winLottery, 1800000, 1) end function getLotteryWinningNumber ( ) return winningNum end function getLotteryTimer ( ) return lotTImer end generateNextLottery ( ) addEvent ( "SAEGLotter->onClientRequestTimerDetails", true ) addEventHandler ( "SAEGLotter->onClientRequestTimerDetails", root, function ( ) triggerClientEvent ( source, "SAEGLottery->onServerSendClientTimerDetails", source, convertMilSecsToTimer ( getTimerDetails ( getLotteryTimer ( ) ) )) end ) function convertMilSecsToTimer ( mil ) local h = 0 local m = 0 local s = 0 while ( mil > 1000 ) do s = s + 1 mil = mil - 1000 end while ( s > 60 ) do s = s - 60 m = m + 1 end while ( m > 60 ) do m = m - 60 h = h + 1 end return tostring ( h ).."h "..tostring(m).."m "..tostring (s).."s" end Link to comment
Best-Killer Posted January 19, 2016 Author Share Posted January 19, 2016 Any Help Guys pls Link to comment
starksZ Posted January 19, 2016 Share Posted January 19, 2016 Why you don´t have interest for learn Lua? Link to comment
Best-Killer Posted January 19, 2016 Author Share Posted January 19, 2016 Why you don´t have interest for learn Lua? i want example i won't u make the code for me -.- also i'm asking "anyway" i'm not saying make code for me Link to comment
Best-Killer Posted January 19, 2016 Author Share Posted January 19, 2016 any example or help guys ? Link to comment
1LoL1 Posted January 19, 2016 Share Posted January 19, 2016 any example or help guys ? Nobody here will not write the whole code, or any example. And for you is the example = code. Link to comment
Best-Killer Posted January 19, 2016 Author Share Posted January 19, 2016 any example or help guys ? Nobody here will not write the whole code, or any example. And for you is the example = code. man i said i won't code -.- i want just example Link to comment
starksZ Posted January 19, 2016 Share Posted January 19, 2016 (edited) We are not your slaves, you ask for help every day, and YOU dont cant try to learn lua. Your code = example Edited January 19, 2016 by Guest Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now