<?xml version="1.0" encoding="UTF-8"?>
<mod name="kkkkkkkkk" version="1.0" author="kkkkkkk" contact="kkkkkkkk" enabled="yes">
<config name="noob"><![CDATA[
config = {
v = {
redTeam = {
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7}
},
blueTeam = {
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7},
{x = 100, y = 200, z = 7}
}
},
blueTeamPos = {x = 100, y = 200, z = 7},
redTeamPos = {x = 100, y = 200, z = 7},
redStorage = 7000,
blueStorage = 8000,
redPlayers = {},
bluePlayers = {}
}
]]></config>
<event type="login" name="event" event="script"><![CDATA[
registerCreatureEvent(cid, "stats")
registerCreatureEvent(cid, "combats")
return true
]]></event>
<event type="statschange" name="stats" event="script"><![CDATA[
domodlib('noob')
function onStatsChange(cid, attacker, type, combat, value)
if type == 1 then
if getCreatureHealth(cid) <= value then
if isPlayer(attacker) then
if getPlayerStorageValue(cid, config.blueStorage) == 1 then
doTeleportThing(cid, config.blueTeamPos)
elseif getPlayerStorageValue(cid, config.redStorage) == 1 then
doTeleportThing(cid, config.redTeamPos)
end
end
return false
end
end
return true
end
]]></event>
<event type="combat" name="combats" event="script"><![CDATA[
domodlib('noob')
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, config.blueStorage) == 1 and getPlayerStorageValue(target, config.blueStorage) == 1 then
doPlayerSendCancel(cid, "You may not attack your team mates.")
return false
elseif getPlayerStorageValue(cid, config.redStorage) == 1 and getPlayerStorageValue(target, config.redStorage) == 1 then
doPlayerSendCancel(cid, "You may not attack your team mates.")
return false
end
end
return true
]]></event>
<action uniqueid="7000" event="script"><![CDATA[
domodlib('noob')
for _, pos in ipairs(config.v.redTeam) do
for _, position in ipairs(config.v.blueTeam) do
local t, c = getTopCreature(position).uid, getTopCreature(pos).uid
if t > 0 and isPlayer(t) or c > 0 and isPlayer(c) then
table.insert(config.redPlayers, c)
table.insert(config.bluePlayers, t)
end
end
end
if item.itemid == 1945 or item.itemid == 1946 then
for i, k in ipairs(config.redPlayers) do
for i, g in ipairs(config.bluePlayers) do
if g > 10 and k > 10 then
doTeleportThing(k, config.redTeamPos, true)
setPlayerStorageValue(k, config.redStorage, 1)
doTeleportThing(g, config.blueTeamPos, true)
setPlayerStorageValue(g, config.blueStorage, 1)
table.remove(config.redPlayers, k)
table.remove(config.bluePlayers, g)
end
end
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
]]></action>
<globalevent name="kk" interval="1000" event="script"><![CDATA[
domodlib('noob')
local reward = {x = 100, y = 200, z = 7}
for i, b in ipairs(config.redPlayers) do
for i, n in ipairs(config.bluePlayers) do
if #b > 0 and #n == 0 then
doTeleportThing(b, reward)
setPlayerStorageValue(b, config.redStorage, -1)
elseif #b == 0 and #n > 0 then
doTeleportThing(n, reward)
setPlayerStorageValue(n, config.blueStorage, -1)
end
end
end
return #n == 0 or #b == 0
]]></globalevent>
</mod>