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

Vocation statue [Please help]

go to action.xml and paste this
Code:
<action actionid="2420" event="script" value="tools/statue.lua"/>

now go to actions-->tools and make new script called statue paste this
Lua:
local vocation = 1   ---player vocation
local changedvocation = 15   ---the vocation he will have when use statue
local storage = 8912
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,storage) < -1 then
  doPlayerSendCancel(cid,"You can only use this once.")
  return true
end
if getPlayerVocation(cid) == vocation  then
 doPlayerSetVocation(cid,changedvocation)
 doCreatureSay(itemEx.uid, "Your vocation have been changed", TALKTYPE_ORANGE_1)
 setPlayerStorageValue(cid,storage,1)
 return true
end
  end

now just put that action id on the statue
 
How come when OT shuts down or reboots they login with there old promotion?


Ok because the script didnt work i edited it to:

PHP:
local vocation = 9   ---player vocation
local changedvocation = 13   ---the vocation he will have when use statue
local storage = 8912
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,storage) == -1 and getPlayerVocation(cid) == vocation then
 doPlayerSetVocation(cid,changedvocation)
 doCreatureSay(itemEx.uid, "Your vocation have been changed", TALKTYPE_ORANGE_1)
 setPlayerStorageValue(cid,storage,1)
 else
  doCreatureSay(itemEx.uid, "You cant use this twice.", TALKTYPE_ORANGE_1)
  end
  return true
end



BUT now when they relog they loose it or when server reboot they go back to old vocation please help!!
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerPromotionLevel(cid) == 1 then
		doPlayerSetPromotionLevel(cid,2)
		doPlayerSendTextMessage(cid,20,'You have been promoted to' ..getPlayerVocation(cid)..'!')
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_BIGCLOUDS)
	elseif getPlayerPromotionLevel(cid) > 1 then
		doPlayerSendCancel(cid,'You can only use the statue once.')
	else
		doPlayerSendCancel(cid,'You have to get your first promotion first.')
	return true
	end
end

try that its untested but if you want to add the storage value in just copy paste it from the script you have
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerPromotionLevel(cid) == 1 then
		doPlayerSetPromotionLevel(cid,2)
		doPlayerSendTextMessage(cid,20,'You have been promoted to' ..getPlayerVocation(cid)..'!')
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_BIGCLOUDS)
	elseif getPlayerPromotionLevel(cid) > 1 then
		doPlayerSendCancel(cid,'You can only use the statue once.')
	else
		doPlayerSendCancel(cid,'You have to get your first promotion first.')
	return true
	end
end

try that its untested but if you want to add the storage value in just copy paste it from the script you have


Thanks for the reply but I cant use PromotionLevel because i have 2 vocations on the same promotion lvl its hard to explain, I need it to check if player has X vocation ID then it sets it to X vocation ID. The script i made works fine its just when they relog or server reboots they go back to the old vocation they had before using the statue. I dont know why.
 
I'm not sure lmao i guess its not needed, Its to stop people using it twice but i guess that already happens since they'll have a different vocation ID.
Although would you have any idea why it makes there vocation back to the old one?
 
Lua:
local vocation = 9   ---player vocation
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerVocation(cid) == vocation then
 doPlayerSetVocation(cid,13)
 doCreatureSay(itemEx.uid, "Your vocation have been changed", TALKTYPE_ORANGE_1)
 else
  doCreatureSay(itemEx.uid, "You cant use this twice.", TALKTYPE_ORANGE_1)
  end
  return true
end

give this a try see if it works
 
Last edited:
this isnt finished have a play around with this
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local i = getPlayerVocation(cid)
		if i == 9 then
			doPlayerSetVocation(cid,13)
		elseif i == 10 then
			doPlayerSetVocation(cid,14)
		elseif i == 11 then
			doPlayerSetVocation(cid,15)
		elseif i == 12 then
			doPlayerSetVocation(cid,16)
		end	
		
	if getPlayerVocation(cid) == i then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_BIGCLOUDS)
		doCreatureSay(itemEx.uid, "Your vocation have been changed", TALKTYPE_ORANGE_1)
	else
		 doCreatureSay(itemEx.uid, "You cant use this twice.", TALKTYPE_ORANGE_1)
	end
end

here use this to help http://otland.net/f55/lua-functions-list-14039/
 
this isnt finished have a play around with this
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local i = getPlayerVocation(cid)
		if i == 9 then
			doPlayerSetVocation(cid,13)
		elseif i == 10 then
			doPlayerSetVocation(cid,14)
		elseif i == 11 then
			doPlayerSetVocation(cid,15)
		elseif i == 12 then
			doPlayerSetVocation(cid,16)
		end	
		
	if getPlayerVocation(cid) == i then
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREAREA)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_BIGCLOUDS)
		doCreatureSay(itemEx.uid, "Your vocation have been changed", TALKTYPE_ORANGE_1)
	else
		 doCreatureSay(itemEx.uid, "You cant use this twice.", TALKTYPE_ORANGE_1)
	end
end

here use this to help http://otland.net/f55/lua-functions-list-14039/

Code:
        local i = getPlayerVocation(cid)
                if i == 9 then
                        doPlayerSetVocation(cid,13)
                elseif i == 10 then
                        doPlayerSetVocation(cid,14)
                elseif i == 11 then
                        doPlayerSetVocation(cid,15)
                elseif i == 12 then
                        doPlayerSetVocation(cid,16)
                end
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
Code:
if getPlayerVocation(cid) == i then
This will always return true...
 
Since this things being retarded ill just make a onLogin script that checks for a storage and then gives them the vocation so theyll loose it and login with it again xD. Thanks all for help!
 
Back
Top