Postado Março 14, 2018 7 anos Solução local config = { porc = 25, -- | % de chance | -- itemid = 5252, -- | id do item | -- qnt = 1, -- | Count do item | -- storage = 232526, -- | Storage que conta o tempo | -- horas = 1 -- | Horas para usar o item novamente | -- } local msgs = { exaust = "você so pode usar isso a cada uma hora", -- | Msg de exaust | -- sucess = "voce recebeu o item", -- | Msg qnd conseguir | -- notmission = "você não está nestas missões.", -- | Msg quando n tiver na missao | -- fail = "voce n recebeu o item" -- | Msg quando falhar | -- } function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getCreaturePosition(cid) if getPlayerStorageValue (cid, 8000) ~= 98 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msgs.notmission) doSendMagicEffect(pos, 3) return true end if os.time() - getPlayerStorageValue(cid, config.storage) <= config.horas * 3600 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msgs.exaust) doSendMagicEffect(pos, 3) return true end if math.random(1, 100) <= config.porc then doSendMagicEffect(pos, 5) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msgs.sucess) doPlayerAddItem(cid, config.itemid, config.qnt) setPlayerStorageValue (cid, 8000, 99) setPlayerStorageValue(cid, config.storage, os.time()) return true end doSendMagicEffect(pos, 5) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msgs.fail) setPlayerStorageValue(cid, config.storage, os.time()) return true end
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.