Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. -- CONFIG
  2. local config = {}
  3.  
  4. config.multiplier = 1 -- EXP Multiplier
  5. config.m_multiplier = 1 -- Money Multiplier
  6. config.exp_max = 72.7 -- How Much EXP Multiplier To Rank Up? (Example: Level 1 (1*72.2)=Exp Multiplier (72.7 EXP Required For Rank 1))
  7. config.prestige_level = 100 -- Level To Prestige At
  8. config.money_reward = 2 -- How Much Money Multiplier For Ranking Up? (Example: Level 1 (1*2)=Money Multiplier ($2 Reward For Rank 1))
  9. config.p_money_reward = 100 -- How Much Money Multiplier For Prestiging Up? (Example: Prestige 1 (1*2)=Money Multiplier ($2 Reward For Rank 1))
  10.  
  11.  
  12. -- DONT TOUCH BELOW
  13. local _p = FindMetaTable("Player")
  14. local defaults = {
  15. level=1,
  16. exp=0,
  17. prestige=0
  18. }
  19. -- Checking Level/Prestige
  20. function _p:CheckEXP() if self:GetEXP()>=(self:GetLevel()*config.exp_max) then self:LevelUp() end end
  21. function _p:CheckLevel() if self:GetLevel()>config.prestige_level then self:PrestigeUp() end end
  22. -- EXP
  23. function _p:SetEXP(amount) self:SetNWInt("_p_exp",amount) end
  24. function _p:GetEXP() return self:GetNWInt("_p_exp") end
  25. function _p:AddEXP(amount) self:SetEXP(self:GetEXP()+(amount*config.multiplier)) self:CheckEXP() end
  26. -- Level
  27. function _p:SetLevel(amount) self:SetNWInt("_p_level",amount) end
  28. function _p:GetLevel() return self:GetNWInt("_p_level") end
  29. function _p:AddLevel(amount) self:SetLevel(self:GetLevel()+amount) end
  30. -- Prestige
  31. function _p:SetPrestige(amount) self:SetNWInt("_p_prestige",amount) end
  32. function _p:GetPrestige() return self:GetNWInt("_p_prestige") end
  33. function _p:AddPrestige(amount) self:SetPrestige(self:GetPrestige()+amount) end
  34. -- Default
  35. function _p:LevelUp() self:AddLevel(1) self:SetEXP(0) self:CheckLevel() self:NotifyUp("Level " .. self:GetLevel(),(config.money_reward*m_multiplier)) end
  36. function _p:PrestigeUp() self:SetLevel(0) self:SetEXP(0) self:AddPrestige(1) self:NotifyUp("Prestige " .. self:GetLevel(),(config.p_money_reward*m_multiplier)) end
  37. function _p:DefaultLevels() self:SetEXP(defaults.exp) self:SetLevel(defaults.level) self:SetPrestige(defaults.prestige)end
  38. function _p:NotifyUp(text,reward) DarkRP.notify(self, 0, 4, text .. " Reward: " .. reward) self:AddMoney(reward) end
  39. -- Hooks
  40.  
  41.  
  42. -- Commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement