Ir para conteúdo
  • 0

Effect Pos.x Pos.y (Math.random)


lukervis

Pergunta

Opa, estou com uma pequena dúvida a respeito de um effect

 

 

 

 

function onThink(cid, interval)

if getPlayerLevel(cid) >= 400 then

local position = getPlayerPosition(cid)

local time = 1

local effectPositions = {

{x = pos.x, y = pos.y - 1, z = pos.z},

{x = pos.x, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y, z = pos.z},

{x = pos.x + 1, y = pos.y, z = pos.z},

{x = pos.x - 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y + 1, z = pos.z}

}

 

for i = 1, 6 do

doSendMagicEffect(effectPositions[math.random(#effectPositions)](4))

doSendMagicEffect(effectPositions[math.random(#effectPositions)](34))

month = addEvent(SayText, time * 1000 / 2, cid)

end

end

 

return true

end

 

 

O script basicamente seria esse, só que aqui no distro, teve vários atritos, gostaria que alguém arrumasse para mim, antes que perguntem, o effect 4 e o 34 sairiam no mesmo position, se não entender como o script funciona, me pergunte ..

 

Desde já, agradecido ..

Editado por luakao
Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

Uma outra coisa, existiria a possibilidade da aura continuar mesmo o player deslogando ? somente quando ele dissesse !aura off ela parava ?

 

 

EDIT@:

 

Tem um pequeno detalhe, a pessoa consegue falar !aura on várias vezes, ou seja, colocando várias auras ...

Editado por luakao
Link para o comentário
Compartilhar em outros sites

  • 0

tenta esse

local time = 5 -- 1 = 1 sec, 2 = 2 sec, ...

 

local say_events = {}

local function SayText1(cid)

if isPlayer(cid) == TRUE then

if say_events[getPlayerGUID(cid)] ~= nil then

local pos = getPlayerPosition(cid)

 

local effectPositions = {

{x = pos.x, y = pos.y - 1, z = pos.z},

{x = pos.x, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y, z = pos.z},

{x = pos.x + 1, y = pos.y, z = pos.z},

{x = pos.x - 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y + 1, z = pos.z}

}

 

k = math.random(#effectPositions)

 

doSendMagicEffect(effectPositions[k],4)

doSendMagicEffect(effectPositions[k],34)

 

 

say_events[getPlayerGUID(cid)] = addEvent(SayText1, time * 1000 / 2, cid)

end

end

return TRUE

end

function onSay(cid, words, param, channel)

if getPlayerVocation(cid) == (id da voc) then ------aki configura a voc

if(param == '') then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")

return true

end

if param == "on" then

setPlayerStorageValue(cid,50001,1)

getPlayerStorageValue(cid,50001)

if isPlayer(cid) == TRUE then

local pos = getPlayerPosition(cid)

 

local effectPositions = {

{x = pos.x, y = pos.y - 1, z = pos.z},

{x = pos.x, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y, z = pos.z},

{x = pos.x + 1, y = pos.y, z = pos.z},

{x = pos.x - 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y + 1, z = pos.z}

}

 

k = math.random(#effectPositions)

 

doSendMagicEffect(effectPositions[k],4)

doSendMagicEffect(effectPositions[k],34)

end

say_events[getPlayerGUID(cid)] = addEvent(SayText1, time * 1000, cid)

doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"aura was been actived.")

elseif param == "off" then

setPlayerStorageValue(cid,50001,-1)

stopEvent(say_events[getPlayerGUID(cid)])

say_events[getPlayerGUID(cid)] = nil

doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"aura was been desactived.")

end

return TRUE

end

end

Link para o comentário
Compartilhar em outros sites

  • 0

tenta assim

 

 

local time = 5 -- 1 = 1 sec, 2 = 2 sec, ...

 

local say_events = {}

local function SayText1(cid)

if isPlayer(cid) == TRUE then

if say_events[getPlayerGUID(cid)] ~= nil then

local pos = getPlayerPosition(cid)

 

local effectPositions = {

{x = pos.x, y = pos.y - 1, z = pos.z},

{x = pos.x, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y, z = pos.z},

{x = pos.x + 1, y = pos.y, z = pos.z},

{x = pos.x - 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y + 1, z = pos.z}

}

 

k = math.random(#effectPositions)

 

doSendMagicEffect(effectPositions[k],4)

doSendMagicEffect(effectPositions[k],34)

 

 

say_events[getPlayerGUID(cid)] = addEvent(SayText1, time * 1000 / 2, cid)

end

end

return TRUE

end

function onSay(cid, words, param, channel)

if getPlayerVocation(cid) == (id da voc) then ------aki configura a voc

if(param == '') then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")

return true

end

if param == "on" then

if say_events[getPlayerGUID(cid)] ~= nil then

return false

end

if isPlayer(cid) == TRUE then

local pos = getPlayerPosition(cid)

 

local effectPositions = {

{x = pos.x, y = pos.y - 1, z = pos.z},

{x = pos.x, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y, z = pos.z},

{x = pos.x + 1, y = pos.y, z = pos.z},

{x = pos.x - 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y - 1, z = pos.z},

{x = pos.x + 1, y = pos.y + 1, z = pos.z},

{x = pos.x - 1, y = pos.y + 1, z = pos.z}

}

 

k = math.random(#effectPositions)

 

doSendMagicEffect(effectPositions[k],4)

doSendMagicEffect(effectPositions[k],34)

end

say_events[getPlayerGUID(cid)] = addEvent(SayText1, time * 1000, cid)

doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"aura was been actived.")

elseif param == "off" then

stopEvent(say_events[getPlayerGUID(cid)])

say_events[getPlayerGUID(cid)] = nil

doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"aura was been desactived.")

end

return TRUE

end

end

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...