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

Server crash

zayat

New Member
Joined
May 12, 2009
Messages
347
Reaction score
2
Why when I open my server and then when a player login my server automatically crashes??
 
This bug happened when I edited the login.lua
PHP:
local loginMessage = getConfigValue('loginMessage')

local exhaust = createConditionObject(CONDITION_INFIGHT)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)

local t = {
	voc = {
		{ -- SORC
			{2190}, -- wand of vortex
			{2175}, -- spellbook
			{8820}, -- mage hat
			{8819} -- mage robe
		},
		{ -- DRUID
			{2182}, -- snakebite rod
			{2175}, -- spellbook
			{8820}, -- mage hat
			{8819} -- mage robe
		},
		{ -- PALADIN
			{2389}, -- spear
			{2530}, -- copper shield
			{2457}, -- legion helmet
			{2660} -- chain armor
		},
		{ -- KNIGHT
			{2409}, -- serpent sword
			{2530}, -- copper shield
			{2457}, -- legion helmet
			{2465} -- chain armor
		}
	},
	all = {
		{2478}, -- brass legs
		{2643} -- leather boots
	},
	extra = {
		{2789, 15},
		{2160, 2},
		{2120},
		{5710}

	},
	knight = {
		{2429}, -- clerical mace
		{2423} -- barbarian axe
	}
}

function onLogin(cid)
	doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 100)
	doAddCondition(cid, exhaust)

	if isPlayerGhost(cid) == false then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	local lastLogin, str = getPlayerLastLoginSaved(cid), loginMessage
	if lastLogin == 0 then
		str = str .. " Please choose your outfit."
		doPlayerSendOutfitWindow(cid)
		if getPlayerGroupId(cid) < 3 then
			for _, v in ipairs(t.voc[getPlayerVocation(cid)]) do
				doPlayerAddItem(cid, v[1], v[2] or 1)
			end
 
			for _, v in ipairs(t.all) do
				doPlayerAddItem(cid, v[1], v[2] or 1)
			end

			local bp = doPlayerAddItem(cid, 1988, 1)
			for _, v in ipairs(t.extra) do
				doAddContainerItem(bp, v[1], v[2] or 1)
			end
 
			if isKnight(cid) then
				for _, w in ipairs(t.knight) do
					doAddContainerItem(bp, w[1], w[2] or 1)
				end
			end
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
		str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "Idle")

	registerCreatureEvent(cid, "Forever Aol")
	--registerCreatureEvent(cid, "pacmanhandle")
	registerCreatureEvent(cid, "zombieevent")
	registerCreatureEvent(cid, "DeathBroadcast")
	registerCreatureEvent(cid, "buffout")
	registerCreatureEvent(cid, "inquisitionPortals")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "ArenaKill")
	registerCreatureEvent(cid, "reward")
	registerCreatureEvent(cid, "PythiusTheRotten")
	registerCreatureEvent(cid, "BossKill")
	registerCreatureEvent(cid, "ArenaDeath")
	registerCreatureEvent(cid, "KillingInTheNameOf")
	registerCreatureEvent(cid, "pointsforlvl")
	registerCreatureEvent(cid, "Elemental")
	registerCreatureEvent(cid, "Antibot")

	doCreatureSetStorage(cid, 50300)
	doCreatureSetStorage(cid, 77700)

	for i = 1, 3 do
		if getCreatureStorage(cid, 42300 + i * 10 - 1) < 1 then
			for j = 0, 9 do
				doCreatureSetStorage(cid, 42290 + i * 10 + j)
			end
		end
	end
	doCreatureSetStorage(cid, 42350) -- time to kick 0
	doCreatureSetStorage(cid, 42352) -- is not in arena

	return true
end
 
Firstitems.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			items = {2050, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="script"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
			if(getPlayerStorageValue(cid, config.storage) > 0) then
				return true
			end

			for _, id in ipairs(config.items) do
				doPlayerAddItem(cid, id, 1)
			end

			if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
				doPlayerAddItem(cid, 2651, 1)
			else
				doPlayerAddItem(cid, 2650, 1)
			end

			doAddContainerItem(doPlayerAddItem(cid, 1987, 1), 2674, 1)
			setPlayerStorageValue(cid, config.storage, 1)
			return true
		end
	]]></event>
</mod>
I want to add the items as in login.lua
 
I will put the Original one back but I need to add the items on my Login.lua ^ on firstitems.xml but it gets buggy when I edit it so I need someone to help me do that!
Giving Rep++ for anyone who helps me.
 
Back
Top