• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved CTF Timer Help

kozmo

Member
Joined
Jan 30, 2009
Messages
443
Solutions
2
Reaction score
23
Iv tried a bunch of different things to try and make this Event start after 5 minutes of being broadcasted still cannot figure it out..

local function teleportThing(minutes)
local event = 0
if minutes <= 0 then
for _, cid in ipairs(getPlayersOnline()) do
if isInRange(getThingPos(cid), t.fromPos, t.toPos) then
if math.random(1, 3) < 3 then
setPlayerStorageValue(cid, t.redStorage, 1)
doAddCondition(cid, conditionRed)
doTeleportThing(cid, t.redPos, true)
else
setPlayerStorageValue(cid, t.blueStorage, 1)
doAddCondition(cid, conditionBlue)
doTeleportThing(cid, t.bluePos, true)
end
end
end
return true
end
if minutes == 1 then
doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minute!")
elseif minutes <= 1 then
doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
else
doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
end
event = addEvent(teleportThing, 300, minutes - 1)
return true
end
function onThink(interval, lastExecution)
return teleportThing(math.abs(math.ceil(5)))
end
 
Lua:
function teleportThing(minutes)
	if minutes <= 0 then
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), t.fromPos, t.toPos) then
				if math.random(1, 3) < 3 then
					setPlayerStorageValue(cid, t.redStorage, 1)
					doAddCondition(cid, conditionRed)
					doTeleportThing(cid, t.redPos, true)
				else
					setPlayerStorageValue(cid, t.blueStorage, 1)
					doAddCondition(cid, conditionBlue)
					doTeleportThing(cid, t.bluePos, true)
				end
			end
		end
		return true
	end
	if minutes == 1 then
		doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minute!")
	else
		doBroadcastMessage("Capture The Flag will begin in " .. minutes .. " minutes!")
	end
	addEvent(teleportThing, 60000, minutes - 1)
	return true
end

function onThink(interval, lastExecution)
	return teleportThing(5)
end
Try this.
 
Back
Top