Ir para conteúdo

(Resolvido)[AJUDA] Script p/ soltar efeito no top level

Featured Replies

Postado
eae Galera, eu preciso de ajuda eu comecei este script só que não to conseguindo terminar, este script é para sair um efeito no top level. quem conseguir me ajuda ai.
local function getTop() -- projeto bay João Vitor
 
  local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
 if (query:getID() ~= -1) then
  return {query:getDataInt("level")}
  end
 
  return false
end
 
 
function sendEffect(cid)
                if isCreature(cid) then
                local pos = getCreaturePosition(cid)
                local x = math.random(pos.x-1,pos.x+1)
                local y = math.random(pos.y-1,pos.y+1)
                doSendMagicEffect({x=x,y=y,z=pos.z}, 4)
                doSendMagicEffect({x=x,y=y,z=pos.z}, 34)
                addEvent(sendEffect,2000,cid)
        end
end
 
 
function onLogin(cid, skill, oldLevel, newLevel)
 
       local top = getTop()
if skill == 8 then
if newLevel == top[1] and getCreatureName(cid) == top[1] then
sendEffect(cid)
end
        end
        registerCreatureEvent(cid, "LoginEffect")
        return TRUE
end
 
function onAdvance(cid, skill, oldLevel, newLevel)
 
       local Top = getTop()
        if skill == 8 then
       if skill == SKILL__LEVEL and newLevel > top[2] then
                            sendEffect(cid)
        end
        return TRUE
end
end
 

Resolvido por joaogtx

Ir para solução
  • Respostas 6
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Putz cara, você não conseguiu nem começar =s

  • local function getTop() local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;") if (query:getID() ~= -1) then

Postado

Não precisava ter criado 3 tópicos iguais... testa agora:

local function getTop()
local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
	if (query:getID() ~= -1) then
		return {query:getDataInt("level")}
	end
return false
end

function sendEffect(cid)
	if isCreature(cid) then
		local pos = getCreaturePosition(cid)
		local x = math.random(pos.x-1,pos.x+1)
		local y = math.random(pos.y-1,pos.y+1)
		doSendMagicEffect({x=x,y=y,z=pos.z}, 4)
		doSendMagicEffect({x=x,y=y,z=pos.z}, 34)
		addEvent(sendEffect,2000,cid)
	end
end

function onLogin(cid, skill, oldLevel, newLevel)
	local top = getTop()
	if getPlayerLevel(cid) > top[2] then
		sendEffect(cid)
	end
return true
end

function onAdvance(cid, skill, oldLevel, newLevel)
local top = getTop()
	if skill == SKILL__LEVEL and newLevel > top[2] then
		sendEffect(cid)
	end
return true
end

Postado
  • Autor

Vlw xWhiteWolf por ta me ajudando, pelo-menos vc não é como certas pessoas que só aparecem pra criticar. como Absolute, em vez de jugar porque não disse oque acha que taria errado para que possamos concertar, acho que ele nem intendeu o código é um porq sabe nada de script. Só xWhiteWolf mano que ta dando um erro ao abrir o server  [Error - CreatureScript Interface] 

[29/12/2014 11:03:32] data/creaturescripts/scripts/LvlEffect.lua:onLogin
[29/12/2014 11:03:32] Description: 
[29/12/2014 11:03:32] data/creaturescripts/scripts/LvlEffect.lua:22: attempt to compare nil with number
[29/12/2014 11:03:32] stack traceback:
[29/12/2014 11:03:32] data/creaturescripts/scripts/LvlEffect.lua:22: in function <data/creaturescripts/scripts/LvlEffect.lua:20>
 
vou ver se concerto. mais se poderem me ajudar galera estou precisando de ajuda. 
Postado
local function getTop()
local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
	if (query:getID() ~= -1) then
		return {query:getDataInt("level")}
	end
return false
end

function sendEffect(cid)
	if isCreature(cid) then
		local pos = getCreaturePosition(cid)
		local x = math.random(pos.x-1,pos.x+1)
		local y = math.random(pos.y-1,pos.y+1)
		doSendMagicEffect({x=x,y=y,z=pos.z}, 4)
		doSendMagicEffect({x=x,y=y,z=pos.z}, 34)
		addEvent(sendEffect,2000,cid)
	end
end

function onLogin(cid, skill, oldLevel, newLevel)
	local top = getTop()
	if getPlayerLevel(cid) >= top[1] then
		sendEffect(cid)
	end
return true
end

function onAdvance(cid, skill, oldLevel, newLevel)
local top = getTop()
	if skill == SKILL__LEVEL and newLevel > top[1] then
		sendEffect(cid)
	end
return true
end

vc tem ctza q esse top[1] é assim msmo? testa ai

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo