<action actionid="2420" event="script" value="tools/statue.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
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
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
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
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
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
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/
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
This will always return true...Code:if getPlayerVocation(cid) == i then