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

Whats wrong?

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
I create that script, script give magic level on use quest depends of your vocation... but that not work


whats wrong?
LUA:
local cfg = {
	questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
	questChestStorage = 45568 -- if you have made a copy of this file and has changed the aid make sure you change the storage too, storage must be an unused storage.--
	}
local vocQ = {
        [1] = {maglvl = 60}, -- specify the item that you want to give.--
        [2] = {maglvlm = 60}, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {maglvl = 20}, 
        [4] = {maglvl = 9}
        }
function onUse(cid, maglvl, toPosition, itemEx, fromPosition)
    for voc, i in pairs(vocQ) do
        if maglvl.actionid == cfg.questChestAId then
            local opened = getPlayerStorageValue(cid, cfg.questChestStorage)
            if opened == -1 then
                doPlayerSetStorageValue(cid, cfg.questChestStorage, 1)
                    if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
                        doPlayerAddMagLevel(cid, i.maglvl)
                        doPlayerSendTextMessage(cid, 25, "You recieved magic level 60")
                    end
            else
                doPlayerSendCancel(cid, "You have already recieved your magic level.")
			end
        end
    end
return true
end

Extra: I dont create this script I only edit to add magic level but not work :S
anyone can help me?
 
I edit your script :P here u go
[NOT TESTED I SCRIPT FOR U]
LUA:
function onUse(cid, item, frompos, item2, topos)
questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
queststatus = getPlayerStorageValue(cid,45568)
topos = getPlayerPosition(cid)

if item.actionid == 1555 and queststatus == -1 and getPlayerVocation(cid) == 1 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end

elseif item.actionid == 1555 and queststatus == -1 and getPlayerVocation(cid) == 2 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end

elseif item.actionid == 1555 and queststatus == -1 and getPlayerVocation(cid) == 3 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 20")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 20)
end

elseif item.actionid == 1555 and queststatus == -1 and getPlayerVocation(cid) == 4 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 9")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 9)
end

elseif queststatus == 1 then
doPlayerSendCancel(cid, "You have already recieved your magic level.")
doSendMagicEffect(topos, CONST_ME_POFF)   
end
    return TRUE
               end
 
I test it and dont work... And I think that script need local I put local but dont work...
HELP PLEASE!

LUA:
function onUse(cid, item, frompos, item2, topos)
local config = {
questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
queststatus = getPlayerStorageValue(cid,45568)
topos = getPlayerPosition(cid)
}
 
if item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 1 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 2 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 3 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 20")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 20)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 4 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 9")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 9)
end
 
elseif queststatus == 1 then
doPlayerSendCancel(cid, "You have already recieved your magic level.")
doSendMagicEffect(topos, CONST_ME_POFF)   
end
    return TRUE
               end
 
LUA:
local cfg = {
	questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
	questChestStorage = 45568 -- if you have made a copy of this file and has changed the aid make sure you change the storage too, storage must be an unused storage.--
	}
	
local vocQ = {
        [1] = {maglvl = 60}, -- specify the item that you want to give.--
        [2] = {maglvl = 60}, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {maglvl = 20}, 
        [4] = {maglvl = 9}
    }
		
function onUse(cid, maglvl, toPosition, itemEx, fromPosition)
    for voc, i in pairs(vocQ) do
        if maglvl.actionid == cfg.questChestAId then
            local opened = getPlayerStorageValue(cid, cfg.questChestStorage)
            if opened ~= -1 then
				return doPlayerSendCancel(cid, "You have already recieved your magic level.")
			end
			
			if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
				doPlayerAddMagLevel(cid, i.maglvl)
				doPlayerSendTextMessage(cid, 25, "You recieved magic level 60")
				doPlayerSetStorageValue(cid, cfg.questChestStorage, 1)
				return true
			end
        end
    end
	
	return true
end
 
Try and if doesnt work post the prints on console.

LUA:
local cfg = {
	questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
	questChestStorage = 45568 -- if you have made a copy of this file and has changed the aid make sure you change the storage too, storage must be an unused storage.--
	}
local vocQ = {
        [1] = {maglvl = 60}, -- specify the item that you want to give.--
        [2] = {maglvlm = 60}, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {maglvl = 20}, 
        [4] = {maglvl = 9}
        }
function onUse(cid, maglvl, toPosition, itemEx, fromPosition)
    for voc, i in pairs(vocQ) do
        if maglvl.actionid == cfg.questChestAId then
            local opened = getPlayerStorageValue(cid, cfg.questChestStorage)
            if opened == -1 then
                    if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
                        doPlayerAddMagLevel(cid, i.maglvl)
                        setPlayerStorageValue(cid, cfg.questChestStorage, 1)
                        doPlayerSendTextMessage(cid, 25, "You recieved magic level 60")
                        print("Add: "..i.maglvl..".")
            else
                doPlayerSendCancel(cid, "You have already recieved your magic level.")
			end
                end
        end
    end
return true
end
 
I tested my script and works per vocation, what error have you in console? are u sure have actionid correct?
Remember here: actionid == 1555
What actionid are you.. you need see script and edit
 
@ Cronox you script doesn't work for me...
@ Summ you script work but give me a freeze when use in the first time =S

- - - Updated - - -

I only want druids and sorcerers start with ML 60...
 
with summ script nothing, but that give me a freze when use

and with your script
48hoY.png


- - - Updated - - -

I think fuction doPlayerAddMagLevel give a freezes, have other fuction to give magic? setmagiclevel idk
 
To fix that error:

LUA:
function onUse(cid, item, frompos, item2, topos)
local config = {
questChestAId = 2999, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
queststatus = getPlayerStorageValue(cid,45568),
topos = getPlayerPosition(cid)
}
 
if item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 1 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 2 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 60")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 60)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 3 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 20")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 20)
end
 
elseif item.actionid == 2999 and queststatus == -1 and getPlayerVocation(cid) == 4 then
setPlayerStorageValue(cid,45568,1)
doPlayerSendTextMessage(cid, 24, "You recieved magic level 9")
doSendMagicEffect(topos,30)
doPlayerAddMagLevel(cid, 9)
end
 
elseif queststatus == 1 then
doPlayerSendCancel(cid, "You have already recieved your magic level.")
doSendMagicEffect(topos, CONST_ME_POFF)   
end
    return TRUE
               end

But, you should use Summ's script.

Also, the reason why it lags is because it's not getting you to ML 60 at once, it's adding all the magic level 1 by 1 until 60.
 
ahh is why don't
local config = {

Use my script edit by Evan and works.

but made by is not getting you to ML 60 at once
i test script and works fine.. don't give me lags i tested in my ot SearzOnline
and nothing error 0 frezz
 
I post that Cronox haha... Now I testing script of Evan :)

- - - Updated - - -

Evan that dont work... IDK whats wrong =S
01816cbf13ce4eceb6b4683.png

MuIsL.png

iEWrC.png


- - - Updated - - -

______________________
Even its possible to add 60 magic levels in one time? how I can solution my problem =S

- - - Updated - - -

Exits fuction to set magiclevel to 60? one Idea to add magic level in onetime
 

Attachments

Last edited:
Why your chest have
uniqueid and actionid same -.^
only need have actionid, not need use 2..
what error have in console my script? or don't give magic level?
 
Back
Top