Jump to content

Pagamento por Tempo


Recommended Posts

Posted

Queria Fazer Um Sistema para o player receber tal salario por tempo , ja tentei mas não consegui, se alguem puder ajudar

Posted (edited)

Se tentou, mostre seu código para vermos o que podemos alterar e te ajudar para conseguir fazer funcionar. Enviar códigos prontos não é um trabalho feito pela maioria.

Edited by GSC
Posted

Coloque um intervalo menor e veja se isso vai funcionar, eu não testei:

 

Client-side:

local intervalo = 3600000 -- tempo em milisegundos (atualmente está 1 hora)
local tick = getTickCount ()

function salario ()
  if tick + intervalo <= getTickCount() then
	triggerServerEvent('pagarSalario', localPlayer)
    tick = getTickCount ()
  end
end
addEventHandler ('onClientRender', root, salario)

Server-side:

local salario = 1000 --Valor do salario

addEvent('pagarSalario', true)
function pagarSalario ()
	local money = getPlayerMoney (source)
  	setPlayerMoney(source, money + salario)
end
addEventHandler('pagarSalario', root, pagarSalario)

 

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