Guest User

Untitled

a guest
Jun 6th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.06 KB | None | 0 0
  1. function StdModule.promotePlayer(cid, message, keywords, parameters, node)
  2.         local npcHandler = parameters.npcHandler
  3.         if npcHandler == nil then
  4.             error("StdModule.promotePlayer called without any npcHandler instance.")
  5.         end
  6.  
  7.         local player = Player(cid)
  8.         if player:isPremium() or not parameters.premium then
  9.             local promotion = player:getVocation():getPromotion()
  10.             if player:getStorageValue(STORAGEVALUE_PROMOTION) == 1 then
  11.                 npcHandler:say("You are already promoted!", cid)
  12.             elseif player:getLevel() < parameters.level then
  13.                 npcHandler:say("I am sorry, but I can only promote you once you have reached level " .. parameters.level .. ".", cid)
  14.             elseif not player:removeMoney(parameters.cost) then
  15.                 npcHandler:say("You do not have enough money!", cid)
  16.             elseif (getPlayerPromotionLevel(cid)+1) ~= parameters.promotion then
  17.                 npcHandler:say('You need the previous promotion first!', cid)  
  18.             else
  19.                 npcHandler:say(parameters.text, cid)
  20.                 player:setVocation(promotion)
  21.                 player:setStorageValue(STORAGEVALUE_PROMOTION, 1)  
  22.             end
  23.         else
  24.             npcHandler:say("You need a premium account in order to get promoted.", cid)
  25.         end
  26.         npcHandler:resetNpc(cid)
  27.         return true
  28. end
  29.  
  30.  
  31. function StdModule.promotePlayer2(cid, message, keywords, parameters, node)
  32.         local secondPromoStorage = 55555 --CHANGE THIS NUMBER IF YOU WANT
  33.         local npcHandler = parameters.npcHandler
  34.         if npcHandler == nil then
  35.             error("StdModule.promotePlayer called without any npcHandler instance.")
  36.         end
  37.  
  38.         local player = Player(cid)
  39.         if player:isPremium() or not parameters.premium then
  40.             local promotion = player:getVocation():getPromotion()
  41.             if player:getStorageValue(secondPromoStorage) == 1 then
  42.                 npcHandler:say("You are already promoted!", cid)
  43.             elseif player:getLevel() < parameters.level then
  44.                 npcHandler:say("I am sorry, but I can only promote you once you have reached level " .. parameters.level .. ".", cid)
  45.             elseif not player:removeMoney(parameters.cost) then
  46.                 npcHandler:say("You do not have enough money!", cid)
  47.             elseif (getPlayerPromotionLevel(cid)+1) ~= parameters.promotion then
  48.                 npcHandler:say('You need the previous promotion first!', cid)  
  49.             else
  50.                 npcHandler:say(parameters.text, cid)
  51.                 player:setVocation(promotion) ----YOU HAVE TO CHANGE THIS FOR YOUR VOCATION ID OF SECOND PROMO you can use something like with the first one player:setVocation(getPlayerVocation(cid) + 4) IDK whats your voc IDs are
  52.                 player:setStorageValue(secondPromoStorage, 1)  
  53.             end
  54.         else
  55.             npcHandler:say("You need a premium account in order to get promoted.", cid)
  56.         end
  57.         npcHandler:resetNpc(cid)
  58.         return true
  59. end
Add Comment
Please, Sign In to add comment