Coloquei um sistema de aura pelo Creaturescripts, mas quando o player desloga tá dando um erro no distro, segue em anexo as fotos e meu aura.lua:
Imagem do erro na distro:

Coloquei um sistema de aura pelo Creaturescripts, mas quando o player desloga tá dando um erro no distro, segue em anexo as fotos e meu aura.lua:
Imagem do erro na distro:

Tenta assim:
local tab = {
[6] = {effect = 70},
[7] = {effect = 70},
[8] = {effect = 70},
[9] = {effect = 70},
[10] = {effect = 70},
[11] = {effect = 70},-- [vocationID] = {effect = Number}
[12] = {effect = 70}
}
local delay = 2 -- tempo do efeito da aura em segundos
function onLogin(cid)
if tab[getPlayerVocation(cid)] then
ariseAura(cid, tab[getPlayerVocation(cid)].effect)
end
return true
end
function ariseAura(cid, effect)
if isPlayer(cid) then
doSendMagicEffect(getPlayerPosition(cid), effect)
addEvent(ariseAura, delay * 1000, cid)
end
return true
end
local voc = {6,7,8,9,10,11,12} -- Vocations
local dalay = 2 -- Segundos
local effect = 70 -- Efeito
function ariseAura(cid)
if isInArray(voc, getPlayerVocation(cid)) and isPlayer(cid) then
doSendMagicEffect(getThingPos(cid), effect)
addEvent(ariseAura, delay * 1000, cid)
end
return true
end
function onLogin(cid)
ariseAura(cid)
return true
end

^ como os códigos são interpretados na ordem que estão, haverá erro caso o jogador deslogue.
local tab = {
[6] = {effect = 70},
[7] = {effect = 70},
[8] = {effect = 70},
[9] = {effect = 70},
[10] = {effect = 70},
[11] = {effect = 70},-- [vocationID] = {effect = Number}
[12] = {effect = 70}
}
local delay = 2 -- tempo do efeito da aura em segundos
function ariseAura(cid)
if isPlayer(cid) then
doSendMagicEffect(getThingPos(cid), tab[getPlayerVocation(cid)].effect)
addEvent(ariseAura, delay * 1000, cid)
end
end
function onLogin(cid)
if tab[getPlayerVocation(cid)] then
ariseAura(cid)
end
return true
end
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
Olá, CaioValverde!
local storage_id = 44200
local effect = 70
local delay = 2 -- in seconds (you can also type like 0.5)
local vocations = {6, 7, 8, 9, 10, 11, 12}
-- If is player and storage == 1, add a new event and send effect
-- If is not player or storage ~= 1 or could not send effect, change storage to -1
function doAura(cid)
if not isPlayer(cid) then
return false
end
--[[
-- Você pode criar uma condição. É só colocar nessa parte, por exemplo:
-- Assim a aura só vai aparecer se o player tiver, no mÃnimo, 50% do HP
local low_health = getCreatureHealth(cid) < getCreatureMaxHealth(cid) * (50 / 100)
if low_health then
setPlayerStorageValue(cid, storage_id, -1)
return false
end
]]
return getPlayerStorageValue(cid, storage_id) == 1 and addEvent(doAura, delay * 1000, cid) and doSendMagicEffect(getThingPos(cid), effect) or setPlayerStorageValue(cid, storage_id, -1) and false
end
function doPlayerSendAura(cid)
if not isPlayer(cid) or not isInArray(vocations, getPlayerVocation(cid)) then
return
end
setPlayerStorageValue(cid, storage_id, 1)
doAura(cid)
end
function onLogin(cid)
if getPlayerStorageValue(cid, storage_id) == 1 then
doPlayerSendAura(cid)
end
end
OBS:
Você controla a aura pela storage (1 = ativado, qualquer outro valor = desativado).
Você ativa pelo doPlayerSendAura(cid).
Para desativar a aura, é só usar setPlayerStorageValue(cid, storage_id, -1)
Do modo que está, todos os players sempre terão aura o tempo inteiro durante a storage == 1. Se alterar o valor da storage, a aura pára.
Atenciosamente,
River.
@zipter, testei o seu primeiro, pois já te conhecia... Valeu manin, funcionou... E obrigado a todos !!!
Tópico movido para a seção de dúvidas e pedidos resolvidos.
