Ir para conteúdo

Featured Replies

Postado

Preciso de um script que o player clique na avalanca e sumone um monstro, e que tenha um exhaustion de 12h

Eu tentei fazer assim mas não deu n.

 

local config = {
	storage = 60233, -- storage
	exhausttime = 1*30*30, -- time
	exhauststorage = 2300
	monster = {name = 'Teste', position= Position(747, 1602, 10)},
	message = "It's too quiet here...",
}

function onUse(cid, item, frompos, item2, topos)
	local player = creature:getPlayer()
	if not player then
		return true
	end
	
	if player:getStorageValue(config.exhauststorage) > os.time() then
local time = player:getStorageValue(config.exhauststorage) - os.time()
local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
if time >= 3600 then
text = hours.." "..(hours == 1 and "hour" or "hours")..", "..minutes.." "..(minutes == 1 and "minute" or "minutes").." and "..seconds.." "..(seconds == 1 and "second" or "seconds")
elseif time >= 60 then
text = minutes.." "..(minutes == 1 and "minute" or "minutes").." and "..seconds.." "..(seconds == 1 and "second" or "seconds")
else
text = seconds.." "..(seconds == 1 and "second" or "seconds")
end
doSendMagicEffect(pos, CONST_ME_POFF)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You need to wait "..text.." before you can get a reward again.")
return true
end

	local globalStorage = Game.getStorageValue(config.storage)
		return true 
	end

	local monster = Game.createMonster(config.monster.name, config.monster.position, false, true)
	if not monster then
		return true
	end

	player:say(config.message, TALKTYPE_SAY)
	Game.setStorageValue(config.storage)
	player:setStorageValue(config.exhauststorage, os.time() + 1*30*30)
	return true
end

 

Resolvido por Coltera

Ir para solução
Postado
  • Solução

@Yinz 

local config = {
	monster_name = "Dragon Lord",
	monster_position = Position(1063, 1052, 7),
	storage = 6025,
	ex_time = 1*60
}

function onUse(player, item, frompos, item2, topos)
	if not player:getPlayer() then
		return true
	end
	
	if player:getStorageValue(config.storage) >= os.time() then
		player:sendTextMessage(MESSAGE_INFO_DESCR, "You can only use in "..string.diff(player:getStorageValue(config.storage) - os.time()))
	else
		player:setStorageValue(config.storage, os.time() + config.ex_time)
		Game.createMonster(config.monster_name, config.monster_position)
		item:transform(item.itemid == 9826 and 9825 or 9826)
	end
	return true
end

 

Postado
  • Autor
  Em 14/01/2019 em 22:33, Coltera disse:

@Yinz 


local config = {
	monster_name = "Dragon Lord",
	monster_position = Position(1063, 1052, 7),
	storage = 6025,
	ex_time = 1*60
}

function onUse(player, item, frompos, item2, topos)
	if not player:getPlayer() then
		return true
	end
	
	if player:getStorageValue(config.storage) >= os.time() then
		player:sendTextMessage(MESSAGE_INFO_DESCR, "You can only use in "..string.diff(player:getStorageValue(config.storage) - os.time()))
	else
		player:setStorageValue(config.storage, os.time() + config.ex_time)
		Game.createMonster(config.monster_name, config.monster_position)
		item:transform(item.itemid == 9826 and 9825 or 9826)
	end
	return true
end

 

 

você é muito meu meninão <3

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo