Postado Março 6, 2015 10 anos Em 06/03/2015 em 20:00, luanluciano93 disse: trocar por doPlayerSetStamina Agora funcionou sem nenhum erro, porém eu posso ficar usando o item toda hora. @Edit e minha stamina fica em 0:00 Editado Março 6, 2015 10 anos por Wakon (veja o histórico de edições) ➥ Regras | Seções OTServ | Seções BOT
Postado Março 6, 2015 10 anos local config = { premiumDays = 1, storageQuest = 9999, timeWait = 86400, -- tempo em horas. staminaRefuel = 3, -- tempo que irá recuperar em horas } function onUse(cid, item, frompos, item2, topos) if (getPlayerStorageValue(cid, config.storageQuest) < os.time) then setPlayerStorageValue(cid, config.storageQuest, os.time + (config.timeWait * 24 * 60 * 60)) doPlayerSetStamina(cid, (getPlayerStamina(cid)) + (config.staminaRefuel * 60 * 60)) doSendMagicEffect(getThingPos(cid), 52) doPlayerAddPremiumDays(cid, config.premiumDays) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Parabens! Voce acabou de receber um dia de GOLD CARD.") doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce ainda nao pode usar.") end return true end STYLLER OT 2022
Postado Março 6, 2015 10 anos Em 06/03/2015 em 20:18, luanluciano93 disse: local config = { premiumDays = 1, storageQuest = 9999, timeWait = 86400, -- tempo em horas. staminaRefuel = 3, -- tempo que irá recuperar em horas } function onUse(cid, item, frompos, item2, topos) if (getPlayerStorageValue(cid, config.storageQuest) < os.time) then setPlayerStorageValue(cid, config.storageQuest, os.time + (config.timeWait * 24 * 60 * 60)) doPlayerSetStamina(cid, (getPlayerStamina(cid)) + (config.staminaRefuel * 60 * 60)) doSendMagicEffect(getThingPos(cid), 52) doPlayerAddPremiumDays(cid, config.premiumDays) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Parabens! Voce acabou de receber um dia de GOLD CARD.") doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce ainda nao pode usar.") end return true end Voltou ao primeiro bug lá de "Attempt to compare number with function". Ai quando eu adiciono 1 (t) na frente do os.time ele funciona porém dá aquele problema de ficar usando o item toda hora. ➥ Regras | Seções OTServ | Seções BOT
Postado Março 9, 2015 10 anos Solução tente assim: local config = { premiumDays = 1, storageQuest = 9999, timeWait = 1, -- tempo em dias. staminaRefuel = 3, -- tempo que irá recuperar em horas } function onUse(cid, item, frompos, item2, topos) if (getPlayerStorageValue(cid, config.storageQuest) < os.time()) then setPlayerStorageValue(cid, config.storageQuest, os.time() + (config.timeWait * 24 * 60 * 60 * 1000)) doPlayerSetStamina(cid, (getPlayerStamina(cid)) + (config.staminaRefuel * 60 * 60)) doSendMagicEffect(getThingPos(cid), 52) doPlayerAddPremiumDays(cid, config.premiumDays) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Parabens! Voce acabou de receber um dia de GOLD CARD.") doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce ainda nao pode usar.") end return true end Boa sorte, caso não dê bolo um script pra você aqui. Abraços. Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
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.