Ir para conteúdo

Featured Replies

Postado

Eu mesmo resolvi meu problema para quem está usando o mesmo script e quer colocar level a solução está logo ali em baixo.

 

Primeiramente boa noite a todos, eu tenho esse script que funciona perfeitamente, porem queria colocar uma condição que apenas players de level 351 pudessem dar user nesse item.

local config = {
	time = 2,
	storage = 61398
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if player:getStorageValue(config.storage) >= os.time() then
		player:sendTextMessage(MESSAGE_INFO_DESCR, "You should still have remaining time from the previous card or check your level!")
		return true
	end

	player:setStorageValue(config.storage, os.time() + config.time * 3600)
	player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You have activated %d hour%s of double experience.", config.time, config.time ~= 1 and "s" or ""))
	item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
	item:remove(1)
	return true
end

 

Solução:

 

local config = {
	time = 2,
	storage = 61398,
	level = 351
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if (player:getStorageValue(config.storage) >= os.time()) or (config.level and player:getLevel() <= config.level) then
		player:sendTextMessage(MESSAGE_INFO_DESCR, "You should still have remaining time from the previous card or check your level!")
		return true
	end

	player:setStorageValue(config.storage, os.time() + config.time * 3600)
	player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You have activated %d hour%s of double experience.", config.time, config.time ~= 1 and "s" or ""))
	item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
	item:remove(1)
	return true
end

 

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

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