Jump to content

Police Job auto Payment


Recommended Posts

-- Group payout timer 
function sendTurfPayout ( ) 
    local playerJobs = { }


    for i, Police Officer in pairs ( getElementsByType ( 'player' ) ) do 
        local exports.NGJobs:getPlayerJobs ( 'Police Officer' ) 
        if ( g and playerJobs [ g ] and playerJobs [ g ] > 0 ) then 
            local c = playerJobs [ g ] * tonumber ( get ( "*PAYOUT_CASH" ) )
            givePlayerMoney ( Police Officer, c )
            exports.NGMessages:sendClientMessage ( "Police: Here is $ "( playerJobs [ g ] ).."playout" v, 0, 255, 0 )
        end
    end
end 
setTimer ( sendTurfPayout, (60*tonumber(get("*PAYOUT_TIME")))*1000, 0 )

 

Help fro fix that

Edited by BigBoss1234
Link to comment
function sendTurfPayout()
    local playerJobs = {}

    for i, policeOfficer in ipairs(getElementsByType('player')) do
        local jobName = exports.NGJobs:getPlayerJob(policeOfficer)
        if jobName == 'Police Officer' then
            local jobLevel = exports.NGJobs:getPlayerJobLevel(policeOfficer, jobName)
            if jobLevel and jobLevel > 0 then
                local payout = jobLevel * tonumber(get('*PAYOUT_CASH'))
                givePlayerMoney(policeOfficer, payout)
                exports.NGMessages:sendClientMessage(policeOfficer, 'Police: Here is $'..payout..' payout', 0, 255, 0)
            end
        end
    end
end
setTimer(sendTurfPayout, (60 * tonumber(get('*PAYOUT_TIME'))) * 1000, 0)

Try it and say if it works please

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