Postado Fevereiro 24, 2013 12 anos Pessoal, seguinte eu estou desenvolvendo um script que está mais pra evento mesmo kkk, esse é evento é como se fosse um campeonato, onde ele vai pegar aleatoriamente 2 players, teleporta pra uma salinha falar "Proxima luta: fulano e sicrano" e depois de 20 segundos teleportas os dois pra a arena e pá. Até ai tudo bem, mas no script quando eu vou com o god e falo "!champion open" ele manda a broadcast "champion event aberto...." retira as pedras da entrada do lugar do evento, faz tudo bonitinho da função abrir() mas quando vai pra a segunda função ( gladiar() ) que está em um addEvent ele não executa :/ acho que tem algo errado no addEvent, aqui está o código: (desculpe a falta de organização do script é que ainda to aprendendo) function onSay(cid, words, param, channel) aberto = getGlobalStorageValue(4000) acess = getPlayerAccess(cid) timetotp = 20 timetostart = 20 gatepos1 = {x=32399, y=32211, z=7, stackpos=1} -- Lugar do item q vai tirar gatepos2 = {x=32400, y=32211, z=7, stackpos=1} -- Lugar do item q vai tirar gatepos3 = {x=32401, y=32211, z=7, stackpos=1} -- Lugar do item q vai tirar getgate1 = getThingfromPos(gatepos1) getgate2 = getThingfromPos(gatepos2) getgate3 = getThingfromPos(gatepos3) if acess == 1 then -- COMANDO PARA OS PLAYERS if aberto == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O evento Champion Hero não esta aberto!") return true else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O evento Champion Hero esta aberto!") return true end else if param == "open" then if aberto == 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "O evento Champion Hero ja esta aberto!") return true else -- ABRINDO O EVENTO abrir() addEvent(gladiar, 20 * 1000) end elseif param == "close" then -- FECHANDO O EVENTO win = getGlobalStorageValue(4002) fechar(win) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Parametro invalido!") end end return true end function abrir() doBroadcastMessage("O evento Champion Hero comecou! quem quiser participar va para a area de eventos em Thais!") doRemoveItem(getgate1.uid,1) doRemoveItem(getgate2.uid,1) doRemoveItem(getgate3.uid,1) doSendMagicEffect(getgate1.uid,2) doSendMagicEffect(getgate2.uid,2) doSendMagicEffect(getgate3.uid,2) setGlobalStorageValue(4003, 3) setGlobalStorageValue(4000, 1) return true end function fechar(win) local players = {} local pos = {x=32369, y=32241, z=7} -- posição do templo local storage = 4001 for _, pid in pairs (getPlayersOnline()) do if getPlayerStorageValue(pid, storage) >= 1 then setPlayerStorageValue(pid, storage, 0) table.insert(players, pid) end end if #players > 1 then for i = 1, #players do doTeleportThing(players[i], pos) end end doCreateItem(1285, gatepos1) doCreateItem(1285, gatepos2) doCreateItem(1285, gatepos3) doBroadcastMessage("O evento Champion Hero esta fechado e teve como campeao "..win.." !") setGlobalStorageValue(4000, 0) return true end function guerriar(rodada) local players = {} local storage = 4001 escolhidos = rodada+1 arenapos = {x= 32399,y= 32203,z= 7} for _, pid in pairs (getPlayersOnline()) do if getPlayerStorageValue(pid, storage) == rodada then table.insert(players, pid) end end if #players > 1 then doBroadcastMessage("Os proximos a gladiarem serao:\n") for i = 1, 2 do escolhido = math.random(1,#players) doTeleportThing(players[i], arenapos) setPlayerStorageValue(players[i],4001,escolhidos) doBroadcastMessage(" "..getCreatureName(players[i]).." \n") addEvent(teleportar, timetotp * 1000,escolhidos) -- TEMPO PARA TELEPORTAR end if #player == 1 then setPlayerStorageValue(pid, storage, escolhidos) end end return end function teleportar(escolhidos) local players = {} arena = {x= 32396,y= 32198,z= 7} for _, pid in pairs (getPlayersOnline()) do if getPlayerStorageValue(pid, storage) == escolhidos then table.insert(players, pid) end end if #players > 1 then for i = 1, #players do doTeleportThing(players[i], arena) end doBroadcastMessage("Fight!") end end function gladiar() local gatepass1 = {x=32402, y=32208, z=7, stackpos=1} -- Lugar do item q vai aparecer local getpass1 = getThingfromPos(gatepass1) doCreateItem(1285, gatepass1) rodada = getGlobalStorageValue(4003) local tabelaplayers = {} local storage = 4001 for _, pid in pairs (getPlayersOnline()) do if getPlayerStorageValue(pid, storage) >= rodada then table.insert(tabelaplayers, pid) end end while #tabelaplayers > 1 do -- FICA NO LOOPING ATÉ SOBRAR SOMENTE 1 PLAYER! guerriar(rodada) local tabelaplayers = {} local storage = 4001 for _, pid in pairs (getPlayersOnline()) do if getPlayerStorageValue(pid, storage) >= rodada then table.insert(tabelaplayers, pid) end end rodada = rodada+1 end if #tabelaplayers == 1 then setGlobalStorageValue(4002,(getCreatureName(pid))) voc = getPlayerVocation(pid) -- PRÊMIOS dinheiro = getPlayerLevel(cid) local new_item = doPlayerAddItem(tid, 5785) doItemSetAttribute(new_item, "description", ''..getCreatureName(pid)..' Ganhou esta medalha no Champion Hero!') local bag = doPlayerAddItem(cid,1987,1) doAddContainerItem(bag,2160,dinheiro) doAddContainerItem(bag,2168,1) if voc == 1 or voc == 5 or voc == 2 or voc == 6 then aleatorio = {16112,8266,10220,11356,15489} premio = math.random(1,5) doAddContainerItem(bag,aleatorio[premio],1) elseif voc == 3 or voc == 7 then aleatorio = {2500,8891,9777,12645,8888} premio = math.random(1,5) doAddContainerItem(bag,aleatorio[premio],1) elseif voc == 4 or voc == 8 then aleatorio = {12642,8930,2504,12646,2522} premio = math.random(1,5) doAddContainerItem(bag,aleatorio[premio],1) win = getGlobalStorageValue(4002) end end doRemoveItem(getpass1.uid,1) end Cansado de ot normal? O único onde a etimologia dos players são diferentes! http://xingocity.servegame.com
Postado Fevereiro 25, 2013 12 anos Autor @up Cansado de ot normal? O único onde a etimologia dos players são diferentes! http://xingocity.servegame.com
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.