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

Action SECOND PROMOTION SCRIPT

Real Vandta

Member
Joined
Jun 16, 2020
Messages
56
Solutions
1
Reaction score
11
Location
Egypt
local config = {
[1] = {5}, -- sorcerer
[2] = {6}, -- druid
[3] = {7}, -- paladin
[4] = {8}, -- knight
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = config[getPlayerVocation(cid)]
if v then
doPlayerSetVocation(cid, v[1])
doCreatureSay(cid, "You are now an "..getPlayerVocationName(cid).."!", TALKTYPE_ORANGE_1)
db.executeQuery("UPDATE players SET name = '[DNT] "..getCreatureName(cid).."' WHERE id = "..getPlayerGUID(cid)..";")
doPlayerSendTextMessage(cid,25,"Trankilo no Pasara Nada.")
addEvent(doRemoveCreature, 5*1000, cid, true)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You are empty this item.")
end
return true
end
Post automatically merged:

For tfs 0.4
:rolleyes::rolleyes:
 

Attachments

Last edited:
any errors in console?
not error but, this add the new vocation to player, but after relogin assumed old vocation. I tried added vocation in the database, syntax is correct, but the same problem =/ i don't know this problem
 
not error but, this add the new vocation to player, but after relogin assumed old vocation. I tried added vocation in the database, syntax is correct, but the same problem =/ i don't know this problem

Thats bcus hes using setPlayerVocation..
Do you want the same script even with the new name?
 
i want script with work on relog player, keeps new vocation

Lua:
    local config = {
        level = 30,  -- Required Level to use this item
        vocs = { 1, 2, 3, 4 },  -- Vocations which are allowed to use it
        storage = 74747  --- Put here a empty storage
    }
    
    function onUse(cid, item, fromPosition, itemEx, toPosition)
    
    if(getPlayerLevel(cid) <= config.level) then
       doCreatureSay(cid, "Sorry, required level to use this item: " .. config.level .. ".", TALKTYPE_ORANGE_1)
       return true
    end   
    
    if(getPlayerStorageValue(cid, config.storage) == 1) then
       doCreatureSay(cid, "You are alredy promoted.", TALKTYPE_ORANGE_1)
       return true
    end
    
    if(isInArray(config.vocs, getPlayerVocation(cid)) == true) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
       doSendMagicEffect(getCreaturePosition(cid), 55)
       setPlayerStorageValue(cid, config.storage, 1)
       setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
       doRemoveItem(item.uid, 1)
       --db.executeQuery("UPDATE players SET name = '[DNT] "..getCreatureName(cid).."' WHERE id = "..getPlayerGUID(cid)..";") --
       end
       return true
    end
 
Last edited:
not working =/
i need to promote to vocations 9, 10, 11, 12... and i change this:
vocs = {5, 6, 7, 8}, -- Vocations which are allowed to use it

after using show the message of promoted to elite knight, but should be "baiak knight", the vocation number 12

After using to be continued in vocation elite knight =/

My script equal yours:

Lua:
local config = {
       level = 30,  -- Required Level to use this item
       vocs = {5, 6, 7, 8},  -- Vocations which are allowed to use it
       storage = 74747  --- Put here a empty storage
   }

   function onUse(cid, item, fromPosition, itemEx, toPosition)

   if(getPlayerLevel(cid) <= config.level) then
      doCreatureSay(cid, "Sorry, required level to use this item: " .. config.level .. ".", TALKTYPE_ORANGE_1)
      return true
   end

   if(getPlayerStorageValue(cid, config.storage) == 1) then
      doCreatureSay(cid, "You are alredy promoted.", TALKTYPE_ORANGE_1)
      return true
   end

   if(isInArray(config.vocs, getPlayerVocation(cid)) == true) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
      doSendMagicEffect(getCreaturePosition(cid), 55)
      setPlayerStorageValue(cid, config.storage, 1)
      setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
      doRemoveItem(item.uid, 1)
      --db.executeQuery("UPDATE players SET name = '[DNT] "..getCreatureName(cid).."' WHERE id = "..getPlayerGUID(cid)..";") --
      end
      return true
   end
 
not working =/
i need to promote to vocations 9, 10, 11, 12... and i change this:
vocs = {5, 6, 7, 8}, -- Vocations which are allowed to use it

after using show the message of promoted to elite knight, but should be "baiak knight", the vocation number 12

After using to be continued in vocation elite knight =/

My script equal yours:

Lua:
local config = {
       level = 30,  -- Required Level to use this item
       vocs = {5, 6, 7, 8},  -- Vocations which are allowed to use it
       storage = 74747  --- Put here a empty storage
   }

   function onUse(cid, item, fromPosition, itemEx, toPosition)

   if(getPlayerLevel(cid) <= config.level) then
      doCreatureSay(cid, "Sorry, required level to use this item: " .. config.level .. ".", TALKTYPE_ORANGE_1)
      return true
   end

   if(getPlayerStorageValue(cid, config.storage) == 1) then
      doCreatureSay(cid, "You are alredy promoted.", TALKTYPE_ORANGE_1)
      return true
   end

   if(isInArray(config.vocs, getPlayerVocation(cid)) == true) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
      doSendMagicEffect(getCreaturePosition(cid), 55)
      setPlayerStorageValue(cid, config.storage, 1)
      setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
      doRemoveItem(item.uid, 1)
      --db.executeQuery("UPDATE players SET name = '[DNT] "..getCreatureName(cid).."' WHERE id = "..getPlayerGUID(cid)..";") --
      end
      return true
   end

Its working perfect for me.

Make sure the new vocation are has the correct fromVoc number.

Also vocationID 9 should have fromvoc="5"
 
Its working perfect for me.

Make sure the new vocation are has the correct fromVoc number.

Also vocationID 9 should have fromvoc="5"
maybe this problem with my TFS 0.4 or the database.

My XML vocations:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientId="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no" droploot="no">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="1" clientId="3" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="3" gainmanaamount="400" manamultiplier="1.1" attackspeed="520" soulmax="100" gainsoulticks="120" fromvoc="1" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="2" clientId="4" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="3" gainmanaamount="400" manamultiplier="1.1" attackspeed="520" soulmax="100" gainsoulticks="120" fromvoc="2" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="3" clientId="2" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="150" gainmanaticks="4" gainmanaamount="400" manamultiplier="1.4" attackspeed="520" soulmax="100" gainsoulticks="120" fromvoc="3" lessloss="30">
        <formula meleeDamage="1.0" distDamage="0.84" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="4" clientId="1" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="150" gainmanaticks="6" gainmanaamount="400" manamultiplier="3.0" attackspeed="520" soulmax="100" gainsoulticks="120" fromvoc="4" lessloss="30">
        <formula meleeDamage="0.8" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="5" clientId="3" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="2" gainmanaamount="400" manamultiplier="1.1" attackspeed="520" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="6" clientId="4" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="2" gainmanaamount="400" manamultiplier="1.1" attackspeed="520" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="7" clientId="2" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="150" gainmanaticks="3" gainmanaamount="400" manamultiplier="1.4" attackspeed="520" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
        <formula meleeDamage="1.0" distDamage="0.84" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="8" clientId="1" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="150" gainmanaticks="6" gainmanaamount="400" manamultiplier="3.0" attackspeed="520" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
        <formula meleeDamage="0.8" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>



    <vocation id="9" clientId="3" name="Baiak Sorcerer" description="a baiak sorcerer" needpremium="1" gaincap="15" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="2" gainmanaamount="400" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="10" clientId="4" name="Baiak Druid" description="an baiak druid" needpremium="1" gaincap="15" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="150" gainmanaticks="2" gainmanaamount="400" manamultiplier="1.1" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="11" clientId="2" name="Baiak Paladin" description="a baiak paladin" needpremium="1" gaincap="25" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="150" gainmanaticks="3" gainmanaamount="400" manamultiplier="1.4" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
        <formula meleeDamage="1.0" distDamage="0.84" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="12" clientId="1" name="Baiak Knight" description="an baiak knight" needpremium="1" gaincap="30" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="150" gainmanaticks="6" gainmanaamount="400" manamultiplier="3.0" attackspeed="400" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
        <formula meleeDamage="0.8" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>





</vocations>
 
Lua:
local config = {
  [8] = {12} -- Baiak Knight
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local v = config[getPlayerVocation(cid)]
    if v then
        doPlayerSetVocation(cid, v[1])
        doCreatureSay(cid, "You are now an  "..getPlayerVocationName(cid).."!", TALKTYPE_ORANGE_1)
         db.executeQuery("UPDATE `players` SET `name` = '[DNT] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
         doPlayerSendTextMessage(cid,25,"Trankilo no Pasara Nada.")
         addEvent(doRemoveCreature, 5*1000, cid, true)
        doRemoveItem(item.uid, 1)
     else
       doPlayerSendCancel(cid,"Tu Ya Eres DNT.")
    end
  return true
end

From Elite Knight to "Baiak Knight", if you wanna change it from knight to baiak knight, you should change [8] in config to [4].
 
maybe this problem with my TFS 0.4 or the database.

My XML vocations:

vocation id="0" -> fromvoc="0"

vocation id="1" -> fromvoc="1"
vocation id="2" -> fromvoc="2"
vocation id="3" -> fromvoc="3"
vocation id="4" -> fromvoc="4"

vocation id="5" -> fromvoc="1"
vocation id="6" -> fromvoc="2"
vocation id="7" -> fromvoc="3"
vocation id="8" -> fromvoc="4"

vocation id="9" -> fromvoc="5"
vocation id="10" -> fromvoc="6"
vocation id="11" -> fromvoc="7"
vocation id="12" -> fromvoc="8"
 
vocation id="0" -> fromvoc="0"

vocation id="1" -> fromvoc="1"
vocation id="2" -> fromvoc="2"
vocation id="3" -> fromvoc="3"
vocation id="4" -> fromvoc="4"

vocation id="5" -> fromvoc="1"
vocation id="6" -> fromvoc="2"
vocation id="7" -> fromvoc="3"
vocation id="8" -> fromvoc="4"

vocation id="9" -> fromvoc="5"
vocation id="10" -> fromvoc="6"
vocation id="11" -> fromvoc="7"
vocation id="12" -> fromvoc="8"
nice maaaan works 100% i love youuu haha xD

it was just that detail...
 
Back
Top