A better implementation to this would be with tables:
-- Define ACLs' salary
local acl2salary = {
-- ["ACL NAME"] = salary,
["PMSP2"] = 2000,
["BOPE2"] = 1000,
["ROTA2"] = 1000,
["NARCOS2"] = 1000
}
function giveSalaries ()
-- Loop throught all the previously defined ACLs
for aclName, salary in pairs ( acl2salary ) do
-- Loop throught all the ACL's objects
for index, objectName in pairs ( aclGroupListObjects ( aclGetGroup ( aclName ) ) ) do
-- Check if the object is an account (and if it is, check if the account exists)
if ( objectName:find ( "^user." ) and getAccount ( (objectName:gsub ( "^user.", "" )) ) ) then
-- Try to get a player from his account name
local player = getAccountPlayer ( getAccount ( (objectName:gsub ( "^user.", "" )) ) )
-- Make sure we've found a player
if ( player ) then
-- Give him the money
givePlayerMoney ( player, salary )
outputChatBox ( "SALARY: You received $" .. salary .. "!", player )
end
end
end
end
end
-- Repeat every 5 seconds infinite times
setTimer ( giveSalaries, 5000, 0 )
Untested, but it should work.