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

[8.6] [TFS 0.3.6] Need help:/

Lalo I

Accepting Dms
Joined
Jul 10, 2018
Messages
52
Reaction score
6
Location
USA
Hello I have various problems, but the first one is, how do I edit this into just giving the ML to Mages, vocations (1,2)

Code:
local exp = 4000 -- Quanto de ML o player irá ganhar?!
local exhaust = 120 -- Tempo para o player poder usar o item novamente! (tempo em segundos)
local text = "Magic Power Up!"
local storage = 9811 -- Não mexa aqui.

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(isInArray({1, 2}, getPlayerVocation(cid)))then
doPlayerAddMagLevel(cid, exp)
doCreatureSay(cid, text, 19)
doSendMagicEffect(getCreaturePosition(cid), 14)
doRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, os.time()+exhaust)
else
doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.")
end
return TRUE
end

I can't get it to work even with getplayervocation, any help please
 
Are you trying to make magic level scroll? You can try this and edit values level/magic level for every vocation (make it 0 for eks/pallies) if you want them not to get magic level.
Lua:
local t = {
        [{1, 5}] = {100, 1}, -- {MAX_LEVEL, MLVL}
        [{2, 6}] = {100, 1},
       [{3, 7}] = {25, 1},
         [{4, 8}] = {10, 1}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    for voc, b in pairs(t) do
        if(isInArray(voc, getPlayerVocation(cid))) then
            if(getPlayerMagLevel(cid) < b[1]) then
                for i = 1, b[2] do
                    doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid)), false)
                end
                doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                doRemoveItem(item.uid, 1)
            else
                return doPlayerSendCancel(cid, "You have reached the maximum level.")
            end
        end
    end
    return true
end
 
Didn't work, but got it to fix, thank you
People who looking for it here it is

Code:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 8304 then

rand = math.random(1,1)

if(isInArray({1, 2, 3, 4}, getPlayerVocation(cid)))then
doPlayerAddSpentMana(cid, 4100)
doRemoveItem(item.uid,1)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(getPlayerPosition(cid), "Magic Up!", TEXTCOLOR_BLUE)

end
end
return 1
end
 
Didn't work, but got it to fix, thank you
People who looking for it here it is

Code:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 8304 then

rand = math.random(1,1)

if(isInArray({1, 2, 3, 4}, getPlayerVocation(cid)))then
doPlayerAddSpentMana(cid, 4100)
doRemoveItem(item.uid,1)
doSendMagicEffect(frompos, 28)
doSendAnimatedText(getPlayerPosition(cid), "Magic Up!", TEXTCOLOR_BLUE)

end
end
return 1
end
Great, just mark your thread as solved.
 
Back
Top