• 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 Help me with sintax please!

Vesgo

Member
Joined
Dec 4, 2009
Messages
356
Solutions
1
Reaction score
15
Location
Brasil
Dear friends, can someone please give me any advice to change de ">" sign for something that works?
It seems that the > sign in the MOD script dont work and the code after it dont runs.

Did i made myself clear enought?

PHP:
	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

I just need to correct thist line :
PHP:
if #red > 0 and #blue > 0 then

Thank you for your time!
 
Last edited:
Thanks for your time Keraxel, but i dont know why it does not work, i got no errors, but the script after that part does not work. I had a piece of the script bugged as this part is, and i removed the operator > and it solved my problem. The thing is (im not to experienced to do it) that this operator does not work as a quantity meter, but it is, somehow, working as a "separator". Its hard to explaind that, but theres anyway to change this operator and get that piece of script rewritten?

thank you for your time.

This is the code screenshooted in Dramweaver: Note tha after the #red > the code turns into black!

shot0890.jpg
 
Last edited:
">" works the same way in mods like in other type of scripts. It's only crappy colored because lua code is inside xml file.

Lua:
            for _, b in ipairs(blue) do
                setPlayerStorageValue(b, bluePlayers, 1) 
                doAddCondition(b, conditionBlue)
                doTeleportThing(b, ctf.bluePos, true)
                blue = {}
            end
Did you set a table blue before loop? I'm asking you because I see this variable in the loop :eek: The same thing with red. It's hard to help without whole script.
 
First of all, download Notepad++, (google it for download). It is one of the best programs out there for LUA and any other language editor.
About the blue and black problems, why use #?
 
I will post the entire code, it runs with 2 to 4 players, but i cant run it if theres 5 or more players in the waiting room.
The original code was made by Fallen, i first tried to make it run with a talkaction, but then i noticed that bug. I really need to get it working, im trying hard here but with no success, please help me out! :D

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 = 2230, y = 1035, z = 7},
			toPos = {x = 2242, y = 1047, z = 7}
		}
		redPlayers = 1200
		bluePlayers = 2200

		redGoal = 3200
		blueGoal = 4200

		redFlag = 5200
		blueFlag = 5520

		ctf = {
			redPos = {x = 1035, y = 1063, z = 7},
			bluePos = {x = 1040, y = 1018, z = 7}
		}

		temple = {x = 2038, y = 1086, 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" interval="60000" event="script"><![CDATA[
		domodlib("ctf_config")
	local red, blue = {}, {}
	local conditionBlue =  createConditionObject(CONDITION_OUTFIT)
		setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
		addOutfitCondition(conditionBlue, {lookType = 336, lookHead = 100, lookBody = 100, lookLegs = 100, lookFeet = 100})
	local conditionRed = createConditionObject(CONDITION_OUTFIT)
		setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
		addOutfitCondition(conditionRed, {lookType = 336, 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, "Pelo menos 2 jogadores devem estar na sala de espera!")
			doTeleportThing(t[1], temple, true)
		elseif #t == 2 then
			table.insert(red, t[1])
			table.insert(blue, t[2])
		elseif #t == 3 then
			table.insert(red, t[2])
			table.insert(blue, t[3])
			table.insert(red, t[1])
		elseif #t == 4 then
			table.insert(red, t[1])
			table.insert(blue, t[2])
			table.insert(red, t[3])
			table.insert(blue, t[4])
		else
			for _, v in ipairs(t) do
				if math.random(20) < 2 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
	local function teleport()
		addEvent(doBroadcastMessage, 1000, "Capturar a Bandeira vai começar em 2 minutos.")
		addEvent(doBroadcastMessage, 60 * 1000, "Capturar a Bandeira vai começar em 1 minuto.")
		addEvent(doBroadcastMessage, 120 * 1000, "Capturar a Bandeira vai começar AGORA!")
		addEvent(finishThis, 120 * 1000)
	end
	function onThink(interval)
		return teleport()
	end
	]]></globalevent>
	<event type="login" name="ctf_login" event="script"><![CDATA[
		registerCreatureEvent(cid, "ctf_stats")
		return registerCreatureEvent(cid, "ctf_target")
	]]></event>
	<event type="statschange" name="ctf_stats" event="script"><![CDATA[
		domodlib("ctf_config")
	function onStatsChange(cid, attacker, type, combat, value)
		if type == 1 then
			if getCreatureHealth(cid) <= value then
				if isPlayer(cid) and isCreature(attacker) then
					if getPlayerStorageValue(cid, redFlag) == 1 then
						setPlayerStorageValue(cid, redFlag, -1)
						setGlobalStorageValue(redFlag, -1)
						doBroadcastMessage(getCreatureName(cid) .. " perdeu a bandeira vermelha!")
					elseif getPlayerStorageValue(cid, blueFlag) == 1 then
						setPlayerStorageValue(cid, blueFlag, -1)
						setGlobalStorageValue(blueFlag, -1)
						doBroadcastMessage(getCreatureName(cid) .. " perdeu a bandeira verde!")
					end
					if getPlayerStorageValue(cid, redPlayers) == 1 then
						doTeleportThing(cid, ctf.redPos, true)
						doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
						doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
						return false
					elseif getPlayerStorageValue(cid, bluePlayers) == 1 then
						doTeleportThing(cid, ctf.bluePos, true)
						doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
						doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
						return false
					end
				end
			end
		end
		return true
	end
	]]></event>
	<event type="combat" name="ctf_target" event="script"><![CDATA[
		domodlib("ctf_config")
		if isPlayer(cid) and isPlayer(target) then
			if(getPlayerStorageValue(cid, redPlayers) == 1 and getPlayerStorageValue(target, redPlayers) == 1) or (getPlayerStorageValue(cid, bluePlayers) == 1 and getPlayerStorageValue(target, bluePlayers) == 1) then
				doPlayerSendCancel(cid, "Você não pode atacar seus amigos de time.")
				return false
			end
		end
		return true
	]]></event>
	<movevent type="StepIn" actionid="6000-6001" event="script"><![CDATA[
		domodlib("ctf_config")
	local function repeatFlag(cid)
		local k = getThingPos(cid)
		local r = {
			{pos = {x = k.x + 2, y = k.y - 2, z = k.z}, delay = 300},
			{pos = {x = k.x + 2, y = k.y + 2, z = k.z}, delay = 300},
			{pos = {x = k.x - 2, y = k.y + 2, z = k.z}, delay = 300},
			{pos = {x = k.x - 2, y = k.y, z = k.z}, delay = 300},
			{pos = {x = k.x - 2, y = k.y - 2, z = k.z}, delay = 300},
			{pos = {x = k.x, y = k.y - 2, z = k.z}, delay = 300}
		}
		local effects = {27, 28, 29, 30}
		if getPlayerStorageValue(cid, redFlag) == 1 or getPlayerStorageValue(cid, blueFlag) == 1 then
			for i = 1, 6 do
				addEvent(doSendDistanceShoot, r[i].delay, r[i].pos, k, CONST_ME_FIREWORK_YELLOW)
			end
			for i = 1, 4 do
				addEvent(doSendMagicEffect, 1000, getThingPos(cid), effects[i])
			end
			return addEvent(repeatFlag, 2 * 1000, cid)
		end
		return true
	end
	function onStepIn(cid, item, position, fromPosition, toPosition, lastPosition, actor)
		if isPlayer(cid) then
			if item.actionid == 6000 then --red team
				if getPlayerStorageValue(cid, bluePlayers) == 1 then
					if getPlayerStorageValue(cid, redFlag) == -1 and getGlobalStorageValue(redFlag) == -1 then
						setPlayerStorageValue(cid, redFlag, 1)
						setGlobalStorageValue(redFlag, 1)
						doBroadcastMessage(getCreatureName(cid) .. " capturou a bandeira vermelha!")
						repeatFlag(cid)
					else
						doCreatureSay(cid, "Esta bandeira está capturada!", 19)
						doTeleportThing(cid, fromPosition)
					end
				elseif getPlayerStorageValue(cid, redPlayers) == 1 then
					if getGlobalStorageValue(redFlag) == -1 then
						if getPlayerStorageValue(cid, blueFlag) == 1 and getGlobalStorageValue(blueFlag) == 1 then
							setPlayerStorageValue(cid, blueFlag, -1)
							setGlobalStorageValue(blueFlag, -1)
							doBroadcastMessage(getCreatureName(cid) .. " fez 1 ponto para o TIME VERMELHO!")
							setGlobalStorageValue(redGoal, getGlobalStorageValue(redGoal)+1)
							doBroadcastMessage("Placar do Capture a Bandeira:\nTime Vermelho: " .. getGlobalStorageValue(redGoal) .. "\nTime Verde: " .. getGlobalStorageValue(blueGoal) .. "\nPrimeiro time com 10 pontos GANHA!", 19)
						else
							doCreatureSay(cid, "Você não está com a bandeira!", 19)
							doTeleportThing(cid, fromPosition)
						end
					else
						doCreatureSay(cid, "Sua bandeira foi capturada! Recupere-a primeiro!", 19)
						doTeleportThing(cid, fromPosition)
					end
				else
					doPlayerSendTextMessage(cid, 27, "Você não está em nenhum time, reporte ao ADM.")
					doTeleportThing(cid, temple, true)
				end
			elseif item.actionid == 6001 then --blue team
				if getPlayerStorageValue(cid, redPlayers) == 1 then
					if getPlayerStorageValue(cid, blueFlag) == -1 and getGlobalStorageValue(blueFlag) == -1 then
						setPlayerStorageValue(cid, blueFlag, 1)
						setGlobalStorageValue(blueFlag, 1)
						doBroadcastMessage(getCreatureName(cid) .. " capturou a bandeira verde!")
						repeatFlag(cid)
					else
						doCreatureSay(cid, "Esta bandeira está capturada!", 19)
						doTeleportThing(cid, fromPosition)
					end
				elseif getPlayerStorageValue(cid, bluePlayers) == 1 then
					if getGlobalStorageValue(blueFlag) == -1 then
						if getPlayerStorageValue(cid, redFlag) == 1 and getGlobalStorageValue(redFlag) == 1 then
							setPlayerStorageValue(cid, redFlag, -1)
							setGlobalStorageValue(redFlag, -1)
							doBroadcastMessage(getCreatureName(cid) .. " fez 1 ponto para o TIME VERDE!")
							setGlobalStorageValue(blueGoal, getGlobalStorageValue(blueGoal)+1)
							doBroadcastMessage("Placar do Capture a Bandeira:\nTime Vermelho: " .. getGlobalStorageValue(redGoal) .. "\nTime Verde: " .. getGlobalStorageValue(blueGoal) .. "\nPrimeiro time com 10 pontos GANHA!", 19)
						else
							doCreatureSay(cid, "Você não está com a bandeira!", 19)
							doTeleportThing(cid, fromPosition)
						end
					else
						doCreatureSay(cid, "Sua bandeira foi capturada! Recupere-a primeiro!", 19)
						doTeleportThing(cid, fromPosition)
					end
				else
					doPlayerSendTextMessage(cid, 27, "Você não está em nenhum time, reporte ao ADM.")
					doTeleportThing(cid, temple, true)
				end
			end
			if getGlobalStorageValue(redGoal) == 10 and getGlobalStorageValue(blueGoal) < 10 then
				doBroadcastMessage("Time VERMELHO é o vencedor!", 27)
				for _, cid in ipairs(getPlayersOnline()) do
					if getPlayerStorageValue(cid, redPlayers) == 1 then
						doPlayerAddItem(cid, 9020, math.random(1, 15))
						doTeleportThing(cid, temple, true)
						doRemoveCondition(cid, CONDITION_OUTFIT)
					elseif getPlayerStorageValue(cid, bluePlayers) == 1 then
						doTeleportThing(cid, temple, true)
						doRemoveCondition(cid, CONDITION_OUTFIT)
					end
					if getPlayerStorageValue(cid, redFlag) == 1 then
						setPlayerStorageValue(cid, redFlag, -1)
					end
					if getPlayerStorageValue(cid, blueFlag) == 1 then
						setPlayerStorageValue(cid, blueFlag, -1)
					end
				end
				setGlobalStorageValue(blueGoal, 0)
				setGlobalStorageValue(redGoal, 0)
				setGlobalStorageValue(redFlag, -1)
				setGlobalStorageValue(blueFlag, -1)
			elseif getGlobalStorageValue(blueGoal) == 10 and getGlobalStorageValue(redGoal) < 10 then
				doBroadcastMessage("Time VERDE é o vencedor!", 27)
				for _, cid in ipairs(getPlayersOnline()) do
					if getPlayerStorageValue(cid, bluePlayers) == 1 then
						doPlayerAddItem(cid, 9020, math.random(1, 15))
						doTeleportThing(cid, temple, true)
						doRemoveCondition(cid, CONDITION_OUTFIT)
					elseif getPlayerStorageValue(cid, redPlayers) == 1 then
						doTeleportThing(cid, temple, true)
						doRemoveCondition(cid, CONDITION_OUTFIT)
					end
					if getPlayerStorageValue(cid, redFlag) == 1 then
						setPlayerStorageValue(cid, redFlag, -1)
					end
					if getPlayerStorageValue(cid, blueFlag) == 1 then
						setPlayerStorageValue(cid, blueFlag, -1)
					end
				end
				setGlobalStorageValue(blueGoal, 0)
				setGlobalStorageValue(redGoal, 0)
				setGlobalStorageValue(redFlag, -1)
				setGlobalStorageValue(blueFlag, -1)
			end
		else
			doRemoveCreature(cid)
		end
		return true
	end
	]]></movevent>
</mod>

I just need a way to rewrite this part of the script:

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

I changed the operator ">" to "<" and it worked (< 200) but sent all players from waiting room to the same team. I think this part of the code is responsable to create equal teams if you have 5 or more players waiting to enter the event, but with that ">" operator it does not work.

Thank you guys, i appreciate your time, lets get it done please!!
 
Code:
local red, blue = {}, {}
local conditionBlue =  createConditionObject(CONDITION_OUTFIT)
	setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
	addOutfitCondition(conditionBlue, {lookType = 336, lookHead = 100, lookBody = 100, lookLegs = 100, lookFeet = 100})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
	setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
	addOutfitCondition(conditionRed, {lookType = 336, 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, "Pelo menos 2 jogadores devem estar na sala de espera!")
		doTeleportThing(t[1], temple, true)
	elseif #t == 2 then
		table.insert(red, t[1])
		table.insert(blue, t[2])
	elseif #t == 3 then
		table.insert(red, t[2])
		table.insert(blue, t[3])
		table.insert(red, t[1])
	elseif #t == 4 then
		table.insert(red, t[1])
		table.insert(blue, t[2])
		table.insert(red, t[3])
		table.insert(blue, t[4])
	else
		for _, v in ipairs(t) do
			if math.random(20) < 2 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
local function teleport()
	addEvent(doBroadcastMessage, 1000, "Capturar a Bandeira vai começar em 2 minutos.")
	addEvent(doBroadcastMessage, 60 * 1000, "Capturar a Bandeira vai começar em 1 minuto.")
	addEvent(doBroadcastMessage, 120 * 1000, "Capturar a Bandeira vai começar AGORA!")
	addEvent(finishThis, 120 * 1000)
end
function onThink(interval)
	return teleport()
end

Checking the code, it's all good, at least in syntax.
What this script does, is get the ammount of players in the room, then:

Code:
table.insert(red, t[1])
table.insert(blue, t[2])

after that, you see:
Code:
if #red > 0 and #blue > 0 then

Which actually means: "If number of players on red is Bigger than 0, also Blue players, then do this", which is correct.

Please post the link from the thread you are getting this mod from, so i can help you further in the deploy of the script.
 
Heres the original post:
http://otland.net/f82/capture-flag-d-83604/index4.html#post948465

It works fine only if 2-4 players are in the waiting room, but if i got 5 or more players inside de waiting room, nothing happens.
Cyko and Fallen tryed to help in another post, and then we changed this part (original one):
Code:
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
			for _, v in ipairs(t) do
				if math.random(20) < 2 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

to this one:

Code:
elseif #t == 4 then
			table.insert(red, t[1])
			table.insert(blue, t[2])
			table.insert(red, t[3])
			table.insert(blue, t[4])
		else
			for _, v in ipairs(t) do
				if math.random(20) < 2 then
					table.insert(red, v)
				else
					table.insert(blue, v)
				end
			end
		end
		if #red > 0 and #blue > 0 then

The code after the change worked well with 2-4 players, but it did not solved the problem to have 5 or more players waiting to enter the event. My guess is the > operator is causing the problem in the
Code:
if #red > 0 and #blue > 0 then
part.

Do you see any other way to script just this part of the code?

after that, you see:

Code:
if #red > 0 and #blue > 0 then
Which actually means: "If number of players on red is Bigger than 0, also Blue players, then do this", which is correct.

Thx fellow!
 
I think infinite number would be easier to setup!
Seeting up the script to block players over capacity should be really hard to do, because after the msg broadcast, all players will be in a waiting room (they got there using a TP inside de city temple), then, when the event starts, they get teleported to another part of the map (the battle ground) and at this momment the script should pick players to enter the event by luck (random), and ppl would complain about it.

Lets do it infinite then? THANK YOU!
 
try this

Code:
---------------------------------------
-- Fast mod by Rockseller			 --
-- Aug/26/2010 						 --
-- OtLand.net					     --
-- Change parameters as you require  --
---------------------------------------

local function finishThis()
	local t = getPlayers(waitingRoom.fromPos, waitingRoom.toPos)
	--Changable
	maxNumberOfPlayers = 10
	------------------------
	--Dont touch
	numberOfPlayers = #t
	------------------------
	if numberOfPlayers == 1 then
		doPlayerSendTextMessage(t[1], 27, "Pelo menos 2 jogadores devem estar na sala de espera!")
		doTeleportThing(t[1], temple, true)
	end
	local phantomVar = "red"
	for i = numberOfPlayers,maxNumberOfPlayers do
		
		if phantomVar == "red" then
			table.insert(red, t[i])
			phantomVar = "blue"
		end
		
		if phantomVar == "blue" then
			table.insert(blue, t[i])
			phantomVar = "red"
		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

Note that this is the function local function finishThis(), let me know how it goes
 
Well friend, i apreciate that, but it didint work. Nothing happened after the last broadcast, the problem is (i think) that the players are not getting teleported, everything else is running ok, but this part is not working:
Code:
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

Is there any way to include the setplayerstorage, do addcondition and doTeleportthing in another piece of script?

Is there any other way to write this operator ">" 0 (not like GREATER THEN ZERO, but like DIFFERENT FROM ZERO)? (i dont have the knowledge :/, maybe if #red ~= 0 and #blue ~= 0 then
or if #red not 0 and #blue not 0 then ?? Could it work this way??

EDIT: tried ~= (didint work) and not 0 (crashed my server, but i could notice a sintax error message like "then near not") :(

EDIT2: Take a look at CDATA, maybe the > operator is really bugging the script? http://www.w3schools.com/xml/xml_cdata.asp
 
Last edited:
The operator is not a problem, as far as you told me, the only problem comes when you have more than 4 players.
When you have let's say, 5 players, players do not teleport, right? But just with 5+ players.

try changing
doTeleportThing(b, ctf.bluePos, true)
to
doTeleportThing(b, {x = 000, y = 000, z = 0}, true)

(Fill coords though)

if that doesn't work, i would need to get home (i'm at job), then try debugging manually
 
Dear Rockseller, i really apreciate your time with my ouw bugs!! I can just thank you very much, but i found a (newbie!) way to solve that, and for now it solved my problem. I just cant ask you to go home and waste your time debbuging this script, so i will keep it that way.

I did this:
Code:
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(red, t[5])
			table.insert(blue, t[6])
			table.insert(red, t[7])

and so on until number 20. After that i changed my map and made 20 little rooms inside my waiting room. That way only 20 players will be in the frompos topos check of the script and only then will be teleported to the Battle ground. I know its a silly way to solve that, but i dont have the knowledge and i dont waste your time more than i already did!!

Once again, THAK YOU VERY MUCH for all you patience with me! hope i can know as much as you someday!!

Rep+!!
 
Any time mate. By the way, that is exactly what the code i wrote does, :p, but i found an error, so try this:

Code:
---------------------------------------
-- Fast mod by Rockseller			 --
-- Aug/26/2010 						 --
-- OtLand.net					     --
-- Change parameters as you require  --
---------------------------------------

local function finishThis()
	local t = getPlayers(waitingRoom.fromPos, waitingRoom.toPos)
	--Dont touch
	numberOfPlayers = #t
	------------------------
	if numberOfPlayers == 1 then
		doPlayerSendTextMessage(t[1], 27, "Pelo menos 2 jogadores devem estar na sala de espera!")
		doTeleportThing(t[1], temple, true)
	end
	local phantomVar = "red"
	for i = 1,numberOfPlayers do
		
		if phantomVar == "red" then
			table.insert(red, t[i])
			phantomVar = "blue"
		end
		
		if phantomVar == "blue" then
			table.insert(blue, t[i])
			phantomVar = "red"
		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

You won't need to do it manually, and this supports 10000+ people.
 
the problem is this:
if math.random(20) < 2 then
try changing it to a possible range to divide teams probably, when the math.random fails, it makes all in 1 team, then ive checked if the table "red" & "blue" are bigger than a 0 to teleport.
 
Hiho there fellows, thank very much for your time! Its now solved! Im now just trying to run this as a talkaction, not as a globalevent, its really hard for me, but lets see if i can do it!

Once again, thank you!
 
Back
Top