Not Warking
function sendJobPayout()
local playerJobs = {}
-- getting all police
for i, player in ipairs(getElementsByType('player')) do
local job = exports.NGJobs:getPlayerJob(player)
if (job == 'Police Officer') then
if (playerJobs[player] == nil) then
playerJobs[player] = 0
end
playerJobs[player] = playerJobs[player] + 1
end
end
-- pay the players
for player, count in pairs(playerJobs) do
local cash = count * tonumber(get("*PAYOUT_CASH"))
givePlayerMoney(player, cash)
exports.NGMessages:sendClientMessage("Police: Here is $" .. tostring(cash) .. " payout.", player, 0, 255, 0)
end
end
-- set the timer
local payoutTime = tonumber(get("*PAYOUT_TIME"))
if payoutTime then
setTimer(sendTurfPayout, 60 * payoutTime * 1000, 0)
end
<meta>
<info author="BigBoss" name="Police Playout" type='script' version="1.0" />
<script src="server.lua" type="server" />
<settings>
<setting name="*PAYOUT_TIME" value="30" desc="Payout timer in minutes" />
<setting name="*PAYOUT_CASH" value="100000" desc="Money per group member per turf" />
</settings>
</meta>