local text = {"TOP SEASON"} -- msg
local time = 1 -- tempo para enviar a msg novamente
local effects = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- efeitos aleatorios que saiem
local storage_quest,key = 3423423,1 -- storage da quest pra usar o comando
local storage_OnOff = 3423424 -- storage que salva se ta ou não ativado
local storage_exhaustion,time_exhaustion = 3423425,10 -- tempo para usar o comando novamente
local function doSendMessageAndEffect(cid, position, loop)
if getPlayerStorageValue(cid,storage_OnOff) == 0 then return end -- para de enviar caso desative
doSendAnimatedText(position, text[math.random(#text)], math.random(255))
doSendMagicEffect(position, effects[math.random(#effects)])
if loop then
addEvent(doSendMessageAndEffect,time*1000,cid, getThingPos(cid),true)
end
end
function onSay(cid, words, param)
if getPlayerStorageValue(cid, storage_quest) ~= key then
return doPlayerSendCancel(cid, "You need a storage value.") -- msg caso não tenha a storage
elseif exhaustion.check(cid, storage_exhaustion) then
return doPlayerSendCancel(cid, "Wait ".. exhaustion.get(cid,storage_exhaustion) .." seconds.")
end
--
exhaustion.set(cid,time_exhaustion)
--
if param == "on" then
if getPlayerStorageValue(cid, storage_OnOff ) == 1 then return doPlayerSendCancel(cid, "You have already activated this.") end
doSendMessageAndEffect(cid, getThingPos(cid), true)
setPlayerStorageValue(cid, storage_OnOff, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully activated. To disable, talk /top off")
elseif param == "off" then
if getPlayerStorageValue(cid, storage_OnOff) == 0 then return doPlayerSendCancel(cid, "You can not disable this.") end
setPlayerStorageValue(cid, storage_OnOff, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully disabled. To activate, talk /top on")
elseif (param ~= "on") or (param ~= "off") then
doPlayerSendCancel(cid, "You can activate with the 'on' parameter and deactivate with the 'off'. Example /top on to enable ...")
end
return true
end
Caso sua dúvida foi solucionada, marque a melhor resposta para o tópico ser fechado.