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

Promotion Choices

ZeeBeast

Preferable Beta Tester
Joined
Dec 5, 2013
Messages
206
Reaction score
10
Location
United States
I need help with a script. I am trying to get my promotion so say if you are a master sorcerer, you could choose to be either a great master sorcerer or an elite master sorcerer. The script I have atm is a little messed up. It will promote me to what I want to be, Until I relog.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, cost = 10000, 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 subclassed 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 get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, may get a subclass")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "You have already been subclassed.")
end
return true
end
This code works perfectly fine. But the problem is the other choice. It is the exact same as the other script but instead of "setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)" it is "setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 2)" but it still does the same thing as the first script.
Could anyone help me?
 
use vocation functions instead of promotion like setplayervocation and getplayervocation
something like this
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {level = 1, vocs = { 5, 6, 7, 8 }, storage = 45231, cost = 0, 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)
local getVoc = getPlayerVocation(cid)
if getVoc== 1 then
voc = 2
elseif getVoc== 3 then
voc = 4
elseif getVoc== 5 then
voc = 6
elseif getVoc== 7 then
voc = 8
doPlayerSetVocation(cid, voc)
doPlayerSendTextMessage(cid, cfg.msgtype, "You have been subclassed to ".. getVocationInfo(getPlayerVocation(cid)).name ..".")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
setPlayerStorageValue(cid, cfg.storage, 1)
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "You need ".. cfg.cost .." gold coins to get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, may get a subclass")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "You have already been subclassed.")
end
return true
end
 
I tried this, and it sets my vocation to what it is supposed to be, but when I log out it reset my promotion :/
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, cost = 10000, 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)
setPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
doPlayerSendTextMessage(cid, cfg.msgtype, "You have been subclassed 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 get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get a subclass.")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, may get a subclass")
end
else
doPlayerSendTextMessage(cid, cfg.msgtype, "You have already been subclassed.")
end
return true
end
 
Back
Top