Jump to content

anyway ?


Best-Killer

Recommended Posts

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

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...