• 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 Super Vocation

freddzor11

Member
Joined
May 25, 2009
Messages
695
Reaction score
5
Hello I want a script, when I click on the item I will be promoted with super vocation, now I got this and it's not exactly what Im looking for...
Code:
function onSay(cid, words, param, channel)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, cost = 100000, msgtype = MESSAGE_STATUS_CONSOLE_BLUE }
    if getPlayerStorageValue(cid, cfg.storage) == -1 then
        if getPlayerLevel(cid) >= cfg.level then
            if isInArray(cfg.vocs, getPlayerVocation(cid)) == true then
                if (getPlayerMoney(cid) >= cfg.cost) then
		    doPlayerRemoveMoney(cid, cfg.cost)
                    setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You have been promoted to ".. getVocationInfo(getPlayerVocation(cid)).name ..".")
                    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
                    setPlayerStorageValue(cid, cfg.storage, 1)
                else
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You need ".. cfg.cost .." gold coins to purchase the second promotion.")
                end
            else
                doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get the second promotion.")
            end
        else
            doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, may purchase the second promotion.")
        end
    else
        doPlayerSendTextMessage(cid, cfg.msgtype, "You have already purchased the second promotion.")
    end
    return true
end
 
Then what are you exactly looking for, can you tell which part of this script you want different and what exactly do you want it to do?
 
As I said, I want just to click at the brain and then I will get superpromotion, not that I need to have cash in the hand etc...
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, msgtype = MESSAGE_STATUS_CONSOLE_BLUE }
    if getPlayerStorageValue(cid, cfg.storage) == -1 then
        if getPlayerLevel(cid) >= cfg.level then
            if isInArray(cfg.vocs, getPlayerVocation(cid)) == true then
                    setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You have been promoted to ".. getVocationInfo(getPlayerVocation(cid)).name ..".")
                    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
                    setPlayerStorageValue(cid, cfg.storage, 1)
            else
                doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get the second promotion.")
            end
        else
            doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, can get the second promotion.")
        end
    else
        doPlayerSendTextMessage(cid, cfg.msgtype, "You already have the second promotion.")
    end
    return true
end
 
Thanks Limos, what should be in creaturescript.xml? sorry im new at these things, and where do I write wich item I use to get promotion?
 
Last edited:
You don't have to add anything in creaturescripts, this is just an action. Wrtie the xml line in actions.xml and add it with the item id you want to use (if you are not sure how you can look at other onUse items for example like a shovel).
 
Oh, I didn't know that you wanted that.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, msgtype = MESSAGE_STATUS_CONSOLE_BLUE }
    if getPlayerStorageValue(cid, cfg.storage) == -1 then
        if getPlayerLevel(cid) >= cfg.level then
            if isInArray(cfg.vocs, getPlayerVocation(cid)) == true then
                    setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You have been promoted to ".. getVocationInfo(getPlayerVocation(cid)).name ..".")
                    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
		    doRemoveItem(item.uid, 1)
                    setPlayerStorageValue(cid, cfg.storage, 1)
            else
                doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get the second promotion.")
            end
        else
            doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, can get the second promotion.")
        end
    else
        doPlayerSendTextMessage(cid, cfg.msgtype, "You already have the second promotion.")
    end
    return true
end
 
Back
Top