Postado Julho 9, 2020 4 anos Bom dia pessoal, olha eu de novo ai :D Então, dessa vez irei pedir uma ajuda, pois ja tentei de tudo. tenho um evento chamado war Arena, nele são divididos 2 times(vermelho, azul), e o nome ja diz war arena, entao o objetivo é matar o outro time. bem... até ai tudo bem, o evento esta em perfeito estado, mas sendo que se eu entrar com 1 player no evento, ele fica preso la dentro, pois o sistema não reconhece que ele sobrou na war, pois não matou ninguém. gostaria de pedir para implementar no meu script uma função para anular o evento quando tiver 1 ou 0 players na sala de espera. abaixo o script globalevents: local configWar = { MessageType = MESSAGE_INFO_DESCR, wallPos = {x=512,y=846,z=5,stackpos=1}, wallPos1 = {x=513,y=846,z=5,stackpos=1}, wallPos2 = {x=513,y=847,z=5,stackpos=1}, wallPos3 = {x=513,y=848,z=5,stackpos=1}, wallPos4 = {x=513,y=849,z=5,stackpos=1}, wallPos5 = {x=512,y=849,z=5,stackpos=1}, AccessMessage = "Only Gods and Gamemasters can execute an event!", FirstMessage = "Event Notice!", SecondMessage = "War Arena has been opened to join go through the portal on the top floor of depot.", ThirdMessage = "War Arena will begin in 5 minutes!", FourthMessage = "War Arena will begin in 3 minutes!", ClosingMessage = "War Arena will close and begin in 1 minute!", CloseMessage = "War Arena portal has closed and the event has begun!" } local waitingRoomFrompos = {x=617, y=625, z=7, stackpos=253} local waitingRoomTopos = {x=652, y=654, z=7, stackpos=253} --Functions for war. function EventNotice11(cid) addEvent(EventNotice21,5000,cid) doBroadcastMessage(configWar.FirstMessage,configWar.MessageType) end function EventNotice21(cid) addEvent(EventNotice31,10*1000,cid) doBroadcastMessage(configWar.SecondMessage,configWar.MessageType) end function EventNotice31(cid) addEvent(EventNotice41,120*1000,cid) doBroadcastMessage(configWar.ThirdMessage,configWar.MessageType) end function EventNotice41(cid) addEvent(EventNotice51,120*1000,cid) doBroadcastMessage(configWar.FourthMessage,configWar.MessageType) end function EventNotice51(cid) addEvent(EventNotice61,60*1000,cid) doBroadcastMessage(configWar.ClosingMessage,configWar.MessageType) end function EventNotice61(cid) doCreateItem(1600,1,configWar.wallPos) doCreateItem(1595,1,configWar.wallPos1) doCreateItem(1596,1,configWar.wallPos2) doCreateItem(1596,1,configWar.wallPos3) doCreateItem(1601,1,configWar.wallPos4) doCreateItem(1600,1,configWar.wallPos5) doBroadcastMessage(configWar.CloseMessage,configWar.MessageType) addEvent(BeginWAR,5*1000,cid) end --Start for War Event function BeginWAR(cid) for _, pid in ipairs(getPlayersOnline()) do if isInArea(getPlayerPosition(pid), waitingRoomFrompos, waitingRoomTopos) then doTeleportThing(pid, {x=635,y=614,z=7,stackpos=1}, false) end end end function SetEventWAR(cid) setGlobalStorageValue(1005, 0)--WAR end local WAR = 0 local eventType = getGlobalStorageValue(1005) function onThink(cid, item, fromPosition, toPosition) if getGlobalStorageValue(1005) <= WAR then doRemoveItem(getThingFromPos(configWar.wallPos).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos1).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos2).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos3).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos4).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos5).uid,1) setGlobalStorageValue(1005, 1) setGlobalStorageValue(2001, 0) setGlobalStorageValue(2002, 0) addEvent(EventNotice11,2000,cid) setGlobalStorageValue(28000, os.time(t)) else doBroadcastMessage('Event System:\nEvent System Error, Please notify staff.') end return 1 end
Postado Julho 9, 2020 4 anos 11 horas atrás, Lisbeky disse: Bom dia pessoal, olha eu de novo ai ? Então, dessa vez irei pedir uma ajuda, pois ja tentei de tudo. tenho um evento chamado war Arena, nele são divididos 2 times(vermelho, azul), e o nome ja diz war arena, entao o objetivo é matar o outro time. bem... até ai tudo bem, o evento esta em perfeito estado, mas sendo que se eu entrar com 1 player no evento, ele fica preso la dentro, pois o sistema não reconhece que ele sobrou na war, pois não matou ninguém. gostaria de pedir para implementar no meu script uma função para anular o evento quando tiver 1 ou 0 players na sala de espera. abaixo o script globalevents: Spoiler local configWar = { MessageType = MESSAGE_INFO_DESCR, wallPos = {x=512,y=846,z=5,stackpos=1}, wallPos1 = {x=513,y=846,z=5,stackpos=1}, wallPos2 = {x=513,y=847,z=5,stackpos=1}, wallPos3 = {x=513,y=848,z=5,stackpos=1}, wallPos4 = {x=513,y=849,z=5,stackpos=1}, wallPos5 = {x=512,y=849,z=5,stackpos=1}, AccessMessage = "Only Gods and Gamemasters can execute an event!", FirstMessage = "Event Notice!", SecondMessage = "War Arena has been opened to join go through the portal on the top floor of depot.", ThirdMessage = "War Arena will begin in 5 minutes!", FourthMessage = "War Arena will begin in 3 minutes!", ClosingMessage = "War Arena will close and begin in 1 minute!", CloseMessage = "War Arena portal has closed and the event has begun!" } local waitingRoomFrompos = {x=617, y=625, z=7, stackpos=253} local waitingRoomTopos = {x=652, y=654, z=7, stackpos=253} --Functions for war. function EventNotice11(cid) addEvent(EventNotice21,5000,cid) doBroadcastMessage(configWar.FirstMessage,configWar.MessageType) end function EventNotice21(cid) addEvent(EventNotice31,10*1000,cid) doBroadcastMessage(configWar.SecondMessage,configWar.MessageType) end function EventNotice31(cid) addEvent(EventNotice41,120*1000,cid) doBroadcastMessage(configWar.ThirdMessage,configWar.MessageType) end function EventNotice41(cid) addEvent(EventNotice51,120*1000,cid) doBroadcastMessage(configWar.FourthMessage,configWar.MessageType) end function EventNotice51(cid) addEvent(EventNotice61,60*1000,cid) doBroadcastMessage(configWar.ClosingMessage,configWar.MessageType) end function EventNotice61(cid) doCreateItem(1600,1,configWar.wallPos) doCreateItem(1595,1,configWar.wallPos1) doCreateItem(1596,1,configWar.wallPos2) doCreateItem(1596,1,configWar.wallPos3) doCreateItem(1601,1,configWar.wallPos4) doCreateItem(1600,1,configWar.wallPos5) doBroadcastMessage(configWar.CloseMessage,configWar.MessageType) addEvent(BeginWAR,5*1000,cid) end --Start for War Event function BeginWAR(cid) if (getPlayersOnline() <= 1) then doTeleportThing(pid,getTownTemplePosition(1)) doBroadcastMessage('Event System:\nEvento nao foi iniciado por falta de jogadores.') return false end for _, pid in ipairs(getPlayersOnline()) do if isInArea(getPlayerPosition(pid), waitingRoomFrompos, waitingRoomTopos) then doTeleportThing(pid, {x=635,y=614,z=7,stackpos=1}, false) end end end function SetEventWAR(cid) setGlobalStorageValue(1005, 0)--WAR end local WAR = 0 local eventType = getGlobalStorageValue(1005) function onThink(cid, item, fromPosition, toPosition) if getGlobalStorageValue(1005) <= WAR then doRemoveItem(getThingFromPos(configWar.wallPos).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos1).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos2).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos3).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos4).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos5).uid,1) setGlobalStorageValue(1005, 1) setGlobalStorageValue(2001, 0) setGlobalStorageValue(2002, 0) addEvent(EventNotice11,2000,cid) setGlobalStorageValue(28000, os.time(t)) else doBroadcastMessage('Event System:\nEvent System Error, Please notify staff.') end return 1 end Testá aí e me diz se funcionou.
Postado Julho 9, 2020 4 anos Autor obrigado meu amigo! mas infelizmente deu erro... vou enviar o erro para vc dar uma olhada: [24/07/2020 20:04:10] [Error - GlobalEvent Interface] [24/07/2020 20:04:10] In a timer event called from: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:onThink [24/07/2020 20:04:10] Description: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:116: attempt to compare table with number [24/07/2020 20:04:10] stack traceback: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:116: in function <data/globalevents/scripts/war_event.lua:114>
Postado Julho 9, 2020 4 anos Solução 18 minutos atrás, Lisbeky disse: obrigado meu amigo! mas infelizmente deu erro... vou enviar o erro para vc dar uma olhada: [24/07/2020 20:04:10] [Error - GlobalEvent Interface] [24/07/2020 20:04:10] In a timer event called from: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:onThink [24/07/2020 20:04:10] Description: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:116: attempt to compare table with number [24/07/2020 20:04:10] stack traceback: [24/07/2020 20:04:10] data/globalevents/scripts/war_event.lua:116: in function <data/globalevents/scripts/war_event.lua:114> Dê nada, se eu conseguir lhe ajudar já fico feliz. Spoiler local configWar = { MessageType = MESSAGE_INFO_DESCR, wallPos = {x=512,y=846,z=5,stackpos=1}, wallPos1 = {x=513,y=846,z=5,stackpos=1}, wallPos2 = {x=513,y=847,z=5,stackpos=1}, wallPos3 = {x=513,y=848,z=5,stackpos=1}, wallPos4 = {x=513,y=849,z=5,stackpos=1}, wallPos5 = {x=512,y=849,z=5,stackpos=1}, playerCount = 1511, playersNeededToStartEvent = 4, AccessMessage = "Only Gods and Gamemasters can execute an event!", FirstMessage = "Event Notice!", SecondMessage = "War Arena has been opened to join go through the portal on the top floor of depot.", ThirdMessage = "War Arena will begin in 5 minutes!", FourthMessage = "War Arena will begin in 3 minutes!", ClosingMessage = "War Arena will close and begin in 1 minute!", CloseMessage = "War Arena portal has closed and the event has begun!" } setGlobalStorageValue(configWar.playerCount, 0) local waitingRoomFrompos = {x=617, y=625, z=7, stackpos=253} local waitingRoomTopos = {x=652, y=654, z=7, stackpos=253} --Functions for war. function EventNotice11(cid) addEvent(EventNotice21,5000,cid) doBroadcastMessage(configWar.FirstMessage,configWar.MessageType) end function EventNotice21(cid) addEvent(EventNotice31,10*1000,cid) doBroadcastMessage(configWar.SecondMessage,configWar.MessageType) end function EventNotice31(cid) addEvent(EventNotice41,120*1000,cid) doBroadcastMessage(configWar.ThirdMessage,configWar.MessageType) end function EventNotice41(cid) addEvent(EventNotice51,120*1000,cid) doBroadcastMessage(configWar.FourthMessage,configWar.MessageType) end function EventNotice51(cid) addEvent(EventNotice61,60*1000,cid) doBroadcastMessage(configWar.ClosingMessage,configWar.MessageType) end function EventNotice61(cid) doCreateItem(1600,1,configWar.wallPos) doCreateItem(1595,1,configWar.wallPos1) doCreateItem(1596,1,configWar.wallPos2) doCreateItem(1596,1,configWar.wallPos3) doCreateItem(1601,1,configWar.wallPos4) doCreateItem(1600,1,configWar.wallPos5) doBroadcastMessage(configWar.CloseMessage,configWar.MessageType) addEvent(BeginWAR,5*1000,cid) end --Start for War Event function BeginWAR(cid) if getGlobalStorageValue(configWar.playerCount) >= configWar.playersNeededToStartEvent then doBroadcastMessage('Event System:\nEvento nao foi iniciado por falta de jogadores.') doTeleportThing(pid,getTownTemplePosition(1)) return false end for _, pid in ipairs(getPlayersOnline()) do if isInArea(getPlayerPosition(pid), waitingRoomFrompos, waitingRoomTopos) then doTeleportThing(pid, {x=635,y=614,z=7,stackpos=1}, false) end end end function SetEventWAR(cid) setGlobalStorageValue(1005, 0)--WAR end local WAR = 0 local eventType = getGlobalStorageValue(1005) function onThink(cid, item, fromPosition, toPosition) if getGlobalStorageValue(1005) <= WAR then doRemoveItem(getThingFromPos(configWar.wallPos).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos1).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos2).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos3).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos4).uid,1) doRemoveItem(getThingFromPos(configWar.wallPos5).uid,1) setGlobalStorageValue(1005, 1) setGlobalStorageValue(2001, 0) setGlobalStorageValue(2002, 0) addEvent(EventNotice11,2000,cid) setGlobalStorageValue(28000, os.time(t)) else doBroadcastMessage('Event System:\nEvent System Error, Please notify staff.') end return 1 end
Postado Julho 10, 2020 4 anos Autor @cs007 , testei aqui meu amigo, mas o player foi para o evento mesmo sozinho se vc disser que errou la no playersNeededToStartEvent = 4, eu já fiz a correção para 2 e mesmo assim não deu tem alguma outra sugestão?
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.