• 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 Second promotion (TFS 1.1)

ibkfly

New Member
Joined
Jan 1, 2010
Messages
69
Reaction score
4
Hello, i need help with my action script for second promotion. When i use the item, nothing happens. The item id is correct. I use TFS 1.1.

Thanks in advance :)


Code:

function onUse(cid, item, frompos, itemEx, topos)
local player = Player(cid)
local vocs = {11,12,13,14,15,18}
if player:getLevel() < 1000 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to be level 1000 or higher to use this!")
end
if isInArray(vocs,player:getVocation()) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already got your second promotion!")
return false
else
local vucs = {1,2,3,4,9,16}
if isInArray(vucs,player:getVocation()) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to get your first promotion before using this!")
else
-- If master sorcerer
if player:getVocation() == 5 then
player:setVocation(11)
item:remove(item.uid)
-- If elder druid
elseif player:getVocation() == 6 then
player:setVocation(12)
item:remove(item.uid)
-- If royal paladin
elseif player:getVocation() == 7 then
player:setVocation(13)
item:remove(item.uid)
-- If elite knight
elseif player:getVocation() == 8 then
player:setVocation(14)
item:remove(item.uid)
elseif player:getVocation() == 10 then
player:setVocation(15)
item:remove(item.uid)
elseif player:getVocation() == 17 then
player:setVocation(18)
item:remove(item.uid)
end
end
end
return true
end
 
Code:
local vocs = {
    nonPromoted = {1, 2, 3, 4, 9, 16},
    promoted = {11, 12, 13, 14, 15, 18},
    setPromotion = {
        [5] = 11,
        [6] = 12,
        [7] = 13,
        [8] = 14,
        [10] = 15,
        [17] = 18
    }
}
function onUse(player, item, fromPosition, target, toPosition)
    local vocId = player:getVocation():getId()
    if player:getLevel() < 1000 then
        return player:sendTextMessage(MESSAGE_INFO_DESCR, "You need to be level 1000 or higher to use this!") and false
    end

    if isInArray(vocs.promoted, vocId) then
        return player:sendTextMessage(MESSAGE_INFO_DESCR, "You have already got your second promotion!") and false
    elseif isInArray(vocs.nonPromoted, vocId) then
        return player:sendTextMessage(MESSAGE_INFO_DESCR, "You need to get your first promotion before using this!") and false
    end

    player:setVocation(vocs.setPromotion[vocId])
    item:remove()
    return true
end
 
Back
Top