• 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 Bug/ Rep++

-.Savage.-

New Member
Joined
Jul 2, 2008
Messages
32
Reaction score
2
Hello Lets Get Started
Well I Have The Latest TFS 3.4pl or w.e lol
and when i get Buy Promotion from the Npc , It Gives
The Promotion, But When i Relog , it takes away the promotion.
if some1 knows why please help me , ill rep you++
thanks
savage.
 
what do you mean? this is what i got right now
its a promotion quest, you get a item , u click it and gives u promo.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(cid) == 1 and getPlayerLevel(cid) >45 then
		doPlayerSetVocation(cid, 5)
		doCreatureSay(cid, "You are now a Master Sorcerer!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 2 and getPlayerLevel(cid) >45 then
		doPlayerSetVocation(cid, 6)
		doCreatureSay(cid, "You are now a Elder Druid!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 3 and getPlayerLevel(cid) >45 then
		doPlayerSetVocation(cid, 7)
		doCreatureSay(cid, "You are now a Royal Paladin!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	elseif getPlayerVocation(cid) == 4 and getPlayerLevel(cid) >45 then
		doPlayerSetVocation(cid, 8)
		doCreatureSay(cid, "You are now a Elite Knight!", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid,"You need to be level 45 to use this.")
	end
end
 
Rather use a NPC, I know it works 100% on TFS PL2 :thumbup:

You probably have it already but here it is:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)			npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)		npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)		npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()				npcHandler:onThink()					end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerVocation(cid) == 1 and getPlayerLevel(cid) >45 then
                dosetPlayerPromotionLevel(cid, 1)
                doCreatureSay(cid, "You are now a Master Sorcerer!", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 1)
        elseif getPlayerVocation(cid) == 2 and getPlayerLevel(cid) >45 then
                dosetPlayerPromotionLevel(cid, 1)
                doCreatureSay(cid, "You are now a Elder Druid!", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 1)
        elseif getPlayerVocation(cid) == 3 and getPlayerLevel(cid) >45 then
                dosetPlayerPromotionLevel(cid, 1)
                doCreatureSay(cid, "You are now a Royal Paladin!", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 1)
        elseif getPlayerVocation(cid) == 4 and getPlayerLevel(cid) >45 then
                dosetPlayerPromotionLevel(cid, 1)
                doCreatureSay(cid, "You are now a Elite Knight!", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 1)
        else
                doPlayerSendCancel(cid,"You need to be level 45 to use this.")
        end
end

Try this.
 
@Up
That wont work..
this will:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerVocation(cid) <= 4 and getPlayerLevel(cid) >45 then
                setPlayerPromotionLevel(cid, 1)
                doCreatureSay(cid, "You are now a Master Sorcerer!", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 1)
        else
                doPlayerSendCancel(cid,"You need to be level 45 to use this.")
        end
        return TRUE
end
You missed a return TRUE in the end... and why you use it like this?:
Lua:
getPlayerVocation(cid) == 1
getPlayerVocation(cid) == 2
getPlayerVocation(cid) == 3
getPlayerVocation(cid) == 4

You just can use:
Lua:
getPlayerVocation(cid) <= 4

Both ways is gonna work but is better in my way.. :]
 
All I did was take the above script and switch out the 'dosetplayervocation' with 'dosetplayerpromotionlevel' since he seems incapable of doing it himself.
 
Hope this works, if it adds the vocation, but when relog still lose the promotion, write here andI'll tell you :)
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
  local getVocation = getPlayerVocation(cid)
  local playerLevel = getPlayerLevel(cid)

  if getVocation > 4 then
  doPlayerSendCancel(cid, "You are already promoted")
  
        elseif getVocation == 1 and playerLevel >= 45 then
			setPlayerPromotionLevel(cid, 1)
			doCreaureSay(cid, "You are now master sorcerer", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid)
		else
			  doPlayerSendCancel(cid, "You need level 45 to get promoted")
		elseif getVocation == 2 and playerLevel >= 45 then
			setPlayerPromotionLevel(cid, 1)
			doCreatureSay(cid, "You are now elder druid", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid)
		else
			  doPlayerSendCancel(cid, "You need level 45 to get promoted")
		elseif getVocation == 3 and playerLevel >= 45 then
			setPlayerPromotionLevel(cid, 1)
			doCreatureSay(cid, "You are now royal paladin", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid)
		else
			  doPlayerSendCancel(cid, "You need level 45 to get promoted")
		elseif getVocation == 4 and playerLevel >= 45 then
			setPlayerPromotionLevel(cid, 1)
			doCreatureSay(cid, "You are now elite knight", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid)
		else
			  doPlayerSendCancel(cid, "You need level 45 to get promoted")
			end
		return TRUE
	end
or a shorter
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
 local config = {
	removeItem = 2160 -- a crystal coin, change to your.
	count = 1
	}

  if getPlayerVocation(cid) > 4 then
  doPlayerSendCancel(cid, "You are already promoted")
  
        elseif getPlayerVocation(cid)  < 5 and getPlayerLevel(cid) >= 45 then
		if doPlayerRemoveItem(cid, config.removeItem, config.count) == TRUE then
			setPlayerPromotionLevel(cid, 1)
			doCreatureSay(cid, "You are now "..	getPlayerVocationName(cid)..".", TALKTYPE_ORANGE_1)
		else
		doPlayerSendCancel(cid, "You need lvel 45 to get promoted")
			end
		end
	return TRUE
end
this.
 
Last edited:
Back
Top