Skrypty & Kody [MOD] Rush Event...

CunAus

Active User
Zarejestrowany
Dołączył
Wrzesień 30, 2015
Posty
74
Liczba reakcji
1
Witam mam problem Z rush event... <> Mianowicie. wszystko sie odpala, przydziela do RED i BLUE .. Lecz gdy zabije to cofa do temple, a nie do Swoich ?wi?ty? gdzie zaczeli zabaw? z eventem.... Prosz? o pomoc.!


Oraz, czy da?oby rad? w tym skrypcie doda? by pokazywa?o na Default Ile pkt ma Blue and Red Team. :D?

"Tutorial do tego Eventu nie kminie w ogole."

[LUA]TUTORIAL Ustawienia zdarzenia UCZESTNICZY? tutaj:
Q - komunikat, kt?ry b?dzie wy?wietlany podczas startu zdarzenia
D_1 - posi?? po raz czerwony zdarzenie come??ar
d_2 - posi?? po raz b??kit zdarzenie come??ar
x - komunikat, kt?ry b?dzie wy?wietlany, gdy zdarzenie nr come??ar
W - posi?? poczekalni, w kt?rej gracze widzie? pobyt przed dostania?
LVL - minimalny poziom, aby uczestniczy? w tym wydarzeniu
V - ilo?? frag?w, kt?re b?d? widzie? siebie necess??ria dla zespo?u, aby wygra?
min - minimalna ilo?? graczy na razie come??ar
m - maksymalna graczy w wypadku
The - komunikat wy?wietlany, gdy czerwona dru?yna wygra
y - komunikat wy?wietlany, gdy niebieski zesp?? zwyci?stwo
i_1 - id nagrody (Teraz crystal coin = 2160)
I_2 - kwota nagrody (teraz 10 kryszta?owych monet)
T - czas come??ar zdarzenie (obecnie jest to 5 minut)
r - czas, w kt?rym wyniki bojowe pokaza? graczom (teraz to 3 minuty)?
[/LUA]


HTML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Rush Event" version="1.0" author="ChaitoSoft.com" contact="suporte@chaitosoft.com" enabled="yes">
  <description>
        TUTORIAL DE COMO CONFIGURAR O EVENTO ACOMPANHE POR AQUI:
      q - mensagem que vai ser exibida quando o evento come?ar
      d_1 - posi??o do tempo vermelho ao come?ar evento
      d_2 - posi??o do tempo azul ao come?ar evento
      x - mensagem que vai ser exibida quando o evento n?o come?ar
      w - posi??o da sala de espera, onde os players v?o ficar antes de come?ar
      lvl - level minimo para participar do evento
      v - a quantidade de frags que ser? necess?ria para o time ganhar
      mn - quantidade minima de players para come?ar o evento
      m - maximo de players dentro do evento
      o - mensagem exibida quando o time vermelho ganhar
      y - mensagem exibida quando o time azul ganhar
      i_1 - id do premio (agora ? crystal coin = 2160)
      i_2 - quantidade do premio (agora esta 10 crystal coins)
      t - tempo para come?ar o evento (agora esta is 5 minutos)
      r - tempo em que os resultados da batalha ser?o mostrados aos players (agora esta 3 minutos)
 
   Adicione isto em 050-function.lua:
   -------------------------------------------------------------------------------------------------
   function doPlayerRemoveLethalConditions(cid)
      local tmp = {1, 2, 4, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
      for i = 1, #tmp do
         if(hasCondition(cid, tmp[i])) then doRemoveCondition(cid, tmp[i]) end
      end
      return true
   end
   -------------------------------------------------------------------------------------------------
   Adicione isto em login.lua:
   -------------------------------------------------------------------------------------------------
   registerCreatureEvent(cid, "RushCombat")
   registerCreatureEvent(cid, "RushAttack")
   registerCreatureEvent(cid, "RushDead")
   registerCreatureEvent(cid, "RushOutfit")
   -------------------------------------------------------------------------------------------------
   Agora daqui pra baixo voc? vai configurar de acordo com o tutorial acima, o resto se n?o tiver
   conhecimento n?o mecha em nada pois poder? bugar o evento e n?o daremos suporte:
  </description>
   <config name="re"><![CDATA[
       t = {
         a = 32145,
         g = 32146,
         l = 32147,
         u = 32148,
         h = 32149,
         wv = 32150,
         c = 0,
         q = "Rush Event zostal rozpoczety, milej zabawy! =)",
         f = 5447,
         f_1 = 5448,
         f_2 = 5449,
         d_1 = {x = 1113, y = 684, z = 7}, -- red temple
         d_2 = {x = 1030, y = 689, z = 7}, -- blue temple
         x = "Event anulowany, poniewaz zbyt malo chetnych os?b do wziecia udzialu.",
         w = {x = 1040, y = 1046, z = 7},
         lvl = 100,
         v = 25,
         mn = 5,
         m = 40,
         o = "Event zakonczony, Team CZERWONYCH wygral walke!",
         y = "Event zakonczony, Team NIEBIESKICH wygral walke!",
         i_1 = 0,
         i_2 = 0,
         t = 3,
         r = 5
      }
   ]]></config>
<globalevent name="Recognition" interval="150000" event="script"><![CDATA[
   domodlib('re')
   function onThink(interval, lastExecution, thinkInterval)
      if(getGlobalStorageValue(t.a) == 1) then
         for _, pid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(pid, t.f) == 1 then
               if(getPlayerStorageValue(pid, t.f_1) == 0) then
                  doSendAnimatedText(getCreaturePosition(pid), "RED TEAM", TEXTCOLOR_RED)
               elseif(getPlayerStorageValue(pid, t.f_1) == 1) then
                  doSendAnimatedText(getCreaturePosition(pid), "BLUE TEAM", TEXTCOLOR_LIGHTBLUE)
               end
            end
         end
         return true
      end
      return true
   end
]]></globalevent>
<talkaction words="!startrush" event="script"><![CDATA[
   domodlib('re')
   function onSay(cid, words, param, channel)
      if getPlayerGroupId(cid) > 3 then
         setGlobalStorageValue(t.g, 1)
         setGlobalStorageValue(t.u, 0)
         setGlobalStorageValue(t.l, 0)
         setGlobalStorageValue(t.a, 1)
         setGlobalStorageValue(t.c, 0)
         setGlobalStorageValue(t.wv, 0)
         doBroadcastMessage("Rush Event: Jesli chcesz dolaczyc wpisz komende: !rush, walka za ".. t.t .." minuty. ", MESSAGE_STATUS_WARNING)
         addEvent(function()
         doBroadcastMessage("Rush Event, startuje za 2 minuty. Jesli chcesz dolaczyc, wpisz komende: !rush", MESSAGE_STATUS_WARNING)
         end, (t.t - 2) * 1000 * 60)
         addEvent(function()
         doBroadcastMessage("Rush Event, startuje za 1 minute. Jesli chcesz dolaczyc, wpisz komende: !rush", MESSAGE_STATUS_WARNING)
         end, (t.t - 1) * 1000 * 60)
         addEvent(start, t.t * 1000 * 60, cid)
         return true
      end
      return true
   end
   function results()
      if(getGlobalStorageValue(t.a) == 1) then
         local red = getGlobalStorageValue(t.l)
         local blue = getGlobalStorageValue(t.u)         
         doBroadcastMessage("Rush Event, wyniki:\nTeam Czerwonych zdobyl: ".. red .." frag?w.\nTeam Niebieskich zdobyl: ".. blue .." frag?w.\nWalka trwa do ".. t.v .." frag?w.", MESSAGE_STATUS_WARNING)
         addEvent(results, t.r * 1000 * 60)
      end
   end
   function start(cid)
      if(getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.c) >= t.mn) then
         doBroadcastMessage(t.q, MESSAGE_STATUS_WARNING)
         setGlobalStorageValue(t.wv, 1)
         addEvent(results, t.r * 1000 * 60)
         for _, pid in ipairs(getPlayersOnline()) do   
            local myOutfit = getCreatureOutfit(pid)
            local red = {lookType = myOutfit.lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
            local blue = {lookType = myOutfit.lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}   
            if getPlayerStorageValue(pid, t.f) == 1 then
               doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
               doCreatureAddMana(pid, getCreatureMaxMana(pid))   
               if((getPlayerStorageValue(pid, t.g) % 2) == 1) then
                  doCreatureChangeOutfit(pid, red)
                  setPlayerStorageValue(pid, t.h, 0)
                  doTeleportThing(pid, t.d_1)
                  setPlayerStorageValue(pid, t.f, 1)
                  setPlayerStorageValue(pid, t.f_1, 0)
                  setPlayerStorageValue(pid, t.f_2, 1)
                  doSendMagicEffect(getCreaturePosition(pid), 10)
                  doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "Jestes w Teamie Czerwonych!\nWalka bedzie trwala do ".. t.v .." frag?w, Powodzenia!")
               else
                  doCreatureChangeOutfit(pid, blue)
                  doTeleportThing(pid, t.d_2)
                  setPlayerStorageValue(pid, t.h, 0)
                  setPlayerStorageValue(pid, t.f, 1)
                  setPlayerStorageValue(pid, t.f_1, 1)
                  setPlayerStorageValue(pid, t.f_2, 0)
                  doSendMagicEffect(getCreaturePosition(pid), 10)
                  doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "Jestes w Teamie Niebieskich!\nWalka bedzie trwala do ".. t.v .." frag?w, Powodzenia!")
               end
            end
         end
      elseif(getGlobalStorageValue(t.c) < t.mn) then
         doBroadcastMessage(t.x, MESSAGE_STATUS_WARNING)
         setGlobalStorageValue(t.a, 0)
         for _, pid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(pid, t.f) == 1 then
               setPlayerStorageValue(pid, t.f, -1)
               doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
               doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
            end
         end
      end
   end
]]></talkaction>
   <globalevent name="RushStart" time="15:53" event="script"><![CDATA[
      domodlib('re')
      function onTime(interval, lastExecution)
         setGlobalStorageValue(t.g, 1)
         setGlobalStorageValue(t.u, 0)
         setGlobalStorageValue(t.l, 0)
         setGlobalStorageValue(t.a, 1)
         setGlobalStorageValue(t.c, 0)
         setGlobalStorageValue(t.wv, 0)
         doBroadcastMessage("Rush Event: Jesli chcesz dolaczyc wpisz komende: !rush, walka za ".. t.t .." minuty.", MESSAGE_STATUS_WARNING)
         addEvent(function()
         doBroadcastMessage("Rush Event, startuje za 2 minuty. Jesli chcesz dolaczyc, wpisz komende: !rush", MESSAGE_STATUS_WARNING)
         end, (t.t - 2) * 1000 * 60)
         addEvent(function()
         doBroadcastMessage("Rush Event, startuje za 1 minute. Jesli chcesz dolaczyc, wpisz komende: !rush", MESSAGE_STATUS_WARNING)
         end, (t.t - 1) * 1000 * 60)
         addEvent(start, t.t * 1000 * 60, cid)
      end
      function results()
         if(getGlobalStorageValue(t.a) == 1) then
            local red = getGlobalStorageValue(t.l)
            local blue = getGlobalStorageValue(t.u)         
            doBroadcastMessage("Rush Event, wyniki:\nTeam Czerwonych zdobyl: ".. red .." frag?w.\nTeam Niebieskich zdobyl: ".. blue .." frag?w.\nWalka trwa do ".. t.v .." frag?w.", MESSAGE_STATUS_WARNING)
            addEvent(results, t.r * 1000 * 60)
         end
      end
      function start(cid)
         if(getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.c) >= t.mn) then
            doBroadcastMessage(t.q, MESSAGE_STATUS_WARNING)
            setGlobalStorageValue(t.wv, 1)
            addEvent(results, t.r * 1000 * 60)
            for _, pid in ipairs(getPlayersOnline()) do   
               local myOutfit = getCreatureOutfit(pid)
               local red = {lookType = myOutfit.lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
               local blue = {lookType = myOutfit.lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}   
               if getPlayerStorageValue(pid, t.f) == 1 then
                  doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
                  doCreatureAddMana(pid, getCreatureMaxMana(pid))   
                  if((getPlayerStorageValue(pid, t.g) % 2) == 1) then
                     doCreatureChangeOutfit(pid, red)
                     setPlayerStorageValue(pid, t.h, 0)
                     doTeleportThing(pid, t.d_1)
                     setPlayerStorageValue(pid, t.f, 1)
                     setPlayerStorageValue(pid, t.f_1, 0)
                     setPlayerStorageValue(pid, t.f_2, 1)
                     doSendMagicEffect(getCreaturePosition(pid), 10)
                     doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "Jestes w Teamie Czerwonych!\nWalka bedzie trwala do ".. t.v .." frag?w, Powodzenia!")
                  else
                     doCreatureChangeOutfit(pid, blue)
                     setPlayerStorageValue(pid, t.h, 0)
                     doTeleportThing(pid, t.d_2)
                     setPlayerStorageValue(pid, t.f, 1)
                     setPlayerStorageValue(pid, t.f_1, 1)
                     setPlayerStorageValue(pid, t.f_2, 0)
                     doSendMagicEffect(getCreaturePosition(pid), 10)
                     doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "Jestes w Teamie Niebieskich!\nWalka bedzie trwala do ".. t.v .." frag?w, Powodzenia!")
                  end
               end
            end
         elseif(getGlobalStorageValue(t.c) < t.mn) then
            doBroadcastMessage(t.x, MESSAGE_STATUS_WARNING)
            setGlobalStorageValue(t.a, 0)
            for _, pid in ipairs(getPlayersOnline()) do
               if getPlayerStorageValue(pid, t.f) == 1 then
                  setPlayerStorageValue(pid, t.f, -1)
                  doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                  doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
               end
            end
         end
      end
   ]]></globalevent>
<talkaction words="!rush" event="script"><![CDATA[
   domodlib('re')
   function onSay(cid, words, param, channel)
      if getGlobalStorageValue(t.a) == 1 and getGlobalStorageValue(t.wv) ~= 1 then
         if getPlayerLevel(cid) >= t.lvl then
            if getPlayerStorageValue(cid, t.f) == -1 then
               if getTilePzInfo(getPlayerPosition(cid)) == true then
                  if getGlobalStorageValue(t.c) < t.m then
                     setGlobalStorageValue(t.c, getGlobalStorageValue(t.c)+1)
                     if getGlobalStorageValue(t.c) == t.m then
                        doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
                     else   
                        doBroadcastMessage("" .. getPlayerName(cid) .. " dolaczyl do Rush Eventu! Wlasciwie mamy: " .. getGlobalStorageValue(t.c) .. " graczy!", 19)
                     end
                     setPlayerStorageValue(cid, t.f, 1)
                     setPlayerStorageValue(cid, t.h, -1)
                     doTeleportThing(cid, t.w)
                     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
                     setPlayerStorageValue(cid, t.g, getGlobalStorageValue(t.g))
                     setGlobalStorageValue(t.g, tonumber(getGlobalStorageValue(t.g))+1)
                  else
                     doPlayerSendCancel(cid, "Event is full [" .. getGlobalStorageValue(t.c) .. " players]!")
                     return true
                  end
               else
                  doPlayerSendCancel(cid, "Musisz byc w protection zone [PZ].")
                  return true
               end
            else
               doPlayerSendCancel(cid, "Jestes juz zarejestrowany w tym evencie.")
               return true
            end
         else
            doPlayerSendCancel(cid, "Minimalny level do wziecia udzialu w walce to 100.")
            return true
         end           
      else
         doPlayerSendCancel(cid, "W chwili obecnej event jest nieczynny.")
         return true
      end
      return true
   end
]]></talkaction>
<event type="combat" name="RushCombat" event="script"><![CDATA[
   domodlib('re')
   function onCombat(cid, target)
      if(getGlobalStorageValue(t.a) == 1) then
         if isPlayer(cid) and isPlayer(target) then
            if getPlayerStorageValue(cid, t.f) == 1 and getPlayerStorageValue(target, t.f) == 1 then
               if getPlayerStorageValue(cid, t.f_1) == getPlayerStorageValue(target, t.f_1) then
                  return doPlayerSendCancel(cid, "Niestety, nie mozna atakowac swojego zespolu.") and false
               end
            end
         end
      end
      return true
   end
]]></event>
<event type="attack" name="RushAttack" event="script"><![CDATA[
   domodlib('re')
   function onAttack(cid, target)
      if(getGlobalStorageValue(t.a) == 1) then
         if isPlayer(cid) and isPlayer(target) then
            if getPlayerStorageValue(cid, t.f) == 1 and getPlayerStorageValue(target, t.f) == 1 then
               if getPlayerStorageValue(cid, t.f_1) == getPlayerStorageValue(target, t.f_1) then
                  return doPlayerSendCancel(cid, "Niestety, nie mozna atakowac swojego zespolu.") and false
               end
            end
         end
      end
      return true
   end
]]></event>
<event type="preparedeath" name="RushDead" event="script"><![CDATA[
   domodlib('re')
   function onPrepareDeath(cid, deathList)
      if(not isPlayer(cid)) then
         return true
      end
      if getGlobalStorageValue(t.a) == 1 then
         local strings = {""}
         local j, position, corpse = 1, 1, 0
         for _, pid in ipairs(deathList) do
            if isCreature(pid) == true then
               strings[position] = j == 1 and "" or strings[position] .. ", "
               strings[position] = strings[position] .. getCreatureName(pid) .. ""
               j = j + 1
            else
               strings[position] = j == 1 and "" or strings[position] .. ", "
               strings[position] = strings[position] .."a field item"
               j = j + 1
            end
         end
         for i, str in ipairs(strings) do
            if(str:sub(str:len()) ~= ",") then
               str = str .. "."
            end
            desc = "You recognize "
            desc = desc .. "" .. getCreatureName(cid) .. ". He was killed by " .. str
         end
         if(getPlayerSex(cid) == 1) then
            corpse = doCreateItem(3058, getCreaturePosition(cid))
         else
            corpse = doCreateItem(3065, getCreaturePosition(cid))
         end
         doItemSetAttribute(corpse, "description", desc)
         if((getPlayerStorageValue(cid, t.g) % 2) == 1) then
            setGlobalStorageValue(t.u, getGlobalStorageValue(t.u)+1)
         else
            setGlobalStorageValue(t.l, getGlobalStorageValue(t.l)+1)
         end
         local red = getGlobalStorageValue(t.l)
         local blue = getGlobalStorageValue(t.u)
         if blue < t.v or red < t.v then   
            if(isPlayer(cid) == false) then
               return true
            end      
            if((getPlayerStorageValue(cid, t.g) % 2) == 1) then
               doTeleportThing(cid, t.d_1)
               doSendMagicEffect(getCreaturePosition(cid), 10)
               doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
               doCreatureAddMana(cid, getCreatureMaxMana(cid))
               doPlayerRemoveLethalConditions(cid)
               if getCreatureSkullType(cid) == SKULL_WHITE then
                  doCreatureSetSkullType(cid, 0)
               end
            else
               doTeleportThing(cid, t.d_2)
               doSendMagicEffect(getCreaturePosition(cid), 10)
               doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
               doCreatureAddMana(cid, getCreatureMaxMana(cid))
               doPlayerRemoveLethalConditions(cid)
               if getCreatureSkullType(cid) == SKULL_WHITE then
                  doCreatureSetSkullType(cid, 0)
               end
            end   
         end
         if blue >= t.v then
            doBroadcastMessage(t.y, MESSAGE_STATUS_WARNING)
            setGlobalStorageValue(t.h, 1)
            for _, pid in ipairs(getPlayersOnline()) do
               if(getPlayerStorageValue(pid, t.f_1) == 1) then
                  doPlayerAddItem(pid, 10136, 1)
               end
            end
         elseif red >= t.v then
            doBroadcastMessage(t.o, MESSAGE_STATUS_WARNING)
            setGlobalStorageValue(t.h, 1)
            for _, pid in ipairs(getPlayersOnline()) do
               if(getPlayerStorageValue(pid, t.f_2) == 1) then
                  doPlayerAddItem(pid, 2157, 2)
               end
            end
         end
         if getGlobalStorageValue(t.h) == 1 then
            setGlobalStorageValue(t.a, 0)
            setGlobalStorageValue(t.h, 0)
            setGlobalStorageValue(t.wv, -1)
            setPlayerStorageValue(cid, t.f, -1)
            setPlayerStorageValue(cid, t.g, 0)
            setPlayerStorageValue(cid, t.l, 0)
            setPlayerStorageValue(cid, t.u, 0)
            setPlayerStorageValue(cid, t.f_1, 1)
            setPlayerStorageValue(cid, t.f_2, 1)
            setPlayerStorageValue(cid, t.h, -1)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
            doSendMagicEffect(getCreaturePosition(cid), 10)
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
            doCreatureAddMana(cid, getCreatureMaxMana(cid))
            doPlayerRemoveLethalConditions(cid)
            for _, pid in ipairs(getPlayersOnline()) do
               if(getPlayerStorageValue(pid, t.f_1) == 1 or getPlayerStorageValue(pid, t.f_2) == 1) then
                  setPlayerStorageValue(pid, t.f, -1)
                  doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
                  doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
                  setPlayerStorageValue(pid, t.g, 0)
                  setPlayerStorageValue(pid, t.l, 0)
                  setPlayerStorageValue(pid, t.u, 0)
                  setPlayerStorageValue(pid, t.f_1, -1)
                  setPlayerStorageValue(pid, t.f_2, -1)
                  setPlayerStorageValue(pid, t.h, -1)
                  doCreatureAddHealth(pid, getCreatureMaxHealth(pid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
                  doCreatureAddMana(pid, getCreatureMaxMana(pid))
                  doPlayerRemoveLethalConditions(pid)
               end
            end
            return false
         end
         return false
      end
      return true
   end
]]></event>
<event type="outfit" name="RushOutfit" event="script"><![CDATA[
   domodlib('re')
   function onOutfit(cid, old, current)
      if(getGlobalStorageValue(t.a) == 1) then
         if getPlayerGroupId(cid) > 3 then
            return true
         end
         if getPlayerStorageValue(cid, t.h) == 0 then
            if getPlayerStorageValue(cid, t.f) > -1 then
               doPlayerSendCancel(cid, "Nie mozna zmienic stroju podczas eventu.")
               return false
            end
         end
      end
      return true
   end
]]></event>
</mod>

---------- Tre?? dodana o 14:10 ----------

Prosz? o pomoc :( ReFRESH :<




[XML]<?xml version="1.0" encoding="UTF-8"?>
<mod name="Rush Event" version="1.0.0" author="VirrageS" enabled="yes">
<config name="config_rush_event">
<![CDATA[
configRushEvent = {
storages = {
main = 'rushEventMain', -- set free storage
player = 'rushEventPlayer', -- set free storage
joining = 'rushEventJoining', -- set free storage
b_score = 'rushEventBlueScore', -- set free storage
r_score = 'rushEventRedScore', -- set free storage
exhaust = 'rushEventExhaust',
countEvent = 'rushEventCountEvent'
},

position = {
blue = {x=1032, y=689, z=7}, -- posiotion to which player is teleporting
red = {x=1113, y=684, z=7} -- posiotion to which player is teleporting
},

room = {
from = {x=4116,y=2255,z=6}, -- left top corner of event room
to = {x=4227,y=2354,z=7} -- right bottom corner of event room
},

rewards = {7720, 2157}, -- reward id which player can win (reward is random)
players = {
max = 30,
min = 8,
minLevel = 100
},

days = {
['Monday'] = {'21:00:00'},
['Tuesday'] = {'17:00:00'},
['Thursday'] = {'17:00:20'}
},

fragLimit = 100, -- frag limit

waitTime = 10, -- sekundy [ile gracz ma czekac jak padnie]

delayTime = 3.0, -- time in which players who joined to event are teleporting to teleport position [miuntes]
startEvent = 1, -- time from teleport to start event [seconds]
stopEvent = 600, -- [seconds]
text = 'Walka przez 10min lub 100 fragow, bez ue.'
}

]]>
</config>

<lib name="lib_rush_event">
<![CDATA[
domodlib('config_rush_event')

local conditionBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionBlue, {lookType = 130, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})

local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionRed, {lookType = 130, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

function doStartRushEvent()
doSetStorage(configRushEvent.storages.joining, -1)

if configRushEvent.players.min <= doCountPlayersRushEvent()[1] then
for _, cid in ipairs(getPlayersOnline()) do
local p = tostring(getCreatureStorage(cid, configRushEvent.storages.player))
if p ~= '' then
doTeleportThing(cid, p ~= 'blue' and configRushEvent.position.red or configRushEvent.position.blue)
doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
doAddCondition(cid, p ~= 'blue' and conditionRed or conditionBlue)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Rush Event starts in '..configRushEvent.startEvent..' seconds.')
end
end

addEvent(doSetStorage, configRushEvent.startEvent * 1000, configRushEvent.storages.main, 1)
addEvent(doStopRushEvent, configRushEvent.stopEvent * 1000)
doBroadcastMessage('Rush Event has started. LET\'S GO!')
else
for _, cid in ipairs(getPlayersOnline()) do
if tostring(getCreatureStorage(cid, configRushEvent.storages.player)) ~= '' then
doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
doCreatureSetStorage(cid, configRushEvent.storages.player, '')
end
end

doBroadcastMessage('Rush Event hasn\'t started beacuse there not were enough players.')
end
end

function doStopRushEvent()
if getStorage(configRushEvent.storages.main) > 0 then
local team = nil
if getStorage(configRushEvent.storages.b_score) == configRushEvent.fragLimit then
team = 'blue'
elseif getStorage(configRushEvent.storages.r_score) == configRushEvent.fragLimit then
team = 'red'
else
if getStorage(configRushEvent.storages.r_score) >= getStorage(configRushEvent.storages.b_score) then
team = 'red'
else
team = 'blue'
end
end

local prize = math.random(#configRushEvent.rewards)
for _, cid in ipairs(getPlayersOnline()) do
if isInRange(getThingPos(cid), configRushEvent.room.from, configRushEvent.room.to) then
if team == tostring(getCreatureStorage(cid, configRushEvent.storages.player)) then
doPlayerAddItem(cid, configRushEvent.rewards[prize], 1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Your team won! You have received '.. getItemNameById(configRushEvent.rewards[prize]) ..' as reward.')
end

doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureSetStorage(cid, configRushEvent.storages.player, '')
doRemoveCondition(cid, CONDITION_OUTFIT)
end
end

doBroadcastMessage('Rush Event has finished. The winner is '..team..' team ('..getStorage(configRushEvent.storages.r_score)..':'..getStorage(configRushEvent.storages.b_score)..'). Congratulations!')
db.query("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Rush\", \""..team.."\", \""..prize.."\", "..getStorage(configRushEvent.storages.countEvent)..");")
doSetStorage(configRushEvent.storages.main, -1)
doSetStorage(configRushEvent.storages.countEvent, getStorage(configRushEvent.storages.countEvent) + 1)
doSetStorage(configRushEvent.storages.r_score, 0)
doSetStorage(configRushEvent.storages.b_score, 0)
end
end

function doCountPlayersRushEvent()
local x, blue, red = 0,0,0
for _, cid in ipairs(getPlayersOnline()) do
local p = tostring(getCreatureStorage(cid, configRushEvent.storages.player))
if p ~= '' then
if p ~= 'blue' then
red = red + 1
else
blue = blue + 1
end
x = x + 1
end
end
return {x, blue, red}
end

function doStartCountingRushEvent(x)
if configRushEvent.delayTime-x > 0 then
doBroadcastMessage('Rush Event is going to start in '..configRushEvent.delayTime-x..' minutes. You can join to the event by saying "!rush join".')
addEvent(doStartCountingRushEvent, 60*1000, x+1)
end
end
]]>
</lib>

<talkaction words="!stoprush" access="5" event="script">
<![CDATA[
domodlib("lib_rush_event")

function onSay(cid, words, param)
if getStorage(configRushEvent.storages.main) < 1 then
return doPlayerSendCancel(cid, 'You can not do it if Rush Event is not enabled.')
end

doStopRushEvent()
return true
end
]]>
</talkaction>

<talkaction words="!startrush" access="5" event="script">
<![CDATA[
domodlib("lib_rush_event")

function onSay(cid, words, param)
if getStorage(configRushEvent.storages.main) > 0 then
return doPlayerSendCancel(cid, 'Rush Event is already running.')
end

for _, pid in ipairs(getPlayersOnline()) do
if tostring(getCreatureStorage(pid, configRushEvent.storages.player)) ~= '' then
doCreatureSetStorage(pid, configRushEvent.storages.player, '')
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
doRemoveCondition(pid, CONDITION_OUTFIT)
end
end

doStartCountingRushEvent(0)
doSetStorage(configRushEvent.storages.joining, 1)
addEvent(doStartRushEvent, configRushEvent.delayTime * 60 * 1000)
return true
end
]]>
</talkaction>

<talkaction words="!rush" event="script">
<![CDATA[
domodlib("lib_rush_event")

function onSay(cid, words, param)
if getStorage(configRushEvent.storages.joining) ~= 1 then
return doPlayerSendCancel(cid, 'Rush Event hasn\'t started yet.')
elseif param == '' then
return doPlayerSendCancel(cid, 'Command param required (say: "!rush join" or "!rush leave.").')
elseif getPlayerLevel(cid) < configRushEvent.players.minLevel then
return doPlayerSendCancel(cid, 'You can\'t join to the event if you don\'t have a require '..configRushEvent.players.minLevel..' level.')
elseif getTileInfo(getThingPos(cid)).protection ~= true then
return doPlayerSendCancel(cid, 'You can\'t join to the event if you aren\'t in protection zone.')
elseif exhaustion.check(cid, configRushEvent.storages.exhaust) ~= false then
return doPlayerSendCancel(cid, 'You must wait '..exhaustion.get(cid, configRushEvent.storages.exhaust)..' seconds to use this command again.')
end

if param == 'join' then
if tostring(getCreatureStorage(cid, configRushEvent.storages.player)) ~= '' then
return doPlayerSendCancel(cid, 'You have arleady joined to event. Wait patiently for start.')
elseif doCountPlayersRushEvent()[1] == configRushEvent.players.max then
return doPlayerSendCancel(cid, 'Max players in the event have been reached.')
end

for _, v in ipairs(getPlayersOnline()) do
if tostring(getCreatureStorage(v, configRushEvent.storages.player)) ~= '' then
if getPlayerIp(cid) == getPlayerIp(v) then
return doPlayerSendCancel(cid, 'In Rush event there is arleady player who have same ip like you.')
end
end
end

doCreatureSetNoMove(cid, true)
if configRushEvent.text ~= '' then
doPlayerPopupFYI(cid, configRushEvent.text)
end

doCreatureSetStorage(cid, configRushEvent.storages.player, doCountPlayersRushEvent()[3] >= doCountPlayersRushEvent()[2] and 'blue' or 'red')
doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, -1))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined to Rush Event. You can\'t move until event don\'t start. Wait patiently for the event start.')
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have joined to Rush Event.')
elseif param == 'leave' then
if tostring(getCreatureStorage(cid, configRushEvent.storages.player)) ~= '' then
return doPlayerSendCancel(cid, 'You can\'t leave from the event if you don\'t join.')
end

doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
doCreatureSetStorage(cid, configRushEvent.storages.player, '')
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the Rush Event.')
end

exhaustion.set(cid, configRushEvent.storages.exhaust, 5)
return true
end
]]>
</talkaction>


<globalevent name="Rush_Event_Days" interval="1000" event="script">
<![CDATA[
domodlib("lib_rush_event")

local daysOpen = {}
for k, v in pairs(configRushEvent.days) do
table.insert(daysOpen, k)
end

function onThink(cid, interval)
if isInArray(daysOpen, os.date('%A')) then
if isInArray(configRushEvent.days[os.date('%A')], os.date('%X', os.time())) then
if getStorage(configRushEvent.storages.joining) ~= 1 then
doStartCountingRushEvent(0)

for _, pid in ipairs(getPlayersOnline()) do
if tostring(getCreatureStorage(pid, configRushEvent.storages.player)) ~= '' then
doCreatureSetStorage(pid, configRushEvent.storages.player, '')
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
doRemoveCondition(pid, CONDITION_OUTFIT)
end
end

doSetStorage(configRushEvent.storages.joining, 1)
addEvent(doStartRushEvent, configRushEvent.delayTime * 60 * 1000)
end
end
end

return true
end
]]>
</globalevent>

<event type="statschange" name="Rush_Event_Dead" event="script">
<![CDATA[
domodlib("lib_rush_event")

function onStatsChange(cid, attacker, type, combat, value)
if type == 1 and getCreatureHealth(cid) <= value then
if isInRange(getThingPos(cid), configRushEvent.room.from, configRushEvent.room.to) then
if isPlayer(cid) then
local p = tostring(getCreatureStorage(cid, configRushEvent.storages.player))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doTeleportThing(cid, p ~= 'blue' and configRushEvent.position.red or configRushEvent.position.blue)
doCreatureSetNoMove(cid, true)
addEvent(doCreatureSetNoMove, configRushEvent.waitTime * 1000, cid, false)

if p ~= 'blue' then
doSetStorage(configRushEvent.storages.b_score, math.max(getStorage(configRushEvent.storages.b_score), 0) + 1)
if getStorage(configRushEvent.storages.b_score) == configRushEvent.fragLimit then
doStopRushEvent()
end
else
doSetStorage(configRushEvent.storages.r_score, math.max(getStorage(configRushEvent.storages.r_score), 0) + 1)
if getStorage(configRushEvent.storages.r_score) == configRushEvent.fragLimit then
doStopRushEvent()
end
end
return false
end
end
elseif isInArray({1,3}, type) and isPlayer(attacker) and isPlayer(cid) then
if isInRange(getThingPos(cid), configRushEvent.room.from, configRushEvent.room.to) then
if tostring(getCreatureStorage(cid, configRushEvent.storages.player)) == tostring(getCreatureStorage(attacker, configRushEvent.storages.player)) then
return false
end
end
end
return true
end
]]>
</event>

<event type="login" name="Rush_Event_Login" event="script">
<![CDATA[
domodlib("config_rush_event")

function onLogin(cid)
if tostring(getCreatureStorage(cid, configRushEvent.storages.player)) ~= '' then
doCreatureSetStorage(cid, configRushEvent.storages.player, '')
doRemoveCondition(cid, CONDITION_OUTFIT)
end

registerCreatureEvent(cid, 'Rush_Event_Dead')
return true
end
]]>
</event>

<globalevent name="Rush_Event_Start" type="startup" event="script">
<![CDATA[
domodlib("config_rush_event")

function onStartup()
doSetStorage(configRushEvent.storages.main, -1)
doSetStorage(configRushEvent.storages.r_score, 0)
doSetStorage(configRushEvent.storages.b_score, 0)
doSetStorage(configRushEvent.storages.joining, -1)
return true
end
]]>
</globalevent>
</mod>[/XML]
W tym 2 z kolei nie wiem czemu mi komendy nie dzialaja zadne :/ prosze o pomoc ;/
 
Odp:
Notka moderatorska:
Rush Event...

Tego to ci nikt nie ruszy. Bo sprawdzenie co i jak powinno zaj?? 30 sekund. Ewentualne dodanie takiej funkcjonalno?ci 5 minut.
Tutaj 10 minut zajmie sprawdzenie co i jak, bo jest tak tragicznie ten kod napisany (prawdopodobnie celowo).
Dlaczego? A chocia?by dlatego, spr?buj mi powiedzie? na szybko co oznacza kt?ra zmienna, bez grzebania w kodzie:
a = 32145,
g = 32146,
l = 32147,
u = 32148,
h = 32149,
wv = 32150,
c = 0,
q = "Rush Event zostal rozpoczety, milej zabawy! =)",
f = 5447,
f_1 = 5448,
f_2 = 5449,
d_1 = {x = 1113, y = 684, z = 7}, -- red temple
d_2 = {x = 1030, y = 689, z = 7}, -- blue temple
x = "Event anulowany, poniewaz zbyt malo chetnych os?b do wziecia udzialu.",
w = {x = 1040, y = 1046, z = 7},
lvl = 100,
v = 25,
mn = 5,
m = 40,
o = "Event zakonczony, Team CZERWONYCH wygral walke!",
y = "Event zakonczony, Team NIEBIESKICH wygral walke!",
i_1 = 0,
i_2 = 0,
t = 3,
r = 5
No w?a?nie.
To, ?e s? opisane warto?ci, wiele nie pomaga, bo jest ich sporo i czytanie kodu sprawdzaj?c co 3 znak co oznacza, mo?e doprowadzi? do rozjebania m?zgu.

Mo?esz to rozczytywa? i poszuka? czy przypadkiem nie ma opcji ?eby gracz mia? kilka ?y? zamiast jednego, mo?e to si? da nawet w tym configu ustawi?.
Je?li si? nie da, to najzwyczajniej b?dzie to jaki? prosty if przy zgonie, kt?ry przeniesie do "temple" z eventu, a nie do temple zwyczajnego.
Jednym s?owem, m?cz si? sam, albo u?yj normalnego skryptu.
 
Odp:
Notka moderatorska:
Rush Event...

Refresh prosze O pomoc :((
 
Odp:
Notka moderatorska:
Rush Event...

Refresh...:(

---------- Tre?? dodana o 20:10 ----------

RefresH ... prosz? o pomoc.:(
 
Odp:
Notka moderatorska:
Rush Event...

Refresh :<<<>>>
 
Odp:
Notka moderatorska:
Rush Event...

Refresh :(
 
Back
Do góry