Postado Janeiro 23, 2015 10 anos Sou leigo nisso brother ;|.. onde colocaria essa Tag sua? No caso seria no NPC. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg:lower(), "arena") or msgcontains(msg:lower(), "enter") then if isThereSomeone(ARENA.fromPos, ARENA.toPos) then selfSay("Someone is at the arena right now, please wait.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then selfSay("You already completed the arena.", cid) talkState[talkUser] = 0 return true else selfSay("You really want enter in the arena? It will cost you {"..ARENA.NPC.price.."}.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if getGlobalStorageValue(1000) == -1 then if doPlayerRemoveMoney(cid, ARENA.NPC.price * 100) then selfSay("Good luck! ^.^", cid) setGlobalStorageValue(1000, 1) doTeleportThing(cid, ARENA.NPC.position) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, 1) doWave(cid, 1) talkState[talkUser] = 0 return true else selfSay("You do not have enough money.", cid) talkState[talkUser] = 0 return true end else selfSay("Ocupado!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, then...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Já tem uma função que verifica caso haja um jogador na arena. Por Global Storage é mais fácil. Não esqueça de colocar em algum lugar pra remover a Global Storage que se ganha ao entrar na arena.
Postado Janeiro 23, 2015 10 anos Pronto, alterei o NPC com level mínimo para entrar na arena. Estranho não estar funcionando a função que fiz, mas enfim. Faça como o Frenesy disse: checagem por global storage. não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 23, 2015 10 anos Autor @Frenesy Usei o seu "Npc" e ele impediu que outro players entrasse, porém, depois, sempre o "npc" fala que ta ocupado >.< ( mesmo não tando).. Você me disse para colocar remove storage, onde seria isso? :|. @zipter98 Usei o seu Novo "Npc", porém, quando falo "Arena" , da esse erro na distro. Eu te Ajudei? Então solta aquele REP+ !! Meus Tutoriais: [Tutorial] Bug "Temple position is wrong" (MySql) Outros: [Meu Show OFF | Mapa próprio 8.6]
Postado Janeiro 23, 2015 10 anos Usei o seu "Npc" e ele impediu que outro players entrasse, porém, depois, sempre o "npc" fala que ta ocupado >.< ( mesmo não tando).. Você me disse para colocar remove storage, onde seria isso? :|. É como eu te disse, precisa remover a Global Storage na hora que o player sai da arena pra poder entrar outros player. Se você não remover, o NPC sempre dirá que está ocupado.
Postado Janeiro 23, 2015 10 anos Esqueci de avisar, mas eu também alterei a lib. Sem essa alteração, vai dar erro no NPC mesmo. Abaixo de: delay = 15, --Segundos para o boss aparecer. adicione: level = 100, --Level mínimo. Sobre a remoção da storage global: altere seu creaturescript para este: function onKill(cid, target) if isPlayer(target) and getPlayerStorageValue(target, ARENA.STORAGES.wave_sto) > -1 then setPlayerStorageValue(target, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) elseif isPlayer(cid) and getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) > -1 then local new_wave = getPlayerStorageValue(cid, ARENA.STORAGES.wave_sto) + 1 if ARENA.WAVES[new_wave] then setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, new_wave) doWave(cid, new_wave) else local tp = doCreateTeleport(ARENA.TELEPORT.tpId, ARENA.TELEPORT.tpToPos, ARENA.TELEPORT.tpPos) doItemSetAttribute(tp, "aid", ARENA.TELEPORT.aid) end end return true end function onLogout(cid) if isInArea(getThingPos(cid), ARENA.fromPos, ARENA.toPos) then doPlayerSendCancel(cid, "You can't logout now.") return false end return true end e seu movement para este: function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true end setPlayerStorageValue(cid, ARENA.STORAGES.storage, 1) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, -1) setGlobalStorageValue(1000, -1) addEvent(function() if getTileItemById(position, ARENA.TELEPORT.tpId).uid > 0 then doRemoveItem(getTileItemById(position, ARENA.TELEPORT.tpId).uid, 1) end end, 50) return true end E o novo NPC: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg:lower(), "arena") or msgcontains(msg:lower(), "enter") then if getPlayerLevel(cid) < ARENA.level then selfSay("You do not have enough level ["..ARENA.level.."].", cid) talkState[talkUser] = 0 return true elseif isThereSomeone(ARENA.fromPos, ARENA.toPos) or getGlobalStorageValue(1000) > -1 then selfSay("Someone is at the arena right now, please wait.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, ARENA.STORAGES.storage) > -1 then selfSay("You already completed the arena.", cid) talkState[talkUser] = 0 return true else selfSay("You really want enter in the arena? It will cost you {"..ARENA.NPC.price.."}.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, ARENA.NPC.price * 100) then selfSay("Good luck! ^.^", cid) doTeleportThing(cid, ARENA.NPC.position) setPlayerStorageValue(cid, ARENA.STORAGES.wave_sto, 1) setGlobalStorageValue(1000, 1) doWave(cid, 1) talkState[talkUser] = 0 return true else selfSay("You do not have enough money.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, then...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 23, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
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.