Advertisement
Pasterbiner123321

Untitled

May 27th, 2024
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.21 KB | None | 0 0
  1. local config = {
  2.     removelevel = 0, -- Amount of level taken away.
  3.     itemid = 8982, -- Item ID.
  4.     efekt = 2, -- Effect shown.
  5.     skilafter = 10, -- What skill will the player have after change.
  6.     minimumlevel = 100, -- What will be min level required?
  7.     magafter = 2, -- What magic level will he receive after change?
  8.     -- Change only if you have edited your vocations.xml so players get more mana/health/cap each level.
  9.     sorcincrease = {5, 30, 10}, -- The amount of health/mana/cap that increases when Sorcerer levels up.
  10.     druidincrease = {5, 30, 10}, -- The amount of health/mana/cap that increases when Druid levels up.
  11.     paladinincrease = {10, 15, 20}, -- The amount of health/mana/cap that increases when Paladin levels up.
  12.     knightincrease = {15, 5, 25} -- The amount of health/mana/cap that increases when Knight levels up.
  13. }
  14. -----------------------CONFIG---END-------------------------------------------
  15.  
  16. function onSay(cid, words, param)
  17.     if param == "" then
  18.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must say what vocation you want to change to.")
  19.         return TRUE
  20.     end
  21.  
  22.     param = string.lower(param)
  23.     if param == "sorcerer" or param == "druid" or param == "knight" or param == "paladin" or param == "sorc" then
  24.         if getPlayerLevel(cid) >= config.minimumlevel then
  25.             if getPlayerItemCount(cid, config.itemid) >= 1 then
  26.                 local vocation = getPlayerVocation(cid)
  27.                 local level = getPlayerLevel(cid) - 8
  28.  
  29.                 if param == "sorcerer" or param == "master sorcerer" then
  30.                     if vocation ~= 1 then
  31.                         doPlayerAddLevel(cid, -config.removelevel)
  32.                         doPlayerSetVocation(cid, 1) -- Sorc
  33.                         setCreatureMaxHealth(cid, 185 + (config.sorcincrease[1] * level))
  34.                         setCreatureMaxMana(cid, 35 + (config.sorcincrease[2] * level))
  35.                         doPlayerSetMaxCapacity(cid, 470 + (config.sorcincrease[3] * level))
  36.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to sorcerer.")
  37.                     else
  38.                         doPlayerSendCancel(cid, "You are already a sorcerer.")
  39.                         doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  40.                         return TRUE
  41.                     end
  42.                 elseif param == "druid" or param == "elder druid" then
  43.                     if vocation ~= 2 then
  44.                         doPlayerAddLevel(cid, -config.removelevel)
  45.                         doPlayerSetVocation(cid, 2) -- Druid
  46.                         setCreatureMaxHealth(cid, 185 + (config.druidincrease[1] * level))
  47.                         setCreatureMaxMana(cid, 35 + (config.druidincrease[2] * level))
  48.                         doPlayerSetMaxCapacity(cid, 470 + (config.druidincrease[3] * level))
  49.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to druid.")
  50.                     else
  51.                         doPlayerSendCancel(cid, "You are already a druid.")
  52.                         doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  53.                         return TRUE
  54.                     end
  55.                 elseif param == "paladin" or param == "royal paladin" then
  56.                     if vocation ~= 3 then
  57.                         doPlayerAddLevel(cid, -config.removelevel)
  58.                         doPlayerSetVocation(cid, 3) -- Paladin
  59.                         setCreatureMaxHealth(cid, 185 + (config.paladinincrease[1] * level))
  60.                         setCreatureMaxMana(cid, 35 + (config.paladinincrease[2] * level))
  61.                         doPlayerSetMaxCapacity(cid, 470 + (config.paladinincrease[3] * level))
  62.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to paladin.")
  63.                     else
  64.                         doPlayerSendCancel(cid, "You are already a paladin.")
  65.                         doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  66.                         return TRUE
  67.                     end
  68.                 elseif param == "knight" then
  69.                     if vocation ~= 4 then
  70.                         doPlayerAddLevel(cid, -config.removelevel)
  71.                         doPlayerSetVocation(cid, 4) -- Knight
  72.                         setCreatureMaxHealth(cid, 185 + (config.knightincrease[1] * level))
  73.                         setCreatureMaxMana(cid, 35 + (config.knightincrease[2] * level))
  74.                         doPlayerSetMaxCapacity(cid, 470 + (config.knightincrease[3] * level))
  75.                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation has been changed to knight.")
  76.                     else
  77.                         doPlayerSendCancel(cid, "You are already a knight.")
  78.                         doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  79.                         return TRUE
  80.                     end
  81.                 end
  82.  
  83.                 doPlayerRemoveItem(cid, config.itemid, 1)
  84.                 doPlayerAddMagLevel(cid, -((getPlayerMagLevel(cid)) - config.magafter))
  85.                 doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  86.                 doCreatureAddMana(cid, -((getCreatureMana(cid)) - (getCreatureMaxMana(cid))))
  87.                 doCreatureAddHealth(cid, -((getCreatureHealth(cid)) - (getCreatureMaxHealth(cid))))
  88.                 for a = 0, 6 do
  89.                     doPlayerAddSkill(cid, a, -(getPlayerSkillLevel(cid, a) - config.skilafter))
  90.                 end
  91.             else
  92.                 doPlayerSendCancel(cid, "You need " .. getItemNameById(config.itemid) .. " to change your vocation.")
  93.                 doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  94.             end
  95.         else
  96.             doPlayerSendCancel(cid, "You don't have enough level. Your level must be " .. config.minimumlevel .. " or higher.")
  97.             doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  98.         end
  99.     else
  100.         doPlayerSendCancel(cid, "You must say what vocation you want to change to.")
  101.         doSendMagicEffect(getCreaturePosition(cid), config.efekt)
  102.     end
  103. end
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement