Postado Março 14, 2015 10 anos Dúvida sanada. Editado Março 16, 2015 10 anos por ScythePhantom (veja o histórico de edições)
Postado Março 14, 2015 10 anos Não entendi essa:5ª Que apenas um player em questão usasse este item... sei lá, storage ou algo do tipo. Estou editando o código e jajá posto pra você edit: local config = { stamina = 2520, -- Stamina do player ao usar o item, 2520 = Full stamina! ti = 12*3600, -- tempo em horas } function onUse(cid, item, fromPos, itemEx, toPos) local st = p.storage if getCreatureCondition(cid,CONDITION_INFIGHT) == false and isPlayerPzLocked(cid) == true then if getCreatureStorage(cid, st) > os.time() then doCreatureSay(cid, "Voce precisa esperar " .. getCreatureStorage(cid, st) - os.time() .. ' segundo(s)' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " para teleportar novamente.", TALKTYPE_MONSTER) return true else doPlayerSendTextMessage(cid, 25, "Sua stamina foi renovada, você será kickado para que sejam feitas as atualizações em seu character.") doPlayerSetStamina(cid, config.stamina) doRemoveItem(item.uid, 1) doRemoveCreature(cid) doCreatureSetStorage(cid, st, os.time() + ti) return true end end doPlayerSendCancel(cid, "Voce precisa de estar em uma area PZ.") return true end Testa aí e se der errado me avisa o erro! Editado Março 14, 2015 10 anos por Fortes Host (veja o histórico de edições)
Postado Março 14, 2015 10 anos Autor Não entendi essa: 5ª Que apenas um player em questão usasse este item... sei lá, storage ou algo do tipo. Estou editando o código e jajá posto pra você edit: Testa aí e se der errado me avisa o erro! Quanto ao que você não entendeu... tipo, eu gostaria que apenas um player usasse este item, entendeu? SCRIPT: local config = { stamina = 2520, -- Stamina do player ao usar o item, 2520 = Full stamina! ti = 12*3600, -- tempo em horas } function onUse(cid, item, fromPos, itemEx, toPos) local st = p.storage if getCreatureCondition(cid,CONDITION_INFIGHT) == false and isPlayerPzLocked(cid) == true then if getCreatureStorage(cid, st) > os.time() then doCreatureSay(cid, "You have to wait " .. getCreatureStorage(cid, st) - os.time() .. ' second(s)' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to use the item again..", TALKTYPE_MONSTER) return true else doPlayerSendTextMessage(cid, 25, "His stamina was renewed, you will be kicked for updates to be made to your character.") doPlayerSetStamina(cid, config.stamina) doRemoveCreature(cid) doCreatureSetStorage(cid, st, os.time() + ti) return true end end doPlayerSendCancel(cid, "You must be in PZ to use this item.") return true end Deu erro: Editado Março 14, 2015 10 anos por ScythePhantom (veja o histórico de edições)
Postado Março 14, 2015 10 anos Solução Tenta assim: local config = { stamina = 2520, -- Stamina do player ao usar o item, 2520 = Full stamina! ti = 12*3600, -- Tempo para usar em horas. temp = 5 -- Tempo para kikar após usar o item. } function onUse(cid, item, fromPos, itemEx, toPos) local st = 25090 if getTilePzInfo(getPlayerPosition(cid)) == false then return doPlayerSendTextMessage(cid, 25, "You need to be in protection zone.") end if getPlayerStamina(cid) >= config.stamina then return doPlayerSendTextMessage(cid, 25, "Your stamina is already full.") end if getPlayerStorageValue(cid, st) > os.time() then doPlayerSendTextMessage(cid, 25, "You need wait " .. getPlayerStorageValue(cid, st) - os.time() .. ' second' .. (getPlayerStorageValue(cid, st) - os.time() == 1 and "" or "s") .. " to use this item again.") return true else doPlayerSendTextMessage(cid, 25, "His stamina was renewed, you will be kicked in "..config.temp.." seconds to update the character.") doPlayerSetStamina(cid, config.stamina) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, st, os.time() + config.ti) addEvent(doRemoveCreature, config.temp*1000, cid, true) return true end return true end Quanto ao ultimo pedido, não sei como fazer x.x ➥ Regras | Seções OTServ | Seções BOT
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.