• 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!

War Event (Johannes10)

slayzer

Klaffen
Joined
Dec 28, 2008
Messages
301
Solutions
3
Reaction score
51
Location
Norway
Hi, I'm here to make an request for Johannes10.
He came up with an(which i think is) an awesome idea.

He's idea was:
20 players walk to like.. and room with an switch and stuff.
When 10 players walk on ea side of the switch(like in annihilator, just that its 2 different spots to stand, and its 10 spots at ea side)
Team 1 | team 2
<-- -->
2z7eb2s.jpg

in the arena
when you pull the switch(lever) you get into and PVP Arena.
In this arena, its first Team to 30 kills, win.(if you die, you have to re-spawn inside the arena somewhat)

The winning team gets into and reward room at get Experience and the Heart's of the players who lost(Like Undead Hearth
Undead_Heart.gif
, that got Description: "Player Name" and "Player's Level".
while the losers get Nothing and just get 'ported out.

Credits:
Johannes10 for Idea
Slayzer for knowing how to write English
 
Last edited by a moderator:
about the inRange part im not sure if it will work, if not make them as positions (10 positions in each team)
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
	redTeam = {
		fromPos = {x = 100, y = 200, z = 7},
		toPos = {x = 100, y = 200, z = 7}
	},
	blueTeam = {
		fromPos = {x = 100, y = 200, z = 7},
		toPos = {x = 100, y = 200, z = 7}
	}
}
local blueTeamPos = {x = 100, y = 200, z = 7}
local redTeamPos = {x = 100, y = 200, z = 7}
local redStorage = 7000
local blueStorage = 8000
local redPlayers = {}
local bluePlayers = {}
	if isInRange(getThingPos(cid), v.redTeam.fromPos, v.redTeam.toPos) or isInRange(getThingPos(cid), v.blueTeam.fromPos, v.blueTeam.toPos) then
		for _, pos in ipairs(v.redTeam) do
			for _, position in ipairs(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(redPlayers, c)
					table.insert(bluePlayers, t)
				end
			end
		end
	end
	if item.itemid == 1945 or item.itemid == 1946 then
		for i, k in ipairs(redPlayers) do
			for i, g in ipairs(bluePlayers) do
				if g => 10 and k => 10 then
					doTeleportThing(k, redTeamPos, true)
					setPlayerStorageValue(k, redStorage, 1)
					doTeleportThing(g, blueTeamPos, true)
					setPlayerStorageValue(g, blueStorage, 1)
					table.remove(redPlayers, k)
					table.remove(bluePlayers, g)
				end
			end	
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
about the inRange part im not sure if it will work, if not make them as positions (10 positions in each team)
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
	redTeam = {
		fromPos = {x = 100, y = 200, z = 7},
		toPos = {x = 100, y = 200, z = 7}
	},
	blueTeam = {
		fromPos = {x = 100, y = 200, z = 7},
		toPos = {x = 100, y = 200, z = 7}
	}
}
local blueTeamPos = {x = 100, y = 200, z = 7}
local redTeamPos = {x = 100, y = 200, z = 7}
local redStorage = 7000
local blueStorage = 8000
local redPlayers = {}
local bluePlayers = {}
	if isInRange(getThingPos(cid), v.redTeam.fromPos, v.redTeam.toPos) or isInRange(getThingPos(cid), v.blueTeam.fromPos, v.blueTeam.toPos) then
		for _, pos in ipairs(v.redTeam) do
			for _, position in ipairs(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(redPlayers, c)
					table.insert(bluePlayers, t)
				end
			end
		end
	end
	if item.itemid == 1945 or item.itemid == 1946 then
		for i, k in ipairs(redPlayers) do
			for i, g in ipairs(bluePlayers) do
				if g => 10 and k => 10 then
					doTeleportThing(k, redTeamPos, true)
					setPlayerStorageValue(k, redStorage, 1)
					doTeleportThing(g, blueTeamPos, true)
					setPlayerStorageValue(g, blueStorage, 1)
					table.remove(redPlayers, k)
					table.remove(bluePlayers, g)
				end
			end	
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
what about this 1?
 
Code:
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 then
		if getCreatureHealth(cid) <= value then
			if isPlayer(attacker) then
				if getPlayerStorageValue(cid, 8000) == 1 then
					doTeleportThing(cid, {x = 100, y = 200, z = 7})
				elseif getPlayerStorageValue(cid, 7000) == 1 then
					doTeleportThing(cid, {x = 100, y = 200, z = 7})
				end
			end
			return false
		end
	end
	return true
end
Code:
function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerStorageValue(cid, 8000) == 1 and getPlayerStorageValue(target, 8000) == 1 then
			doPlayerSendCancel(cid, "You may not attack your team mates.")
			return false
		elseif getPlayerStorageValue(cid, 7000) == 1 and getPlayerStorageValue(target, 7000) == 1 then
			doPlayerSendCancel(cid, "You may not attack your team mates.")
			return false
		end
	end
	return true
end
next time say u want a full working event
 
Code:
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 then
		if getCreatureHealth(cid) <= value then
			if isPlayer(attacker) then
				if getPlayerStorageValue(cid, 8000) == 1 then
					doTeleportThing(cid, {x = 100, y = 200, z = 7})
				elseif getPlayerStorageValue(cid, 7000) == 1 then
					doTeleportThing(cid, {x = 100, y = 200, z = 7})
				end
			end
			return false
		end
	end
	return true
end
Why so many IFs?
Code:
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(attacker) then
		return not doTeleportThing(cid, getPlayerStorageValue(cid, 8000) == 1 and {x = 100, y = 200, z = 7} or getPlayerStorageValue(cid, 7000) == 1 and {x = 100, y = 200, z = 7})
	end
	return true
end
Code:
function onCombat(cid, target)
	if isPlayer(cid) and isPlayer(target) and ((getPlayerStorageValue(cid, 8000) == 1 and getPlayerStorageValue(target, 8000) == 1) or (getPlayerStorageValue(cid, 7000) == 1 and getPlayerStorageValue(target, 7000) == 1)) then
		return not doPlayerSendCancel(cid, "You may not attack your team mates.")
	end
	return true
end
 
Last edited:
Why so many IFs?
Code:
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(attacker) then
		return not doTeleportThing(cid, getPlayerStorageValue(cid, 8000) == 1 and {x = 100, y = 200, z = 7} or getPlayerStorageValue(cid, 7000) == 1 and {x = 100, y = 200, z = 7})
	end
	return true
end
ETC
i love em
 
aff no answer from OzIcO .... i need go to sleep but when you see this OzIcO please please can u put the script again and tell me where to put them in what file and stuff you know what i mean c ya / thanks cykotitan and OzIcO
 
Thanks Cykotitan but i listen to you ill wait for OzIcO

LOL, dont listen to cykotitan again ;S
Code:
<?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 = {
					fromPos = {x = 100, y = 200, z = 7},
					toPos = {x = 100, y = 200, z = 7}
				},
				blueTeam = {
					fromPos = {x = 100, y = 200, z = 7},
					toPos = {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')
		if isInRange(getThingPos(cid), config.v.redTeam.fromPos, config.v.redTeam.toPos) or isInRange(getThingPos(cid), config.v.blueTeam.fromPos, config.v.blueTeam.toPos) then
			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
		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>
</mod>
 
Why didnt you tell where to put the script :S?

(please please can u put the script again and tell me where to put them in what file and stuff you know what i mean ) I said this but you didnt do it:(
 
man no offense but if u don't know how to COPY/PASTE a script then u shouldn't host an ot :/

in mods folder, create copy make a lua file and put it there
It should have .xml extension.
ok i did put it on the mods/script lua file and now do i need a .xml? script or someting?
Change the extension from .lua to .xml and restart server/reload mods.
 
Back
Top