• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Item Add Skills per Storage

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hello guys,

Today, i need an script that add skills or magic level per storage. So, when the player get and use that item, he get X count of skill then the item have a storage to don't use this item again.

Think one quest where the player get and use this item but he can't use this item 2x.

Thanks!
 
edit: ups didn't see he already posted, sorry
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) == 1 then
        if isSorcerer(cid) and getPlayerMagLevel(cid) <= 5 then
            for i = 1, 3 do
                doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation or your magic level is too high.")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return true
end
 
This correct?
edit: ups didn't see he already posted, sorry
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if getPlayerStorageValue(cid, 11111) == 1 then
        if isSorcerer(cid) and getPlayerMagLevel(cid) <= 5 then
            for i = 1, 3 do
                doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
            end
            setPlayerStorageValue(cid, 11111, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation or your magic level is too high.")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return true
end

When i try the script, he say: You already used this item :/ dont work!
 
Thanks brah! How i do to give REP+ for u? @kikos and @Limos
there's no rep but instead you can like the comments! (next to reply buttons)
6d2e861a57888f7f70042af880a60eea.png
 
there's no rep but instead you can like the comments! (next to reply buttons)
6d2e861a57888f7f70042af880a60eea.png


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if  getPlayerStorageValue(cid, 51060) ~= 1 then
if getPlayerSkillLevel(cid, 1) <= 10 or getPlayerSkillLevel(cid, 2) <= 10 or getPlayerSkillLevel(cid, 3) <= 10 then
        if isKnight(cid) then
            local skill, amount = SKILL_SWORD, 70

            for i = 1, amount do
                      doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)
            end
            setPlayerStorageValue(cid, 51060, 1)
        else
            doPlayerSendCancel(cid,"You don't have the required vocation")
            return true
        end
        else
        doPlayerSendCancel(cid,"You already used this item")
    end
    return true
end

Are correct? @Limos @kikos
 
Last edited:
It's missing 1 end atm.

~~~~

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, 51060) ~= 1 then
if getPlayerSkillLevel(cid, 1) <= 10 or getPlayerSkillLevel(cid, 2) <= 10 or getPlayerSkillLevel(cid, 3) <= 10 then
if isKnight(cid) then
local skill, amount = SKILL_SWORD, 70
for i = 1, amount do
doPlayerAddSkillTry(cid, skill, (getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill)), false)​
end
setPlayerStorageValue(cid, 51060, 1)​
else
doPlayerSendCancel(cid,"You don't have the required vocation")​
end​
end
else
doPlayerSendCancel(cid,"You already used this item")​
end
return true​
end

If you tab your scripts you can see if you done that correct.
http://otland.net/threads/how-to-tab-lua-scripts.203763/
 
Back
Top