Hey i use a ctf mod and i want to add max time that a match can be so like after 15 min the event stop and tp players to temple.
i use this script now, can someone add that function in? i m using tfs 0.4 and 8.60
@Limos
i use this script now, can someone add that function in? i m using tfs 0.4 and 8.60
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Capture The Flag" enabled="yes">
<description>
[[
@actionids:
actionid 6000:
red team
actionid 6001:
blue team
@fromPos
@toPos:
fromPos top left position
toPos buttom right position
@redPlayers, bluePlayers, redGoal, blueGoal:
all are storages
@ctf {
@redPos:
red team position (where they get teleported when they die)
@bluePos:
blue team position (/// same)
}
@temple:
temple position.
]]
</description>
<config name="ctf_config"><![CDATA[
waitingRoom = {
fromPos = {x = 751, y = 1328, z = 7},
toPos = {x = 760, y = 1336, z = 7}
}
redPlayers = 1200
bluePlayers = 2200
redGoal = 3200
blueGoal = 4200
redFlag = 5200
blueFlag = 5520
ctf = {
redPos = {x = 793, y = 1337, z = 7},
bluePos = {x = 867, y = 1397, z = 7}
}
temple = {x = 1000, y = 1000, z = 7}
]]></config>
<globalevent name="onstartup_ctf" type="start" event="script"><![CDATA[
domodlib("ctf_config")
setGlobalStorageValue(redGoal, 0)
setGlobalStorageValue(blueGoal, 0)
setGlobalStorageValue(redFlag, -1)
setGlobalStorageValue(blueFlag, -1)
db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. redFlag .. ";")
db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. blueFlag .. ";")
db.executeQuery("DELETE FROM `player_storage` WHERE `key`= " .. redPlayers .. ";")
db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. bluePlayers .. ";")
return true
]]></globalevent>
<globalevent name = "start_ctf" time="20:00:00" event="script"><![CDATA[
domodlib("ctf_config")
local red, blue = {}, {}
local conditionBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionBlue, {lookType = 130, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionRed, {lookType = 130, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
local function getPlayers(from, to)
local list = {}
for x = from.x, to.x do
for y = from.y, to.y do
for z = from.z, to.z do
local creature = getTopCreature({x =x , y =y, z = z}).uid
if isPlayer(creature) then
table.insert(list, creature)
end
end
end
end
return list
end
local function finishThis()
local t = getPlayers(waitingRoom.fromPos, waitingRoom.toPos)
if #t == 1 then
doPlayerSendTextMessage(t[1], 27, "Not enough players.")
doTeleportThing(t[1], temple, true)
elseif #t == 4 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
elseif #t == 5 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
elseif #t == 6 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
elseif #t == 7 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(blue, t[5])
table.insert(red, t[6])
table.insert(blue, t[7])
elseif #t == 8 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
table.insert(red, t[7])
table.insert(blue, t[8])
elseif #t == 9 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
table.insert(red, t[7])
table.insert(blue, t[8])
table.insert(red, t[9])
elseif #t == 10 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
table.insert(red, t[7])
table.insert(blue, t[8])
table.insert(red, t[9])
table.insert(blue, t[10])
elseif #t == 11 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
table.insert(red, t[7])
table.insert(blue, t[8])
table.insert(red, t[9])
table.insert(blue, t[10])
table.insert(red, t[11])
elseif #t == 12 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
table.insert(red, t[5])
table.insert(blue, t[6])
table.insert(red, t[7])
table.insert(blue, t[8])
table.insert(red, t[9])
table.insert(blue, t[10])
table.insert(red, t[11])
table.insert(blue, t[12])
else
for _, v in ipairs(t) do
if math.random(1, 3) < 3 then
table.insert(red, v)
else
table.insert(blue, v)
end
end
end
if #red > 0 and #blue > 0 then
for _, r in ipairs(red) do
setPlayerStorageValue(r, redPlayers, 1)
doAddCondition(r, conditionRed)
doTeleportThing(r, ctf.redPos, true)
red = {}
end
for _, b in ipairs(blue) do
setPlayerStorageValue(b, bluePlayers, 1)
doAddCondition(b, conditionBlue)
doTeleportThing(b, ctf.bluePos, true)
blue = {}
end
end
return true
end
FIRST HALF
@Limos