Skrypty & Kody Rush Event

Status
Zamknięty.

Dawidashhek

Active User
Zarejestrowany
Dołączył
Styczeń 6, 2015
Posty
50
Liczba reakcji
0
Witam mam problem, a mianowicie gdy wpisz? !start to po 5 minutach teleportuje nas na war arene lecz frag?w nie liczy i gdy kto? kogo? zabije to spada lvl i przenosi go do temple (miasta nie war areny), potrafi kto? to naprawi??
<?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)) then doRemoveCondition(cid, tmp) 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 has been started! Enjoy and have fun!",
f = 5447,
f_1 = 5448,
f_2 = 5449,
d_1 = {x = 567, y = 1137, z = 6}, -- red temple
d_2 = {x = 575, y = 1256, z = 6}, -- blue temple
x = "Event won't start bacause too few people were willing to participate",
w = {x = 1032, y = 1024, z = 7},
lvl = 100,
v = 25,
mn = 4,
m = 40,
o = "Event was completed, RED TEAM has won Rush Event!",
y = "Event was completed, BLUE TEAM has won Rush Event!",
i_1 = 2160,
i_2 = 10,
t = 5,
r = 3
}
]]></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="!start" 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("Attention! Immediately register to Rush Event, event will start for ".. t.t .." minutes. All players can join to event typing this command: !rush", MESSAGE_STATUS_WARNING)
addEvent(function()
doBroadcastMessage("Rush event, started in 2 minutes. If you want to join, type this command: !rush", MESSAGE_STATUS_WARNING)
end, (t.t - 2) * 1000 * 60)
addEvent(function()
doBroadcastMessage("Rush event, started in a minute. If you want to join, type this command: !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 Events, results:\nRed Team scored: ".. red .." frags.\nBlue Team scored: ".. blue .." frags.\nMatch is under way to ".. t.v .." frags.", 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, "You are in RED TEAM!\nThis battle will continue up to ".. t.v .." frags!")
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, "You are in BLUE TEAM!\nThis battle will continue up to ".. t.v .." frags!")
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="17:00" 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("Attention! Immediately register to Rush Event, event will start for ".. t.t .." minutes. All players can join to event typing this command: !rush", MESSAGE_STATUS_WARNING)
addEvent(function()
doBroadcastMessage("Rush event, started in 2 minutes. If you want to join, type this command: !rush", MESSAGE_STATUS_WARNING)
end, (t.t - 2) * 1000 * 60)
addEvent(function()
doBroadcastMessage("Rush event, started in a minute. If you want to join, type this command: !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 Events, results:\nRed Team scored: ".. red .." frags.\nBlue Team scored: ".. blue .." frags.\nMatch is under way to ".. t.v .." frags.", 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, "You are in RED TEAM!\nThis battle will continue up to ".. t.v .." frags!")
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, "You are in BLUE TEAM!\nThis battle will continue up to ".. t.v .." frags!")
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) .. " has joined to Rush Event! Actually we have: " .. getGlobalStorageValue(t.c) .. " players!", 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, "You must be in protection zone.")
return true
end
else
doPlayerSendCancel(cid, "You are already registered in this event.")
return true
end
else
doPlayerSendCancel(cid, "Your level is too low to participate in this event.")
return true
end
else
doPlayerSendCancel(cid, "At the moment there are no records for this event.")
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, "Sorry, you cannot attack your own team.") 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, "Sorry, you cannot attack your own team.") 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(cid, 2160, 30)
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(cid, 2160, 30)
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, "You cannot change your outfit during the event.")
return false
end
end
end
return true
end
]]></event>
</mod>
 
Odp: Rush Event

ej proponuje ci inny skrypt wzi?? z neta, jest tego od.. groma ;d
 
Odp: Rush Event

Po wpisaniu !teleport czy jakiej tam komendy na ten rush event, nadawaj storage na warto?? 1, w kodzie po ?mierci sprawdzaj czy gracz ma storage ustawione na 1, jezeli tak tepaj go po smierci do xyz temple war areny, pamietaj, zeby je zresetowac po koncu eventu. -- Nie wiem czy zadzia?a, ale powinno.
 
Odp: Rush Event

Nie dzia?a ;C ma kto? dzia?aj?cy skrypt event rush ?
 
Odp: Rush Event

Mialem na kompie datapack materii, zerknij :

Kod:
<?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=4165, y=2271, z=6}, -- posiotion to which player is teleporting
                    red = {x=4150, y=2325, z=6} -- 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>
 
Odp: Rush Event

Dzia?a lecz gdy kogo? zabije to fraga dostaje (normalnego, nie na rushu) i teleportuje go do temple, tak jakby?my normalnie si? bili
 
Odp: Rush Event

Dobrze config skonfigurowales? Napewno cos zle
 
Odp: Rush Event

<?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=567, y=1137, z=7}, -- posiotion to which player is teleporting
red = {x=575, y=1256, z=7} -- posiotion to which player is teleporting
},

room = {
from = {x=1031,y=1024,z=7}, -- left top corner of event room
to = {x=1032,y=1024,z=7} -- right bottom corner of event room
},

rewards = {7720, 2157}, -- reward id which player can win (reward is random)
players = {
max = 30,
min = 2,
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>
Co tu mo?e by? ?le ?
 
Odp: Rush Event

Rusz glowa do ku*wy n?dzy sam...


Widzisz na samej gorze kodu? chyba s? miejsca na storage itd, co za mozg !
 
Status
Zamknięty.
Back
Do góry