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

Auto magic level up

Monomalo00

http://leiends.ml/
Joined
Nov 13, 2010
Messages
120
Solutions
1
Reaction score
4
I come here to ask for help me in a bug.
This only happens in the sorcerer and druids, whenever you logout and enter, you up 1 ~ 5 of magic level.
Can help me?

Pd: My server is only war.
 
try , just only up 5 magic level, you wanna random?
Lua:
function onLogin(cid)
playervoc = getPlayerVocation(cid)

 if getPlayerVocation(cid) == 1 or playervoc == 5 or playervoc == 2 or playervoc == 6 then
 	doPlayerAddMagLevel(cid, 5)
end
return TRUE
end
 
try , just only up 5 magic level, you wanna random?
Lua:
function onLogin(cid)
playervoc = getPlayerVocation(cid)

 if getPlayerVocation(cid) == 1 or playervoc == 5 or playervoc == 2 or playervoc == 6 then
     doPlayerAddMagLevel(cid, 5)
end
return TRUE
end

He said it was a bug not that he needed it :p
But maybe he has got something simular on his ot
 
exactly, when you have magic level 80, you up 5 to 5 and when you already have more or less 105 ~ only up in 1 and 1
srry my english , I want to remove it, it is probably a bug of some script, : S, start skills not is
 
is this...

XML:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
	<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
	<event type="login" name="Lowlevellock" event="script" value="lowlevellock.lua"/>
	<event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
	<event type="kill" name="antifreeexp" event="script" value="antifreeexp.lua"/>
    <event type="preparedeath" name="antiloss" script="antiloss.lua"/>
    <event type="kill" name="FragReward" event="script" value="onkill.lua"/>
	<event type="login" name="Skull" event="script" value="Skull.lua"/>
	<event type="kill" name="Skulll" event="script" value="Skull2.lua"/>
	<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
	<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
	<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
	<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
	<event type="think" name="Idle" event="script" value="idle.lua"/>
	<event type="advance" name="MaxLevel" event="script" value="maxlevel.lua"/>
	<event type="advance" name="advance" event="script" value="advance.lua"/>
    <event type="login" name="Welcome" script="welcome.lua"/>
	<event type="login" name="StartSkills" event="script" value="startskills.lua"/>
	<event type="kill" name="PlayerKill" event="script" value="playerkill.lua"/>	
</creaturescripts>

Lua:
dofile("war.lua")

local configs = {
        text = "!t 1 - Kazzordon\n!t 2 - Ab'dendriel\n!t 3 - Ankrahmun\n!t 4 - Wies\n!t 5 - Elf Town\n!t 6 - Forest \n!t 7 - Venore\n!t 8 - Training Monks",
}

local texts = {
	"Welcome to Asteria War, here you can find all commands:",
	"!online                -> See players Online ",
	"!uptime                -> See UPTime of server",
	"!frags                 -> See your Frags",
	"!news                  -> Get News",
	"!t                     -> Go !t and a number EX: !t 1",
	"!go                    -> Change the OUTFIT of your party. Only leaders can do this."
}

local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(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'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end


      for t = 1, #texts do
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, texts[t])
	end

    registerCreatureEvent(cid, 'antiloss')
	registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "Firstitems")
	registerCreatureEvent(cid, "Skull")
	registerCreatureEvent(cid, "Skulll")
    registerCreatureEvent(cid, 'FLook')
	registerCreatureEvent(cid, "Idle")
	registerCreatureEvent(cid, "MaxLevel")
	registerCreatureEvent(cid, "kill")
	registerCreatureEvent(cid, "advance")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end

	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
SQL_COMUNICATION_INTERVAL = SQL_interval * 1000
function onLogin(cid)
	if(InitShopComunication == 0) then
		local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
		InitShopComunication = eventServ
	end
	registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
end
function sql_communication(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
	result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login';"))
	todo = result_plr:fetch({}, "a")
	while todo do
		id = tonumber(todo.id)
		action = tostring(todo.action)
		delete = tonumber(todo.delete_it)
		cid = getPlayerByName(tostring(todo.name))
		if isPlayer(cid) == TRUE then
			local itemtogive_id = tonumber(todo.param1)
			local itemtogive_count = tonumber(todo.param2)
			local container_id = tonumber(todo.param3)
			local container_count = tonumber(todo.param4)
			local add_item_type = tostring(todo.param5)
			local add_item_name = tostring(todo.param6)
			local received_item = 0
			local full_weight = 0
			if add_item_type == 'container' then
				container_weight = getItemWeight(container_id, 1)
				if isItemRune(itemtogive_id) == TRUE then
					items_weight = container_count * getItemWeight(itemtogive_id, 1)
				else
					items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
				end
				full_weight = items_weight + container_weight
			else
				full_weight = getItemWeight(itemtogive_id, itemtogive_count)
				if isItemRune(itemtogive_id) == TRUE then
					full_weight = getItemWeight(itemtogive_id, 1)
				else
					full_weight = getItemWeight(itemtogive_id, itemtogive_count)
				end
			end
			local free_cap = getPlayerFreeCap(cid)
			if full_weight <= free_cap then
				if add_item_type == 'container' then
					local new_container = doCreateItemEx(container_id, 1)
					local iter = 0
					while iter ~= container_count do
						doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
						iter = iter + 1
					end
					received_item = doPlayerAddItemEx(cid, new_container)
				else
					local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
					received_item = doPlayerAddItemEx(cid, new_item)
				end
				if received_item == RETURNVALUE_NOERROR then
					doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
					delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
					assert(con:execute("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";"))
				else
					doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
				end
			else
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
			end
		end
		todo = result_plr:fetch (todo, "a")
	end
	con:close()
	env:close()
	local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)
end
 
Last edited by a moderator:
heree...

Lua:
function onLogin(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56367
local gotSkills = getPlayerStorageValue(cid, 56364)
 
 
if isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,15)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 71))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 71))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
doPlayerAddMagLevel(cid, 9)
setPlayerStorageValue(cid, skillStor, 1)
 
end
return TRUE
end
 
try changed for
Lua:
function onLogin(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56367
local gotSkills = getPlayerStorageValue(cid, 56364)
 
 
if isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,15)))
setPlayerStorageValue(cid, skillStor, 1)
 
elseif isPlayer(cid) and getPlayerVocation(cid) >= 1 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 71))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 71))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
setPlayerStorageValue(cid, skillStor, 1)
 
end
return TRUE
end
and test give same error..
 
you have 1 script you download and i see not edit server.. have function onrandom get addmagiclevel i can see what script but not have errors in console.
 
In startSkills i see one..
doplayer for magiclevel i remove and have same error i really don't know what script Onlogin are edit for give ml..
 
I'm using this one and it's working just fine:

Lua:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56364
local gotSkills = getPlayerStorageValue(cid, 56364)


if playerVoc == 5 and gotSkills == -1 or playerVoc == 1 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,70)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 6 and gotSkills == -1 or playerVoc == 2 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,70)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 7 and gotSkills == -1 or playerVoc == 3 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 80))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 80))
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,25)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 8 and gotSkills == -1 or playerVoc == 4 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 80))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 80))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 80))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 80))
doPlayerAddMagLevel(cid, 10)
setPlayerStorageValue(cid, skillStor, 1)

end
return TRUE
end
 
Back
Top