Jump to content

Salário vip


Recommended Posts

Queria colocar ACL em um salário vip que tenho, mas todas as formas que tento não vai.

function giveSalarioVIP(playerSource)
	if getElementData(playerSource, "isVIPRevolution") or getElementData(playerSource, "isVIPOmega") or getElementData(playerSource, "isVIPSigma") or getElementData(playerSource, "isVIPEpsylon") or getElementData(playerSource, "isVIPAlpha") then
		local account = getPlayerAccount(playerSource)
		local timeAtual = getRealTime().timestamp
		local day = 18000
		local dataUltimaTroca = getAccountData(account, "ultimaTrocaSalario") or timeAtual - day
		local calc = timeAtual - dataUltimaTroca
		if calc < day then
			return outputChatBox("Espere "..secondsToTimeDesc(day - calc).." para receber o salário novamente", playerSource, 255, 0, 0)
		end
		local moneyValue, typeVIP = getMoneyFromACL(playerSource)
		if givePlayerMoney(playerSource, moneyValue) then
			outputChatBox("#00ffff#===========================================================", root, 0, 255, 0, true)
			outputChatBox("["..typeVIP.."] "..getPlayerName(playerSource).." pegou seu salário de $"..convertNumber(moneyValue)..", usando /salario", root, 0, 255, 0, true)
			outputChatBox("#00ffff#===========================================================", root, 0, 255, 0, true)
				
			setAccountData(account, "ultimaTrocaSalario", timeAtual)
		end
	else
		outputChatBox("Você não tem permissão para usar este comando. Adquira já seu VIP!", playerSource, 255, 0, 0)
	end
end
addCommandHandler("salario", giveSalarioVIP)

function getMoneyFromACL(player)
	if getElementData(player, "isVIPRevolution") then
		return 80000, "VIP Revolution"
	elseif getElementData(player, "isVIPOmega") then
		return 50000, "VIP Omega"
	elseif getElementData(player, "isVIPSigma") then
		return 40000, "VIP Sigma"
	elseif getElementData(player, "isVIPEpsylon") then
		return 30000, "VIP Epsylon"
	elseif getElementData(player, "isVIPAlpha") then
		return 20000, "VIP Alpha"
	end
	return false
end

function convertNumber ( number )  
	local formatted = number  
	while true do      
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
		if ( k==0 ) then      
			break   
		end  
	end  
	return formatted
end

function secondsToTimeDesc( seconds )
	if seconds then
		local results = {}
		local sec = ( seconds %60 )
		local min = math.floor ( ( seconds % 3600 ) /60 )
		local hou = math.floor ( ( seconds % 86400 ) /3600 )
		local day = math.floor ( seconds /86400 )
		
		if day > 0 then table.insert( results, day .. ( day == 1 and " dia" or " dias" ) ) end
		if hou > 0 then table.insert( results, hou .. ( hou == 1 and " hora" or " horas" ) ) end
		if min > 0 then table.insert( results, min .. ( min == 1 and " minuto" or " minutos" ) ) end
		if sec > 0 then table.insert( results, sec .. ( sec == 1 and " segundo" or " segundos" ) ) end
		
		return string.reverse ( table.concat ( results, ", " ):reverse():gsub(" ,", " e ", 1 ) )
	end
	return ""
end

 

Link to comment

Se você quiser usar uma ACL ao invés de usar getElementData tente desta forma:
 

 local nomeDoPlayer = getAccountName ( getPlayerAccount ( playerSource ) )
     if isObjectInACLGroup ("user."..nomeDoPlayer, aclGetGroup ( "Revolution" ) ) or isObjectInACLGroup ("user."..nomeDoPlayer, aclGetGroup ( "Epsylon" ) ) then

 

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