Ir para conteúdo

Featured Replies

Postado

Uso esse script, porem queria q só 1 acc do IP ganhasse, pq se o cabra abrir 2...3...4 accs ele ganharia em todas acc, queria que limitasse a ganhar em uma só acc.

Alguém poderia ajudar pf.
 

 

Postado
local config = {
	p_time = 3600, -- Tempo em segundos para receber os pontos( 3600 = 1hora )
	p_points = 1 -- Quantidade de pontos recebida a cada "p_time"
}

local function givePoints(cid, quant)
	if os.time() - getCreatureStorage(cid, 1219) >= config.p_time then
		doPlayerSendTextMessage(cid, 19, "Congratulations, you recieved ".. config.p_points .." p points. Now you have ".. config.p_points + getPoints(cid) .." p points in your account. Your timer was reseted.") 
		doPlayerAddPoints(cid, quant) 
		doCreatureSetStorage(cid, 1219, 0)
		doCreatureSetStorage(cid, 1219, os.time())
	end
	return true
end 
function onThink(interval)
	local players = getPlayersOnline()
	if #players > 0 then
		local t,v = {},{}
		for _, pid in pairs(players) do
			if not isInArray(t, getPlayerIp(pid)) then 
				t[#t+1] = getPlayerIp(pid)
				v[#v+1] = pid
			end
		end
		for _, ret in pairs(v) do
			givePoints(ret, config.p_points)
		end
	end
	return true
end

 

Editado por Vodkart (veja o histórico de edições)

Postado
  • Autor
  Em 20/03/2020 em 19:00, Vodkart disse:

local config = {
	p_time = 3600, -- Tempo em segundos para receber os pontos( 3600 = 1hora )
	p_points = 1 -- Quantidade de pontos recebida a cada "p_time"
}

local function givePoints(cid, quant)
	if os.time() - getCreatureStorage(cid, 1219) >= config.p_time then
		doPlayerSendTextMessage(cid, 19, "Congratulations, you recieved ".. config.p_points .." p points. Now you have ".. config.p_points + getPoints(cid) .." p points in your account. Your timer was reseted.") 
		doPlayerAddPoints(cid, quant) 
		doCreatureSetStorage(cid, 1219, 0)
		doCreatureSetStorage(cid, 1219, os.time())
	end
	return true
end 
function onThink(interval)
	local players = getPlayersOnline()
	if #players > 0 then
		local t,v = {},{}
		for _, pid in pairs(players) do
			if not isInArray(t, getPlayerIp(pid)) then 
				t[#t+1] = getPlayerIp(pid)
				v[#v+1] = pid
			end
		end
		for _, ret in pairs(v) do
			givePoints(ret, config.p_points)
		end
	end
	return true
end

 

 

Funcionou Perfeitamente !

Você e 10 Cara. Muito Obrigado !

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo