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