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

Lua Error in Script

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
Chest for Knight and Paladin doesn't working,someone can help me?

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local action = 50002 -- put the Actionid of the chest
local vocation = getPlayerVocation(cid)
local smanaspent = 10 --ammount of mana spent you want / this adds mlevel for sorcerer, druid
local pmanaspent = 5 --ammount of mana spent you want / this adds mlevel for paladin
local axe = 5 -- number of distance tries to add
local shield = 5 -- number of distance tries to add
local distance = 6 -- number of distance tries to add
local sorcerer = 1
local druid = 2
local paladin = 3
local knight = 4
local mastersorcerer = 5
local elderdruid = 6
local royalpaladin = 7
local eliteknight = 8
 
    if item.uid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == sorcerer or vocation == mastersorcerer or vocation == druid or vocation == elderdruid then
                        doPlayerAddSpentMana(cid, smanaspent)
                        doPlayerAddLevel(cid, 30)
                        doPlayerAddItem(cid,8918,1)
               doPlayerAddItem(cid,2420,1)
                        doPlayerAddItem(cid,8871,1)
                        doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
 
 
    elseif item.actionid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == paladin or vocation == royalpaladin then
                        doPlayerAddSkillTry(cid, 4, distance)
                        doPlayerAddLevel(cid, 30)
               doPlayerAddItem(cid,2420,1)
               doPlayerAddItem(cid,8891,1)
			doPlayerAddSpentMana(cid, pmanaspent)
                        doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
 
    elseif item.actionid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == knight or vocation == eliteknight then
			doPlayerAddSkillTry(cid, 3, axe)
                        doPlayerAddLevel(cid, 30)
                        doPlayerAddItem(cid,8882,1)
                        doPlayerAddItem(cid,2420,1)
               doPlayerAddItem(cid,8924,1)
			doPlayerAddSkillTry(cid, 5, shield)
                        doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
        end
end
 
Hmm it's my script..
dude i scripting fast this..
knigth and paladin no give level and ML in chest? or skills only
no is in
doPlayerAddSkillTry(cid, 5, shield)
 
hmm
try now

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local action = 50002 -- put the Actionid of the chest
local vocation = getPlayerVocation(cid)
local smanaspent = 10 --ammount of mana spent you want / this adds mlevel for sorcerer, druid
local pmanaspent = 5 --ammount of mana spent you want / this adds mlevel for paladin
local axe = 5 -- number of distance tries to add
local shield = 5 -- number of distance tries to add
local distance = 6 -- number of distance tries to add
local skills = { SKILL_FIST = 10, SKILL_CLUB = 10, SKILL_SWORD = 10, SKILL_AXE = 10, SKILL_DISTANCE = 10, SKILL_SHIELD = 10, SKILL_FISHING = 10 }
local sorcerer = 1
local druid = 2
local paladin = 3
local knight = 4
local mastersorcerer = 5
local elderdruid = 6
local royalpaladin = 7
local eliteknight = 8
 
    if item.uid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == sorcerer or vocation == mastersorcerer or vocation == druid or vocation == elderdruid then
                        doPlayerAddSpentMana(cid, smanaspent)
                        doPlayerAddLevel(cid, 30)
                        doPlayerAddItem(cid,8918,1)
               doPlayerAddItem(cid,2420,1)
                        doPlayerAddItem(cid,8871,1)
                        doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
 
 
    elseif item.actionid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == paladin or vocation == royalpaladin then
                        doPlayerAddSkillTry(cid, SKILL_DISTANCE, 4)
                        doPlayerAddLevel(cid, 30)
               doPlayerAddItem(cid,2420,1)
               doPlayerAddItem(cid,8891,1)
			doPlayerAddSpentMana(cid, pmanaspent)
                        doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
 
    elseif item.actionid == action then
            if getPlayerStorageValue(cid,action) == -1 then
                    if vocation == knight or vocation == eliteknight then
			doPlayerAddSkillTry(cid, SKILL_AXE, 3)
                        doPlayerAddLevel(cid, 30)
                        doPlayerAddItem(cid,8882,1)
                        doPlayerAddItem(cid,2420,1)
               doPlayerAddItem(cid,8924,1)
            doPlayerAddSkillTry(cid, SKILL_SHIELD, 5)
            doPlayerSendTextMessage(cid,25, "Here is your reward.")
                        setPlayerStorageValue(cid,action,1)
                    end
            else
                    doPlayerSendCancel(cid,"You already got your reward!")
            end
        end
end
 
When you check UniqueID with ActionID the script works, but when you check ActionID with ActionID it doesn't, someone's doing something wrong here..
 
Back
Top