Postado Julho 23, 2014 10 anos Autor local combat_values = { ["ice"] = 1, ["fire"] = 2, ["earth"] = 3, ["energy"] = 4, ["holy"] = 5, ["death"] = 6, } local config = { storage = 101010, time_storage = 101011, price = 0, delay = 0, msg = { default = "Por favor selecione um dos elementos disponíveis: Ice, Fire, Earth, Energy, Holy ou Death.", help = "Elementos disponíveis: Ice, Fire, Earth, Energy, Holy, Death.", invalid = "Digite um elemento válido! Fale !wand para saber os elementos disponíveis.", changed = "O elemento da wand foi trocado para %s.", nomoney = "Você não possui dinheiro.", delayed = "Você precisa esperar para trocar o efeito.", } } function onSay(cid, words, param) local param = param:lower() local value = combat_values[param] if param == "help" then doPlayerSendCancel(cid, string.format(config.msg.help, config.price)) return end if param == "" then doPlayerSendCancel(cid, string.format(config.msg.default, config.price)) return end if not value then doPlayerSendCancel(cid, config.msg.invalid) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return end if getPlayerStorageValue(cid, config.time_storage) + config.delay > os.time() then doPlayerSendCancel(cid, config.msg.delayed) return end if not (getPlayerItemCount(cid, 23607) >= 1) then doPlayerSendCancel(cid, Você não possui a wand.) return end setPlayerStorageValue(cid, config.storage, value) setPlayerStorageValue(cid, config.time_storage, os.time()) doPlayerRemoveMoney(cid, config.price) doPlayerSendCancel(cid, string.format(config.msg.changed, param)) return end prontinho, faltou colocar um not na frente já que a checagem é pra ver justamente se ele não tem a wand. Heheh.. adivinha? Não funcionou. Pelo menos dessa vez há um erro no console pra dar uma ajudinha (y' [Warning - Event::checkScript] Can not load script: scripts/fg/elemental_wand.lua data/talkactions/scripts/fg/elemental_wand.lua:62: '>' expected near 'nòo' Que trabalho.. e agora? Obs: o script que está apresentando esse erro é esse mesmo que está acima em spoiler, do WhiteWolf Editado Julho 23, 2014 10 anos por ADM Guardian (veja o histórico de edições)
Postado Julho 23, 2014 10 anos local combat_values = { ["ice"] = 1, ["fire"] = 2, ["earth"] = 3, ["energy"] = 4, ["holy"] = 5, ["death"] = 6, } local config = { storage = 101010, time_storage = 101011, price = 0, delay = 0, msg = { default = "Por favor selecione um dos elementos disponíveis: Ice, Fire, Earth, Energy, Holy ou Death.", help = "Elementos disponíveis: Ice, Fire, Earth, Energy, Holy, Death.", invalid = "Digite um elemento válido! Fale !wand para saber os elementos disponíveis.", changed = "O elemento da wand foi trocado para %s.", nomoney = "Você não possui dinheiro.", delayed = "Você precisa esperar para trocar o efeito.", } } function onSay(cid, words, param) local param = param:lower() local value = combat_values[param] if param == "help" then doPlayerSendCancel(cid, string.format(config.msg.help, config.price)) return true end if param == "" then doPlayerSendCancel(cid, string.format(config.msg.default, config.price)) return true end if not value then doPlayerSendCancel(cid, config.msg.invalid) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return true end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return true end if getPlayerStorageValue(cid, config.time_storage) + config.delay > os.time() then doPlayerSendCancel(cid, config.msg.delayed) return true end if not (getPlayerItemCount(cid, 23607) >= 1) then doPlayerSendCancel(cid, "Você não possui a wand".) return true end setPlayerStorageValue(cid, config.storage, value) setPlayerStorageValue(cid, config.time_storage, os.time()) doPlayerRemoveMoney(cid, config.price) doPlayerSendCancel(cid, string.format(config.msg.changed, param)) return true end copiei direto da ana e ela não tinha colocado o "Você não tem wand" entre aspas Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Julho 23, 2014 10 anos Autor Solução local combat_values = { ["ice"] = 1, ["fire"] = 2, ["earth"] = 3, ["energy"] = 4, ["holy"] = 5, ["death"] = 6, } local config = { storage = 101010, time_storage = 101011, price = 0, delay = 0, msg = { default = "Por favor selecione um dos elementos disponíveis: Ice, Fire, Earth, Energy, Holy ou Death.", help = "Elementos disponíveis: Ice, Fire, Earth, Energy, Holy, Death.", invalid = "Digite um elemento válido! Fale !wand para saber os elementos disponíveis.", changed = "O elemento da wand foi trocado para %s.", nomoney = "Você não possui dinheiro.", delayed = "Você precisa esperar para trocar o efeito.", } } function onSay(cid, words, param) local param = param:lower() local value = combat_values[param] if param == "help" then doPlayerSendCancel(cid, string.format(config.msg.help, config.price)) return true end if param == "" then doPlayerSendCancel(cid, string.format(config.msg.default, config.price)) return true end if not value then doPlayerSendCancel(cid, config.msg.invalid) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return true end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return true end if getPlayerStorageValue(cid, config.time_storage) + config.delay > os.time() then doPlayerSendCancel(cid, config.msg.delayed) return true end if not (getPlayerItemCount(cid, 23607) >= 1) then doPlayerSendCancel(cid, "Você não possui a wand".) return true end setPlayerStorageValue(cid, config.storage, value) setPlayerStorageValue(cid, config.time_storage, os.time()) doPlayerRemoveMoney(cid, config.price) doPlayerSendCancel(cid, string.format(config.msg.changed, param)) return true end copiei direto da ana e ela não tinha colocado o "Você não tem wand" entre aspas Agora sim! O script está funcionando perfeito. Rep+ pra você xWhiteWolf! Valeu pela ajuda. Vou apenas adicionar abaixo o script com um pequeno fix no trecho doPlayerSendCancel(cid, "Você não possui a wand".) Observe que o . está fora das aspas. Também vou substituir "return true" por "return" para que os comandos que o player executar não apareçam na tela/chat. Talkaction Script 100% funcional (Créditos: Eu & xWhiteWolf): local combat_values = { ["ice"] = 1, ["fire"] = 2, ["earth"] = 3, ["energy"] = 4, ["holy"] = 5, ["death"] = 6, } local config = { storage = 101010, time_storage = 101011, price = 0, delay = 0, msg = { default = "Por favor selecione um dos elementos disponíveis: Ice, Fire, Earth, Energy, Holy ou Death.", help = "Elementos disponíveis: Ice, Fire, Earth, Energy, Holy, Death.", invalid = "Digite um elemento válido! Fale !wand para saber os elementos disponíveis.", changed = "O elemento da wand foi trocado para %s.", nomoney = "Você não possui dinheiro.", delayed = "Você precisa esperar para trocar o efeito.", } } function onSay(cid, words, param) local param = param:lower() local value = combat_values[param] if param == "help" then doPlayerSendCancel(cid, string.format(config.msg.help, config.price)) return end if param == "" then doPlayerSendCancel(cid, string.format(config.msg.default, config.price)) return end if not value then doPlayerSendCancel(cid, config.msg.invalid) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return end if getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, config.msg.nomoney) return end if getPlayerStorageValue(cid, config.time_storage) + config.delay > os.time() then doPlayerSendCancel(cid, config.msg.delayed) return end if not (getPlayerItemCount(cid, 23607) >= 1) then doPlayerSendCancel(cid, "Você não possui a wand.") return end setPlayerStorageValue(cid, config.storage, value) setPlayerStorageValue(cid, config.time_storage, os.time()) doPlayerRemoveMoney(cid, config.price) doPlayerSendCancel(cid, string.format(config.msg.changed, param)) return end Editado Julho 23, 2014 10 anos por ADM Guardian (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.