• 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 Server problems

After sorcerer

New Member
Joined
May 23, 2009
Messages
10
Reaction score
1
Hello.

I got some problems that I hope someone could help me with.

First Problem; I got an War server that keep changing from map 1 to map 2 every 20 minute. Question; how do I add more maps into the system?

Second Problem; When you logout or die you get back to level 120 (start level) and all your items you have gained just disappear. Question; How do I change so when you logout or die you don't get all the way back to level 120 and lose everything you gained?

Sincerely,
After Sorcerer.
 
Thanks pitufo, I'll try it later.

I am using shawak's war server 8.50 with mysql.


EDIT: Pitufo, None of the characters saved. (died back to level 120,logged out back to level 120) :/

EDIT: This is the map_change.lua located at Server\data\globalevents\scripts ;
Code:
dofile("war.lua")

local timeforMapChange = map_change_config.time[#map_change_config.time]

-- {{
	local h, m, s = 0, 0, 0
	while timeforMapChange >= 3600 do
		timeforMapChange = timeforMapChange - 3600
		h = h + 1
	end
	while timeforMapChange >= 60 do
		timeforMapChange = timeforMapChange - 60
		m = m + 1
	end
	while timeforMapChange >= 1 do
		timeforMapChange = timeforMapChange - 1
		s = s + 1
	end

	print(">> Scriptet by Shawak ©\n>> Map Change Config:\n> Acces: "..map_change_config.access.."\n> Enabled: "..map_change_config.enable_mapChange.."\n> MapChange each:\nHours: "..h.."\nMinutes: "..m.."\nSeconds: "..s.."")
		
-- }}

function onStartup()
	setGlobalStorageValue(world_storage, math.random(1, #start_pos))
	return string.lower(map_change_config.enable_mapChange) == "yes" and changeWorld() or true
end

function changeWorld()
	local i = 1
	while TRUE do
		if i < #map_change_config.time then
			addEvent(map_change_timer, map_change_config.time[i]*1000, {i = i})
		else
			addEvent(map_change, map_change_config.time[i]*1000)
			break
		end
		i = i+1
	end
	return TRUE
end

function map_change_timer(paramters)
	local i = paramters.i
	local left = map_change_config.time[#map_change_config.time] - map_change_config.time[i]
	return doBroadcastMessage("Map change in "..getTimeLeft(left).."", 22)
end

function map_change()
	local t = {}
	if #start_pos == 1 then
		t = {1}
	else
		old = getGlobalStorageValue(world_storage)
		for i = 1, #start_pos do
			if i ~= old then
				table.insert(t, i)
			end
		end
	end
	setGlobalStorageValue(world_storage, t[math.random(1, #t)])
	for _, pid in ipairs(getPlayersOnline()) do
		if getPlayerAccess(pid) < map_change_config.access and getCreatureName(pid) ~= "Account Manager" then
			doTeleportThing(pid, (start_pos[getGlobalStorageValue(world_storage)].positions[math.random(1, #start_pos[getGlobalStorageValue(world_storage)].positions)]), FALSE)
			doCreatureAddHealth(pid, getCreatureMaxHealth(pid) - getCreatureHealth(pid))
			doCreatureAddMana(pid, getCreatureMaxMana(pid) - getCreatureMana(pid))
			doSendMagicEffect(getCreaturePosition(pid), 10)
			doRemoveConditions(pid, FALSE)
		end
	end
	time = getTimeLeft(map_change_config.time[#map_change_config.time])
	doBroadcastMessage("Map changed to "..start_pos[getGlobalStorageValue(world_storage)].name.." mapped by "..start_pos[getGlobalStorageValue(world_storage)].author..".\nNext map change in "..time.."", 21)
	print("--------------------------------------------\n- World Changed\n- Next Change in "..time.."\n--------------------------------------------")
	return changeWorld()
end


And I got this aswell, located at \data\creaturescripts\scripts (setup.lua)
Code:
--[[	
	Script by Shawak
	Login version 4.0
]]--


dofile("war.lua")

local text = "Welcome to JKJLRJ's War server, here a list with all commands:\n!online                  -> See online players\n!uptime                -> See server uptime\n!points                 -> See your points (kill someone to get them)\n!highscore          -> See the highscore"

local Level = getConfigValue("newPlayerLevel")
local Exp = getExperienceForLevel(Level)

function onLogin(cid)

	local outfits = {
		[1] = {
			lookType = math.random(128,134), 
			lookHead = math.random(0,132), 
			lookBody = math.random(0,132), 
			lookLegs = math.random(0,132), 
			lookFeet = math.random(0,132), 
			lookTypeEx = 0, 
			lookAddons = 0
		},
		[2] = {
			lookType = math.random(136,142), 
			lookHead = math.random(0,132), 
			lookBody = math.random(0,132), 
			lookLegs = math.random(0,132), 
			lookFeet = math.random(0,132), 
			lookTypeEx = 0, 
			lookAddons = 0
		}
	}

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	elseif(accountManager == MANAGER_NEW) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if getCreatureName(cid) ~= "Account Manager" and getPlayerGroupId(cid) == 1 then
		
		local vocs = {
			sorc,
			druid,
			paladin,
			knight,
			sorc,
			druid,
			paladin,
			knight
		}

		local voc = vocs[getPlayerVocation(cid)]

		
		if getPlayerLevel(cid) ~= Level or getPlayerMagLevel(cid) ~= voc.MagicLevel or getPlayerMaxCap(cid) ~= voc.Cap or getCreatureMaxHealth(cid) ~= voc.Leben or getCreatureMaxMana(cid) ~= voc.Mana or getPlayerSkillLevel(cid, 0) ~= voc.Fist or getPlayerSkillLevel(cid, 1) ~= voc.Club or getPlayerSkillLevel(cid, 2) ~= voc.Sword or getPlayerSkillLevel(cid, 3) ~= voc.Axe or getPlayerSkillLevel(cid, 4) ~= voc.Dist or getPlayerSkillLevel(cid, 5) ~= voc.Shield then
			doPlayerPopupFYI(cid, "~~ "..getConfigValue('serverName').." Startup ~~\nCharacter Update:\n• Level:       ["..getPlayerLevel(cid).."] -> ["..Level.."]\n• MagicLvl: ["..getPlayerMagLevel(cid).."] -> ["..voc.MagicLevel.."]\n• Hp:             ["..getCreatureMaxHealth(cid).."] -> ["..voc.Leben.."]\n• Mana:        ["..getCreatureMaxMana(cid).."] -> ["..voc.Leben.."]\n• Cap:           ["..getPlayerMaxCap(cid).."] -> ["..voc.Cap.."]\n• Skills:\n    - Fist:          ["..getPlayerSkillLevel(cid, 0).."] -> ["..voc.Fist.."]\n    - Club:         ["..getPlayerSkillLevel(cid, 1).."] -> ["..voc.Club.."]\n    - Sword:     ["..getPlayerSkillLevel(cid, 2).."] -> ["..voc.Sword.."]\n    - Axe:         ["..getPlayerSkillLevel(cid, 3).."] -> ["..voc.Axe.."]\n    - Distance: ["..getPlayerSkillLevel(cid,  4).."] -> ["..voc.Dist.."]\n    - Shielding: ["..getPlayerSkillLevel(cid, 5).."] -> ["..voc.Shield.."]\n\nReason for Update:\nYour character wasn't on the newest update,\nhe/she had a wrong level/magiclevel/skills.\nThis have been fixed, so please login again!")

			pname = getCreatureName(cid)
			pguid = getPlayerGUID(cid)

			doRemoveCreature(cid)

			db.executeQuery("UPDATE `players` SET `save` = 1 WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `health` = "..voc.Leben.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `healthmax` = "..voc.Leben.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `mana` = "..voc.Mana.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `manamax` = "..voc.Mana.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `level` = "..Level.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `experience` = "..Exp.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `maglevel` = "..voc.MagicLevel.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `cap` = "..voc.Cap.." WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `players` SET `lastlogin` = 1249657933 WHERE `name` = '" .. pname .. "';")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Fist.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 0;")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Club.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 1;")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Sword.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 2;")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Axe.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 3;")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Dist.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 4;")
			db.executeQuery("UPDATE `player_skills` SET  `value` =  "..voc.Shield.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 5;")
			db.executeQuery("UPDATE `players` SET `save` = 0 WHERE `name` = '" .. pname .. "';")

			return true
		else
			local outfit = outfits[2-getPlayerSex(cid)]

			registerCreatureEvent(cid, "Idle")
			registerCreatureEvent(cid, "SkullCheck")
			registerCreatureEvent(cid, "ReportBug")
			registerCreatureEvent(cid, "Kill")

        		doPlayerAddAddons(cid, 0)
        		doPlayerAddAddons(cid, 0)

			setPlayerPromotionLevel(cid, 1)
			doCreatureChangeOutfit(cid, outfit)

			doCreatureAddHealth(cid,getCreatureMaxHealth(cid)-getCreatureHealth(cid))
			doCreatureAddMana(cid,getCreatureMaxMana(cid)-getCreatureMana(cid))

			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)

			doPlayerAddEquiqment(cid)

			doTeleportThing(cid, (start_pos[getGlobalStorageValue(world_storage)].positions[math.random(1, #start_pos[getGlobalStorageValue(world_storage)].positions)]))
			doSendMagicEffect(getCreaturePosition(cid),10)
			return true
		end
	end
	return true
end
 
Last edited:
Back
Top