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

Solved Skill Quest error with Knight

juansanchez

Intermediate OT User
Joined
Apr 2, 2015
Messages
217
Reaction score
129
Hey otland people, i need some assistance today with a script i have. I have this script for a quest, which gives the players skills, however i have a problem with Knight, since knights use either axe/sword/club i tried to make it so the quest would give the player the which ever skill is higher, if his club skill is higher than his sword one, he would get the club bonus, and so on... However it didn't work. And i also tried to make is the player would get bonus in all the skill, club/axe/sword. And it also didn't work. Everytime i tried to do something, the player would get only one skill, for example he would only get sword skill, or only axe, no matter what skill he was.

I was wondering if you guys could help me out, even it has to give all the skill, it's fine.

Here's the script:

function onUse(cid, item, frompos, item2, topos)
voc = getPlayerVocation(cid)
pos = getPlayerPosition(cid)
if voc == 5 or voc == 6 or voc == 12 then
stor = getPlayerStorageValue(cid,2357)
if stor == -1 then
setPlayerStorageValue(cid,2357,1)
doPlayerSetMagic(cid, getPlayerMagLevel(cid)+4)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(pos, "Magic Up", TEXTCOLOR_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
elseif voc == 7 then
stor = getPlayerStorageValue(cid,2357)
if stor == -1 then
setPlayerStorageValue(cid,2357,1)
doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE)+12)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(pos, "Distance Up", TEXTCOLOR_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
elseif voc == 10 then
stor = getPlayerStorageValue(cid,2357)
if stor == -1 then
setPlayerStorageValue(cid,2357,1)
doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB)+12)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(pos, "Club Up", TEXTCOLOR_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
elseif voc == 14 then
stor = getPlayerStorageValue(cid,2357)
if stor == -1 then
setPlayerStorageValue(cid,2357,1)
doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST)+12)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(pos, "Fist UP", TEXTCOLOR_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
elseif voc == 8 then
stor = getPlayerStorageValue(cid,2357)
if stor == -1 then
setPlayerStorageValue(cid,2357,1)
doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD)+12)
doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE)+12)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(pos, "Axe e Sword Up", TEXTCOLOR_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end

I'm using TFS 0.3.7
 
Hmm, it should not do that because it returns false if the player has the storage

But however you can replace function onUse...
with this:
Code:
function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(position, CONST_ME_POFF)
        return false
    else
        if pV == 5 or pV == 6 or pV == 12 then
            raiseMagic(cid)
        elseif pV == 7 then
            raiseDist(cid)
        elseif pV == 10 then
            raiseClub(cid)
        elseif pV == 14 then
            raiseFist(cid)
        elseif pV == 8 then
            checkHighest(cid)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
   
    return true
end
 
Hmm, it should not do that because it returns false if the player has the storage

But however you can replace function onUse...
with this:
Code:
function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(position, CONST_ME_POFF)
        return false
    else
        if pV == 5 or pV == 6 or pV == 12 then
            raiseMagic(cid)
        elseif pV == 7 then
            raiseDist(cid)
        elseif pV == 10 then
            raiseClub(cid)
        elseif pV == 14 then
            raiseFist(cid)
        elseif pV == 8 then
            checkHighest(cid)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
  
    return true
end

Same thing, but i belive is because of this:

[17:12:15.699] [Error - Action Interface]
[17:12:15.700] data/actions/scripts/arquivo.lua:eek:nUse
[17:12:15.700] Description:
[17:12:15.701] attempt to index a nil value
[17:12:15.701] stack traceback:
[17:12:15.701] [C]: in function 'doSendMagicEffect'
[17:12:15.701] data/actions/scripts/arquivo.lua:31: in function 'raiseSword'
[17:12:15.702] data/actions/scripts/arquivo.lua:55: in function 'checkHighest'
[17:12:15.702] data/actions/scripts/arquivo.lua:79: in function <data/actions/s
cripts/arquivo.lua:61>

Would you mind creating the fuctions? So i can add them?
 
the problem is in doSendMagicEffect

you have: doSendMagicEffect(frompos, 28)
but the variable frompos does not exist in that scope, so it's a nil value.
every doSendMagicEffect(frompos, 28)
has to be changed to doSendMagicEffect(getPlayerPosition(cid), 28)
 
the problem is in doSendMagicEffect

you have: doSendMagicEffect(frompos, 28)
but the variable frompos does not exist in that scope, so it's a nil value.
every doSendMagicEffect(frompos, 28)
has to be changed to doSendMagicEffect(getPlayerPosition(cid), 28)

Now this:

[17:37:20.030] [Error - Action Interface]
[17:37:20.030] data/actions/scripts/arquivo.lua:eek:nUse
[17:37:20.031] Description:
[17:37:20.032] (luaDoCreatureSetStorage) Creature not found
[17:37:20.606] Testero has logged in.
 
post your full script now please

that error shouldnt come unless you pass a wrong creature / got a typo at cid

Here you go:
Code:
function raiseMagic(cid)
    doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
     doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Magic Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function raiseDist(cid)
    doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
     doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Distance Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function raiseFist(cid)
    doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
     doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Fist Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function raiseClub(cid)
    doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Club Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function raiseSword(cid)
    doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
     doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Sword Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function raiseAxe(cid)
    doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
     doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(position, "Axe Up", TEXTCOLOR_BLUE)
    setPlayerStorageValue(cid, 2357, 1)
end

function checkHighest(cid)
    local highest = "SKILL_CLUB"
    if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_SWORD"
    end
    if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_AXE"
    end

    if highest == "SKILL_CLUB" then
        raiseClub(cid)
    elseif highest == "SKILL_SWORD" then
        raiseSword(cid)
    else
        raiseAxe(cid)
    end
end

function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(position, CONST_ME_POFF)
        return false
    else
        if pV == 5 or pV == 6 or pV == 12 then
            raiseMagic(cid)
        elseif pV == 7 then
            raiseDist(cid)
        elseif pV == 10 then
            raiseClub(cid)
        elseif pV == 14 then
            raiseFist(cid)
        elseif pV == 8 then
            checkHighest(cid)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
  
    return true
end
 
Last edited by a moderator:
The part where i gives the skill worked, whichever skill is higher is the one the player will get, but the player can do the quest as many times as he wishes, so he keeps on using the chest and getting skills
Change it back to what you had back here..
Instead of return false, use return true.
 
Maybe it doesn't pass the cid right for some reason..
I moved the set storage thing:
Code:
function raiseMagic(cid)
    doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
end

function raiseDist(cid)
    doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
end

function raiseFist(cid)
    doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
end

function raiseClub(cid)
    doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
end

function raiseSword(cid)
    doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
end

function raiseAxe(cid)
    doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
end

function checkHighest(cid)
    local highest = "SKILL_CLUB"
    if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_SWORD"
    end
    if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_AXE"
    end

    if highest == "SKILL_CLUB" then
        raiseClub(cid)
    elseif highest == "SKILL_SWORD" then
        raiseSword(cid)
    else
        raiseAxe(cid)
    end
end

function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return false
    else
        if pV == 5 or pV == 6 or pV == 12 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseMagic(cid)
        elseif pV == 7 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseDist(cid)
        elseif pV == 10 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseClub(cid)
        elseif pV == 14 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseFist(cid)
        elseif pV == 8 then
            setPlayerStorageValue(cid, 2357, 1)
            checkHighest(cid)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

    return true
end
 
Maybe it doesn't pass the cid right for some reason..
I moved the set storage thing:
Code:
function raiseMagic(cid)
    doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
end

function raiseDist(cid)
    doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
end

function raiseFist(cid)
    doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
end

function raiseClub(cid)
    doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
end

function raiseSword(cid)
    doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
end

function raiseAxe(cid)
    doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
    doSendMagicEffect(getPlayerPosition(cid), 28)
    doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
end

function checkHighest(cid)
    local highest = "SKILL_CLUB"
    if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_SWORD"
    end
    if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
        highest = "SKILL_AXE"
    end

    if highest == "SKILL_CLUB" then
        raiseClub(cid)
    elseif highest == "SKILL_SWORD" then
        raiseSword(cid)
    else
        raiseAxe(cid)
    end
end

function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return false
    else
        if pV == 5 or pV == 6 or pV == 12 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseMagic(cid)
        elseif pV == 7 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseDist(cid)
        elseif pV == 10 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseClub(cid)
        elseif pV == 14 then
            setPlayerStorageValue(cid, 2357, 1)
            raiseFist(cid)
        elseif pV == 8 then
            setPlayerStorageValue(cid, 2357, 1)
            checkHighest(cid)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

    return true
end

Now when i click nothing happens '-' and it doesn't show any error on the console
 
I'm getting frustrated with this already lol
now everything in onUse:
Code:
function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    else
        if pV == 5 or pV == 6 or pV == 12 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
        elseif pV == 7 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
        elseif pV == 10 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
        elseif pV == 14 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
        elseif pV == 8 then
            setPlayerStorageValue(cid, 2357, 1)
           
            local highest = "SKILL_CLUB"
            if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_SWORD"
            end
            if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_AXE"
            end

            if highest == "SKILL_CLUB" then
                doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
            elseif highest == "SKILL_SWORD" then
                doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
            else
                doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

    return true
end
 
I'm getting frustrated with this already lol
now everything in onUse:
Code:
function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    else
        if pV == 5 or pV == 6 or pV == 12 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
        elseif pV == 7 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
        elseif pV == 10 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
        elseif pV == 14 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
        elseif pV == 8 then
            setPlayerStorageValue(cid, 2357, 1)
          
            local highest = "SKILL_CLUB"
            if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_SWORD"
            end
            if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_AXE"
            end

            if highest == "SKILL_CLUB" then
                doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
            elseif highest == "SKILL_SWORD" then
                doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
            else
                doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

    return true
end

Would you be mad if i said it didn't work? :S

[17:43:21.264] [Error - Action Interface]
[17:43:21.265] data/actions/scripts/arquivo.lua:eek:nUse
[17:43:21.266] Description:
[17:43:21.268] data/actions/scripts/arquivo.lua:41: attempt to call global 'doPl
ayerSetSkill' (a nil value)
[17:43:21.268] stack traceback:
[17:43:21.269] data/actions/scripts/arquivo.lua:41: in function <data/actions/s
cripts/arquivo.lua:1>

The player right clicks the chest, the chest opens but nothing happens, and when he tries again it says he already did the quest.
 
Oh, I think the SKILL_CLUB, SKILL_AXE etc.
must all have "" like "SKILL_CLUB"...
Because the rror shows, right now he doesnt know where to set the skills he cant find the given skill, so I think it misses " "

I'm not mad, but this is kind of one very very very very easy script..
Just a big amount of small misstakes, if I had like access etc i would have fixed it to work perfectly in 10min
 
Reset it to this state please, and tell me what the error is, and if it happens with all characters or just some vocations
Code:
function onUse(cid, item, frompos, item2, topos)
    local pS = getPlayerStorageValue(cid, 2357)
    local pV = getPlayerVocation(cid)

    if pS > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    else
        if pV == 5 or pV == 6 or pV == 12 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetMagic(cid, getPlayerMagLevel(cid) + 4)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
        elseif pV == 7 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_DISTANCE, getPlayerSkillLevel(cid, SKILL_DISTANCE) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
        elseif pV == 10 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
        elseif pV == 14 then
            setPlayerStorageValue(cid, 2357, 1)
            doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST) + 12)
            doSendMagicEffect(getPlayerPosition(cid), 28)
            doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
        elseif pV == 8 then
            setPlayerStorageValue(cid, 2357, 1)
          
            local highest = "SKILL_CLUB"
            if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_SWORD"
            end
            if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
                highest = "SKILL_AXE"
            end

            if highest == "SKILL_CLUB" then
                doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
            elseif highest == "SKILL_SWORD" then
                doPlayerSetSkill(cid, SKILL_SWORD, getPlayerSkillLevel(cid, SKILL_SWORD) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
            else
                doPlayerSetSkill(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 12)
                doSendMagicEffect(getPlayerPosition(cid), 28)
                doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

    return true
end
 
[18:42:03.669] [Error - Action Interface]
[18:42:03.670] data/actions/scripts/arquivo.lua:eek:nUse
[18:42:03.671] Description:
[18:42:03.672] data/actions/scripts/arquivo.lua:41: attempt to call global 'doP
ayerSetSkill' (a nil value)
[18:42:03.673] stack traceback:
[18:42:03.674] data/actions/scripts/arquivo.lua:41: in function <data/actions/
cripts/arquivo.lua:1>

This happend, to all vocations.
 
Back
Top