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

[8.42] The War Server v1.2

Hey a little Question,

A verry good server btw, but is it possible to make more characters in the outpoint of your characters? cause im up to make a private War server with spesific Characters, and im not so good at this ot stuffs :p so just wonder if its possible..

And The gm Pass and acc, Possible to change?


A good edit also for players, for more various play.
Remove mag wall on druid to Wild growth, Add Paralyze to druid
 
i got a question.. how to change the spawn of the "2" teams?!
The "first" team is spawning in venore's first depot and the second team in venore's second depot... how to change? thanks!
 
Last edited:
[12/03/2009 15:21:26] Error during getDataString(description).
[12/03/2009 15:21:26] Elder Druid has logged in.


normal ?
 
I have problem with the sds I cant use sds with hotkeys. Only with my hand like 7.6.
Somebody know how I can fix that there are dead humans if somebody died?
 
the guy is right, uh etc. is working but the sd dont work on hotkey! Also changed it to ID 2268 (normal sd)

I cannot reproduce it:
20:44 Using one of 3 sudden death runes...

Set your hotkey to rune in backpack and try again. It works perfectly for me ;/
 
Code:
--The War Server v1.01 (Crying lef)------------------------------------
--by Keraxel-----------------------------------------------------------
--for otcentrum.pl && otland.net---------------------------------------
--Thanks to: TFS Developers (TFS), Masiar (awesome blowjobs)-----------
--do not remove this comments!-----------------------------------------
-----------------------------------------------------------------------
--based on The Forgotten Server 0.3.2----------------------------------
--ALL done in lua!-----------------------------------------------------
-----------------------------------------------------------------------
--If you found any bug report it on a site(s) bellow:------------------
--http://otcentrum.pl/f13/8-4-war-server-v1-0-crying-lef-38/-----------
--http://otland.net/f18/8-4-war-server-v1-0-a-25886/-------------------
-----------------------------------------------------------------------
--------------------------------------------------------------- Ania ;*

--TEAM #1, TEAM #2
TEAM_COLOR = {52, 10}
TEMPLES = { {2, 5, 8, 11, 14}, {3, 6, 9, 12, 15} }

TEAM_1_TEMPLES = {2, 5, 8, 11, 14}
TEAM_2_TEMPLES = {3, 6, 9, 12, 15}
MAP_NAME = {"Fibula", "Venore", "Edron", "Thais", "Desert"}

LEVEL_GAIN_FOR_KILL = 2 --type nil to make it dependent on level (configurable: onKillPlayer)
PLAYERS_LEVEL = 150 --when player will die then they will get this level // type nil for disable

ANTIBOT = {} --[[##do not touch it!##]]
ANTIBOT.UH = 2275
ANTIBOT.SD = 2263
ANTIBOT.EXPLO = 2312
ANTIBOT.HMM = 2314
ANTIBOT.GFB = 2307
ANTIBOT.PBOMB = 2270
ANTIBOT.EBOMB = 2282
ANTIBOT.FBOMB = 2306
ANTIBOT.MW = 2294

ITEMS = {} --[[##do not touch it!##]]
--for empty slot use nil or FALSE
--[[sorcerer]] ITEMS[5] = {
9778, --1 // head // yalahari mask
2200, --2 // necakle // protection amulet
2000, --3 // backpack // red backpack
8890, --4 // armor // robe of the underworld
8922, --5 // right hand // wand of voodoo
8918, --6 // left hand // spellbook of dark mysteries
7730, --7 // legs // blue legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
nil, --10 // ammo slot // EMPTY
--items to a backpack
2273, --UH 
2268, --SD [[ANTIBOT]]
2313, --EXPLOSION 
2311, --HMM 
2304, --GFB 
2261, --destroy field rune
2305, --firebomb rune
2262, --energy bomb rune
7590, --GMP
2293, --magic wall rune
}

--[[druid]] ITEMS[6] = {
9778, --1 // head // yalahari mask
2200, --2 // necakle // protection amulet
2002, --3 // backpack // blue backpack
8866, --4 // armor // serpent coat
8910, --5 // right hand // underworld rod
8918, --6 // left hand // spellbook of dark mysteries
7730, --7 // legs // blue legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
nil, --10 // ammo slot // EMPTY
--items to a backpack
2273, --UH 
2268, --SD [[ANTIBOT]]
2313, --EXPLOSION 
2278, --avalanche rune
2274, --avalanche rune
2304, --GFB 
2261, --destroy field rune
2286, --poison bomb rune 
2305, --firebomb rune
2262, --energy bomb rune
7590, --GMP
2293, --magic wall rune
}

--[[paladin]] ITEMS[7] = {
2493, --1 // head // demon helmet
2200, --2 // necakle // protection amulet
2003, --3 // backpack // grey backpack
8888, --4 // armor // master archer's armor
8852, --5 // right hand // chain bolter
nil, --6 // left hand // EMPTY
9777, --7 // legs // yalahari leg piece
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
6529, --10 // ammo slot // infernal bolts
--items to a backpack
2273, --UH 
2313, --EXPLOSION 
2311, --HMM 
2274, --avalanche rune
2304, --GFB 
2261, --destroy field rune
2268, --SD [[ANTIBOT]]
2305, --firebomb rune
2262, --energy bomb rune
8472, --GSP
2293, --magic wall rune
}

--[[knight]] ITEMS[8] = {
2493, --1 // head // demon helmet
2200, --2 // necakle // protection amulet
1999, --3 // backpack // yellow backpack
9776, --4 // armor // yalahari armor
2431, --5 // right hand // stonecutter axe
6433, --6 // left hand // necromancer shield
2470, --7 // legs // golden legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
FALSE, --10 // ammo slot // EMPTY
--items to a backpack
2273, --UH 
2313, --EXPLOSION 
7620, --GHP
2274, --avalanche rune
2304, --GFB 
2286, --poison bomb rune 
2305, --firebomb rune
2262, --energy bomb rune
8473 --GHP
}

ITEMS[1] = ITEMS[5]
ITEMS[2] = ITEMS[6]
ITEMS[3] = ITEMS[7]
ITEMS[4] = ITEMS[8]
ITEMS[0] = ITEMS[1] --prevents debugs

PLAYER_STORAGE = {
	TEAM_INFO = 40000
}

GLOBAL_STORAGE = {
	TEAMS = {40001, 40002},
	--TEAM_COUNT = {40011, 40012},
	AREA_ID = 40020,
}

--[[##do not change anything below this line!##]]
TEAM_COUNT = {0, 0}
--TEAMS_RESETED = FALSE
NUMBER_OF_AREAS = #TEAM_1_TEMPLES

---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------


--[[TODO]]
--[[
function resetTeams(p)
    	print(setGlobalStorageValue(p[1], 0))
    	print(setGlobalStorageValue(p[2], 0))
    	TEAMS_RESETED = TRUE
        print(">>>>..::Teams was reseted.::..<<<<")
    end
	addEvent(resetTeams, 10, GLOBAL_STORAGE.TEAM_COUNT)
--]]

function getSmallestTeam()
	local ret = 0
	if teamCount.get(1) > teamCount.get(2) then
		ret = 2
	else
		ret = 1
	end
	return ret
end

playerTeam = {
	get = function(cid)
		if getPlayerStorageValue(cid, PLAYER_STORAGE.TEAM_INFO) == GLOBAL_STORAGE.TEAMS[1] then
			return 1
		else
			return 2
		end
	end,

	set = function(cid, id)
		return setPlayerStorageValue(cid, PLAYER_STORAGE.TEAM_INFO, id)
	end
}

function doPlayerSetLevel(cid, level)
--	print("doPlayerSetLevel(cid, ".. level ..")")
--	print("Difference: ".. getExperienceForLevel(level) - getPlayerExperience(cid))
	return doPlayerAddExperience(cid, (getExperienceForLevel(level) - getPlayerExperience(cid))) or FALSE
end

function doPlayerAddLevel(cid, amount)
	return doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid) + amount) - getPlayerExperience(cid)) or FALSE
end

function doChangeMap(clean, save)
	areaId.set()

	for _, pid in ipairs(getPlayersOnline()) do
		if getPlayerAccess(pid) < 3 then
			local temple = TEMPLES[playerTeam.get(pid)][areaId.get()]
			local oldPosition = getCreaturePosition(pid)
			doPlayerSetTown(pid, temple)
			doTeleportThing(pid, getTownTemplePosition(temple))
			doSendMagicEffect(getCreaturePosition(pid), 37)
			doSendMagicEffect(oldPosition, 2)
			doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
			doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
			doRemoveConditions(pid)
		end
	end

	if clean == TRUE then
		doCleanMap()
	end
	if save == TRUE then
		doSaveServer()
	end

	print(">> ".. os.date() .." :: Map has been changed. New area is ".. MAP_NAME[areaId.get()] ..".")
    return TRUE

end

--[[TODO]]
--
teamCount = {
	get = function (teamId)
		--return getGlobalStorageValue(GLOBAL_STORAGE.TEAM_COUNT[teamId])
		return TEAM_COUNT[teamId]
	end,

	add = function (teamId, count)
		--return setGlobalStorageValue(GLOBAL_STORAGE.TEAM_COUNT[teamId], teamCount.get(teamId) + count)
		TEAM_COUNT[teamId] = TEAM_COUNT[teamId] + count
		return TRUE
	end,

	rem = function (teamId, count)
		--return teamCount.add(teamId, -count)
		TEAM_COUNT[teamId] = TEAM_COUNT[teamId] - count
		return TRUE
	end
}
--

areaId = {
	get = function()
		return getGlobalStorageValue(GLOBAL_STORAGE.AREA_ID)
	end,

	remIssue = function()
		if areaId.get() < 1 or areaId.get() > NUMBER_OF_AREAS then
			print("areaId.remIssue: issue has been removed :: areaId was ".. areaId.get())
			return setGlobalStorageValue(GLOBAL_STORAGE.AREA_ID, 1)
		end
		return FALSE
	end,

	set = function()
		areaId.remIssue()
		return setGlobalStorageValue(GLOBAL_STORAGE.AREA_ID, (areaId.get() % NUMBER_OF_AREAS) + 1)
	end
}

doPlayerSetTeam = {
	login = function (cid)
--		print("getSmallestTeam(): "..getSmallestTeam())
		if  getSmallestTeam() == FALSE then
			return FALSE
		end

		if getPlayerAccess(cid) < 3 then
			local team = getSmallestTeam()
			if team > 0 then
				local teamColor = TEAM_COLOR[team]
				playerTeam.set(cid, GLOBAL_STORAGE.TEAMS[team])
				doCreatureChangeOutfit(cid, {lookType = getCreatureOutfit(cid).lookType, lookHead = teamColor, lookBody = teamColor, lookLegs = teamColor, lookFeet = teamColor, lookTypeEx = color, lookAddons = 3})
				local temple = TEMPLES[playerTeam.get(cid)][areaId.get()]
				doPlayerSetTown(cid, temple)
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
				teamCount.add(team, 1)
				doPlayerAddSoul(cid, -getPlayerSoul(cid))
				doSendMagicEffect(getCreaturePosition(cid), 37)
			end
		end

--		print("Team 1 count: "..teamCount.get(1).."\nTeam 2 count: "..teamCount.get(2))
		return TRUE
	end,

	logout = function (cid)
		if getPlayerAccess(cid) < 3 then
			local team = playerTeam.get(cid)
--			print("getPlayerTeam(cid): "..team)
			if team > 0 then
				teamCount.rem(team, 1)
				playerTeam.set(cid, FALSE)
--				print("Team 1 count: "..teamCount.get(1).."\nTeam 2 count: "..teamCount.get(2))
			end
		end
		return TRUE
	end

}

function onKillPlayer(cid, lastHitKiller, mostDamageKiller)
	if isPlayer(cid) == TRUE then
		if isPlayer(lastHitKiller) == TRUE then
			doPlayerAddSoul(lastHitKiller, 1)
			if isPlayer(mostDamageKiller) == TRUE and mostDamageKiller ~= lastHitKiller then
				doPlayerAddSoul(lastHitKiller, 1)
			end
			if getConfigValue('experienceByKillingPlayers') == "yes" and  lastHitKiller ~= cid then
				if getConfigValue('addBagOfStoneSkinAmulets') ~= "no" then
					doPlayerBuyItemContainer(lastHitKiller, 1996, 2197, 1, 0, 5)
					if mostDamageKiller ~= lastHitKiller and mostDamageKiller ~= cid then
						doPlayerBuyItemContainer(mostDamageKiller, 1996, 2197, 1, 0, 5)
					end
				end
				local gainLevel = LEVEL_GAIN_FOR_KILL
				if  tonumber(LEVEL_GAIN_FOR_KILL) == nil then
					gainLevel = math.floor(getPlayerLevel(cid) * 0.05) --here you can configure how many level will be added to killer(s)
				end
				doPlayerAddLevel(lastHitKiller, gainLevel)
				if mostDamageKiller ~= lastHitKiller and mostDamageKiller ~= cid then
					doPlayerAddLevel(mostDamageKiller, gainLevel)
				end
			end
		end

		if tonumber(PLAYERS_LEVEL) ~= nil then
			doPlayerSetLevel(cid, PLAYERS_LEVEL)
		end

		local oldPosition = getCreaturePosition(cid)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), TRUE)
		doCreatureAddMana(cid, (getCreatureMaxMana(cid) - getCreatureMana(cid)))
		doSendMagicEffect(getCreaturePosition(cid), 37)
		doSendMagicEffect(oldPosition, 2)
		doRemoveConditions(cid, FALSE)
		doPlayerAddSoul(cid, -getPlayerSoul(cid))
		return FALSE
	end
	return TRUE
end

function doPlayerShowFragsCount(cid, position)
	local target = getThingFromPos(position)
	if isPlayer(target.uid) == TRUE and getPlayerAccess(target.uid) < 3 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Frags: " .. getPlayerSoul(target.uid))
	end
	return TRUE
end

function doPlayerAddEquipment(cid)
	if getPlayerAccess(cid) < 3 then
		local vocItems = ITEMS[getPlayerVocation(cid)]
		for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
            if vocItems[i] ~= FALSE and vocItems[i] ~= nil and i ~= CONST_SLOT_BACKPACK then
				if i == CONST_SLOT_AMMO then
					doPlayerAddItem(cid, vocItems[i], 100)
				else
					doPlayerAddItem(cid, vocItems[i])
				end

            end
        end

		local backpack = doPlayerAddItem(cid, vocItems[CONST_SLOT_BACKPACK], 1)
		for b = 11, #vocItems do
			if vocItems[b] ~= FALSE and vocItems[b] ~= nil then
				doAddContainerItem(backpack, vocItems[b])
			end
		end
		if getConfigValue('addBagOfStoneSkinAmulets') ~= "no" then
			doPlayerBuyItemContainer(cid, 1996, 2197, 1, 0, 5)
		end
	end
 	return TRUE
end

--[[ function convertPlayerVocation(cid)
local voc = getPlayerVocation(cid)
	if voc > 4 then
		voc = voc - 4
	end
	return voc
end ]]

I was adding that and still I dont can use the sds

Znote said:
Moderator Message: Please use CODE tags for codes!

Changed QUOTE tags to CODE tags.
 
Last edited by a moderator:
I cannot reproduce it:
20:44 Using one of 3 sudden death runes...

Set your hotkey to rune in backpack and try again. It works perfectly for me ;/

which id are you using for the sudden death rune? In spells.xml you can read that the normal sd = id 2268, dont know.. explo etc. is working for me but not the ugly sd ;<

Code:
--The War Server v1.01 (Crying lef)-------------------------------------
--by Keraxel-----------------------------------------------------------
--for otcentrum.pl && otland.net---------------------------------------
--Thanks to: TFS Developers (TFS), Masiar (awesome blowjobs)-----------
--do not remove this comments!-----------------------------------------
-----------------------------------------------------------------------
--based on The Forgotten Server 0.3.2----------------------------------
--ALL done in lua!-----------------------------------------------------
-----------------------------------------------------------------------
--If you found any bug report it on a site(s) bellow:------------------
--http://otcentrum.pl/f13/8-4-war-server-v1-0-crying-lef-38/-----------
--http://otland.net/f18/8-4-war-server-v1-0-a-25886/-------------------
-----------------------------------------------------------------------
--------------------------------------------------------------- Ania ;*

--TEAM #1, TEAM #2
TEAM_COLOR = {52, 10}
TEMPLES = { {2, 5, 8, 11, 14}, {3, 6, 9, 12, 15} }

TEAM_1_TEMPLES = {2, 5, 8, 11, 14}
TEAM_2_TEMPLES = {3, 6, 9, 12, 15}
MAP_NAME = {"Fibula", "Venore", "Edron", "Thais", "Desert"}

LEVEL_GAIN_FOR_KILL = 2 --type nil to make it dependent on level (configurable: onKillPlayer)
PLAYERS_LEVEL = 150 --when player will die then they will get this level // type nil for disable

ANTIBOT = {} --[[##do not touch it!##]]
ANTIBOT.UH = 2273
ANTIBOT.SD = 2268
ANTIBOT.EXPLO = 2313
ANTIBOT.HMM = 2311
ANTIBOT.GFB = 2304
ANTIBOT.PBOMB = 2286
ANTIBOT.EBOMB = 2278
ANTIBOT.FBOMB = 2305
ANTIBOT.MW = 2293

ITEMS = {} --[[##do not touch it!##]]
--for empty slot use nil or FALSE
--[[sorcerer]] ITEMS[5] = {
9778, --1 // head // yalahari mask
2173, --2 // necakle // protection amulet  --- no sry aol 
2000, --3 // backpack // red backpack
8890, --4 // armor // robe of the underworld
8922, --5 // right hand // wand of voodoo
8918, --6 // left hand // spellbook of dark mysteries
7730, --7 // legs // blue legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
nil, --10 // ammo slot // EMPTY
--items to a backpack
ANTIBOT.UH, --UH [[ANTIBOT]]
2268, --SD [[ANTIBOT]]
ANTIBOT.EXPLO, --EXPLOSION [[ANTIBOT]]
ANTIBOT.HMM, --HMM [[ANTIBOT]
2274, --avalanche rune
ANTIBOT.GFB, --GFB [[ANTIBOT]]
2261, --destroy field rune
ANTIBOT.PBOMB, --poison bomb rune [[ANTIBOT]
ANTIBOT.FBOMB, --firebomb rune [[ANTIBOT]]
ANTIBOT.EBOMB, --energy bomb rune [[ANTIBOMB]]
7590, --GMP
ANTIBOT.MW, --magic wall rune [[ANTIBOT]]
}

--[[druid]] ITEMS[6] = {
9778, --1 // head // yalahari mask
2173, --2 // necakle // protection amulet
2002, --3 // backpack // blue backpack
8866, --4 // armor // serpent coat
8910, --5 // right hand // underworld rod
8918, --6 // left hand // spellbook of dark mysteries
7730, --7 // legs // blue legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
nil, --10 // ammo slot // EMPTY
--items to a backpack
ANTIBOT.UH, --UH [[ANTIBOT]]
2268, --SD [[ANTIBOT]]
ANTIBOT.EXPLO, --EXPLOSION [[ANTIBOT]]
ANTIBOT.HMM, --HMM [[ANTIBOT]
2274, --avalanche rune
ANTIBOT.GFB, --GFB [[ANTIBOT]]
2261, --destroy field rune
ANTIBOT.PBOMB, --poison bomb rune [[ANTIBOT]
ANTIBOT.FBOMB, --firebomb rune [[ANTIBOT]]
ANTIBOT.EBOMB, --energy bomb rune [[ANTIBOMB]]
7590, --GMP
ANTIBOT.MW, --magic wall rune [[ANTIBOT]]
}

--[[paladin]] ITEMS[7] = {
2493, --1 // head // demon helmet
2173, --2 // necakle // protection amulet
2003, --3 // backpack // grey backpack
8888, --4 // armor // master archer's armor
8850, --5 // right hand // chain bolter
nil, --6 // left hand // EMPTY
9777, --7 // legs // yalahari leg piece
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
6529, --10 // ammo slot // infernal bolts
--items to a backpack
ANTIBOT.UH, --UH [[ANTIBOT]]
ANTIBOT.SD, --SD [[ANTIBOT]]
ANTIBOT.EXPLO, --EXPLOSION [[ANTIBOT]]
ANTIBOT.HMM, --HMM [[ANTIBOT]
2274, --avalanche rune
ANTIBOT.GFB, --GFB [[ANTIBOT]]
2261, --destroy field rune
ANTIBOT.PBOMB, --poison bomb rune [[ANTIBOT]
ANTIBOT.FBOMB, --firebomb rune [[ANTIBOT]]
ANTIBOT.EBOMB, --energy bomb rune [[ANTIBOMB]]
8472, --GSP
ANTIBOT.MW, --magic wall rune [[ANTIBOT]]
}

--[[knight]] ITEMS[8] = {
2493, --1 // head // demon helmet
2173, --2 // necakle // protection amulet
1999, --3 // backpack // yellow backpack
9776, --4 // armor // yalahari armor
2431, --5 // right hand // stonecutter axe
6433, --6 // left hand // necromancer shield
2470, --7 // legs // golden legs
6132, --8 // feet // soft boots
2214, --9 // ring // ring of healing
FALSE, --10 // ammo slot // EMPTY
--items to a backpack
ANTIBOT.UH, --UH [[ANTIBOT]]
ANTIBOT.EXPLO, --EXPLOSION [[ANTIBOT]]
ANTIBOT.HMM, --HMM [[ANTIBOT]
2274, --avalanche rune
ANTIBOT.GFB, --GFB [[ANTIBOT]]
2261, --destroy field rune
ANTIBOT.PBOMB, --poison bomb rune [[ANTIBOT]
ANTIBOT.FBOMB, --firebomb rune [[ANTIBOT]]
ANTIBOT.EBOMB, --energy bomb rune [[ANTIBOMB]]
7591 --GHP
}

ITEMS[1] = ITEMS[5]
ITEMS[2] = ITEMS[6]
ITEMS[3] = ITEMS[7]
ITEMS[4] = ITEMS[8]
ITEMS[0] = ITEMS[1] --prevents debugs

PLAYER_STORAGE = {
	TEAM_INFO = 40000
}

GLOBAL_STORAGE = {
	TEAMS = {40001, 40002},
	--TEAM_COUNT = {40011, 40012},
	AREA_ID = 40020,
}

--[[##do not change anything below this line!##]]
TEAM_COUNT = {0, 0}
--TEAMS_RESETED = FALSE
NUMBER_OF_AREAS = #TEAM_1_TEMPLES

---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------


--[[TODO]]
--[[
function resetTeams(p)
    	print(setGlobalStorageValue(p[1], 0))
    	print(setGlobalStorageValue(p[2], 0))
    	TEAMS_RESETED = TRUE
        print(">>>>..::Teams was reseted.::..<<<<")
    end
	addEvent(resetTeams, 10, GLOBAL_STORAGE.TEAM_COUNT)
--]]

function getSmallestTeam()
	local ret = 0
	if teamCount.get(1) > teamCount.get(2) then
		ret = 2
	else
		ret = 1
	end
	return ret
end

playerTeam = {
	get = function(cid)
		if getPlayerStorageValue(cid, PLAYER_STORAGE.TEAM_INFO) == GLOBAL_STORAGE.TEAMS[1] then
			return 1
		else
			return 2
		end
	end,

	set = function(cid, id)
		return setPlayerStorageValue(cid, PLAYER_STORAGE.TEAM_INFO, id)
	end
}

function doPlayerSetLevel(cid, level)
--	print("doPlayerSetLevel(cid, ".. level ..")")
--	print("Difference: ".. getExperienceForLevel(level) - getPlayerExperience(cid))
	return doPlayerAddExperience(cid, (getExperienceForLevel(level) - getPlayerExperience(cid))) or FALSE
end

function doPlayerAddLevel(cid, amount)
	return doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid) + amount) - getPlayerExperience(cid)) or FALSE
end

function doChangeMap(clean, save)
	areaId.set()

	for _, pid in ipairs(getPlayersOnline()) do
		if getPlayerAccess(pid) < 3 then
			local temple = TEMPLES[playerTeam.get(pid)][areaId.get()]
			local oldPosition = getCreaturePosition(pid)
			doPlayerSetTown(pid, temple)
			doTeleportThing(pid, getTownTemplePosition(temple))
			doSendMagicEffect(getCreaturePosition(pid), 37)
			doSendMagicEffect(oldPosition, 2)
			doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
			doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
			doRemoveConditions(pid)
		end
	end

	if clean == TRUE then
		doCleanMap()
	end
	if save == TRUE then
		doSaveServer()
	end

	print(">> ".. os.date() .." :: Map has been changed. New area is ".. MAP_NAME[areaId.get()] ..".")
    return TRUE

end

--[[TODO]]
--
teamCount = {
	get = function (teamId)
		--return getGlobalStorageValue(GLOBAL_STORAGE.TEAM_COUNT[teamId])
		return TEAM_COUNT[teamId]
	end,

	add = function (teamId, count)
		--return setGlobalStorageValue(GLOBAL_STORAGE.TEAM_COUNT[teamId], teamCount.get(teamId) + count)
		TEAM_COUNT[teamId] = TEAM_COUNT[teamId] + count
		return TRUE
	end,

	rem = function (teamId, count)
		--return teamCount.add(teamId, -count)
		TEAM_COUNT[teamId] = TEAM_COUNT[teamId] - count
		return TRUE
	end
}
--

areaId = {
	get = function()
		return getGlobalStorageValue(GLOBAL_STORAGE.AREA_ID)
	end,

	remIssue = function()
		if areaId.get() < 1 or areaId.get() > NUMBER_OF_AREAS then
			print("areaId.remIssue: issue has been removed :: areaId was ".. areaId.get())
			return setGlobalStorageValue(GLOBAL_STORAGE.AREA_ID, 1)
		end
		return FALSE
	end,

	set = function()
		areaId.remIssue()
		return setGlobalStorageValue(GLOBAL_STORAGE.AREA_ID, (areaId.get() % NUMBER_OF_AREAS) + 1)
	end
}

doPlayerSetTeam = {
	login = function (cid)
--		print("getSmallestTeam(): "..getSmallestTeam())
		if  getSmallestTeam() == FALSE then
			return FALSE
		end

		if getPlayerAccess(cid) < 3 then
			local team = getSmallestTeam()
			if team > 0 then
				local teamColor = TEAM_COLOR[team]
				playerTeam.set(cid, GLOBAL_STORAGE.TEAMS[team])
				doCreatureChangeOutfit(cid, {lookType = getCreatureOutfit(cid).lookType, lookHead = teamColor, lookBody = teamColor, lookLegs = teamColor, lookFeet = teamColor, lookTypeEx = color, lookAddons = 3})
				local temple = TEMPLES[playerTeam.get(cid)][areaId.get()]
				doPlayerSetTown(cid, temple)
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
				teamCount.add(team, 1)
				doPlayerAddSoul(cid, -getPlayerSoul(cid))
				doSendMagicEffect(getCreaturePosition(cid), 37)
			end
		end

--		print("Team 1 count: "..teamCount.get(1).."\nTeam 2 count: "..teamCount.get(2))
		return TRUE
	end,

	logout = function (cid)
		if getPlayerAccess(cid) < 3 then
			local team = playerTeam.get(cid)
--			print("getPlayerTeam(cid): "..team)
			if team > 0 then
				teamCount.rem(team, 1)
				playerTeam.set(cid, FALSE)
--				print("Team 1 count: "..teamCount.get(1).."\nTeam 2 count: "..teamCount.get(2))
			end
		end
		return TRUE
	end

}

function onKillPlayer(cid, lastHitKiller, mostDamageKiller)
	if isPlayer(cid) == TRUE then
		if isPlayer(lastHitKiller) == TRUE  then
			doPlayerAddSoul(lastHitKiller, 1)
			if isPlayer(mostDamageKiller) == TRUE and mostDamageKiller ~= lastHitKiller then
				doPlayerAddSoul(lastHitKiller, 1)
			end
			if getConfigValue('experienceByKillingPlayers') == "yes" and  lastHitKiller ~= cid then
				local gainLevel = LEVEL_GAIN_FOR_KILL
				if  tonumber(LEVEL_GAIN_FOR_KILL) == nil then
					gainLevel = math.floor(getPlayerLevel(cid) * 0.05) --here you can configure how many level will be added to killer(s)
				end
				doPlayerAddLevel(lastHitKiller, gainLevel)
				if mostDamageKiller ~= lastHitKiller and mostDamageKiller ~= cid then
					doPlayerAddLevel(mostDamageKiller, gainLevel)
				end
			end
		end

		if tonumber(PLAYERS_LEVEL) ~= nil then
			doPlayerSetLevel(cid, PLAYERS_LEVEL)
		end

		local oldPosition = getCreaturePosition(cid)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), TRUE)
		doCreatureAddMana(cid, (getCreatureMaxMana(cid) - getCreatureMana(cid)))
		doSendMagicEffect(getCreaturePosition(cid), 37)
		doSendMagicEffect(oldPosition, 2)
		doRemoveConditions(cid, FALSE)
		doPlayerAddSoul(cid, -getPlayerSoul(cid))
		return FALSE
	end
	return TRUE
end

function doPlayerShowFragsCount(cid, position)
	local target = getThingFromPos(position)
	if isPlayer(target.uid) == TRUE and getPlayerAccess(target.uid) < 3 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Frags: " .. getPlayerSoul(target.uid))
	end
	return TRUE
end

function doPlayerAddEquipment(cid)
	if getPlayerAccess(cid) < 3 then
		local vocItems = ITEMS[getPlayerVocation(cid)]
		for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
            if vocItems[i] ~= FALSE and vocItems[i] ~= nil and i ~= CONST_SLOT_BACKPACK then
				if i == CONST_SLOT_AMMO then
					doPlayerAddItem(cid, vocItems[i], 100)
				else
					doPlayerAddItem(cid, vocItems[i])
				end

            end
        end

		local backpack = doPlayerAddItem(cid, vocItems[CONST_SLOT_BACKPACK], 1)
		for b = 11, #vocItems do
			if vocItems[b] ~= FALSE and vocItems[b] ~= nil then
				doAddContainerItem(backpack, vocItems[b])
			end
		end
		if getConfigValue('addBagOfStoneSkinAmulets') ~= "no" then
			doPlayerBuyItemContainer(cid, 1996, 2197, 1, 0, 5)
		end
	end
 	return TRUE
end

--[[ function convertPlayerVocation(cid)
local voc = getPlayerVocation(cid)
	if voc > 4 then
		voc = voc - 4
	end
	return voc
end ]]

EDIT:
some for explosion ;/
u changed something? dunno..
 
Last edited:
Back
Top