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

Fix give level script if under lvl 8

Lillylove

Joined
Jun 6, 2016
Messages
47
Reaction score
11
Location
In A House
Code:
function onUse(cid,item,fromPosition,itemEx,toPosition)
   local storage = 4040
    getPlayerLevel(cid) > 8 then 
     doPlayerAddLevel(cid, 1, false) 
  doPlayerSendTextMessage(cid,21,"Gained 1 Levels!") 
   end
   return true
end
Hi this does not work for me TFS 0.3.6
 
Code:
function onUse(cid,item,fromPosition,itemEx,toPosition)
   local storage = 4040
    if getPlayerLevel(cid) > 8 then
     doPlayerAddLevel(cid, 1, false)
doPlayerSendTextMessage(cid,21,"Gained 1 Levels!")
   end
   return true
end

Also you defined storage, but didnt add storage check.

Code:
 if getPlayerStorage(storage) ~= 1 then
doPlayerAddStorage(storage, 1)
else
doPlayerSendTextMessage(cid, 21, "Sorry not possible")
end
It's just example use your tfs functions and that's all.
 
Last edited:
Using a couple assumptions based on the request, I assume this is what you want to happen.

Click Once.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerLevel(cid) < 8 then
        local amount = 8 - getPlayerLevel(cid)
        for i = 1, amount do
            doPlayerAddLevel(cid, 1, true)
        end
        doPlayerSendTextMessage(cid, 21, "You have advanced to level " .. getPlayerLevel(cid) .. "!")
    end
    return true
end
Click Multiple Times.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerLevel(cid) < 8 then
        doPlayerAddLevel(cid, 1, true)
        doPlayerSendTextMessage(cid, 21, "You have advanced to level " .. getPlayerLevel(cid) .. "!")
    end
    return true
end
 
Back
Top Bottom