daily pastebin goal
72%
SHARE
TWEET

config

a guest Feb 11th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Added a function to config to copy existing jobrank tables for other jobs:
  3. JBR_CopyRankTable(JobToCopy, Job)
  4. JobToCopy - This is the jobs ranktable it will copy and use
  5. Job - The job that should use the ranktable
  6.  
  7. Example: JBR_CopyRankTable(TEAM_CHIEF, TEAM_POLICE)
  8. This would give TEAM_POLICE the same ranks as TEAM_CHIEF
  9. However this only COPY the table, the progression is still unique for each job
  10. NOTE: THIS FUNCTION HAS TO BE CALLED AT THE END OF THE CONFIG
  11.  
  12. Added command to convert all data from SQLite to MySQL (This overwrites MySQL data, use player command if you wish to convert a specific player)
  13. Restart server once this command has been used as it doesn't update current players
  14. "jobranks_convertsql_all"
  15.  
  16. Config changes:
  17. ]]
  18. JobRanksConfig = JobRanksConfig or {}
  19.  
  20. //Use MySQL or not, edit database in sv_mysql.lua
  21. JobRanksConfig.MYSQLOO = false
  22.  
  23. //Who can access admin commands,menus etc
  24. JobRanksConfig.AdminAccessCustomCheck = function(Player)
  25.     if Player:IsAdmin() or Player:IsSuperAdmin() then
  26.         return true
  27.     else
  28.         return false
  29.     end
  30. end
  31. //How often should it update and save?
  32. JobRanksConfig.UpdateTimer = 30
  33. //Players Required to be able to earns playtime through timer
  34. JobRanksConfig.PlayersRequired = 0
  35. //Should it give SALARY*Bonus instead of SALARY+Bonus?
  36. //NOTE: This calculates BaseSalary + (BaseSalary/100*Bonus)
  37. //So if you set BonusSalary to 15 it will be 15% of the original salary
  38. JobRanksConfig.BonusSalaryPercent = false
  39. //Disables progression if player is AFK
  40. JobRanksConfig.DisableAFKProgress = true
  41. //NOTE: These uses DarkRPs chatcommand system, which means it will always use / before the command so by default it would be -> /rpromote NICK REASON
  42. //Chatcommand to promote
  43. JobRanksConfig.PromotionChatCommands = {"rpromote"}
  44. //Chatcommand to demote
  45. JobRanksConfig.DemotionChatCommands = {"rdemote"}
  46. //Should ranks reset when you die?
  47. JobRanksConfig.ResetRanksOnDeath = false
  48.  
  49. //HUD Jobranks
  50. JobRanksConfig.HUD = true
  51. //Defined 0-100, 0 is as much left as it can and 100 is as much right as it can
  52. JobRanksConfig.UIW = 100
  53. //Defined 0-100, 0 is as much up as it can and 100 is as much down as it can
  54. JobRanksConfig.UIH = 0
  55. --[[
  56. bar = a bar for progress
  57. time = text for time left
  58. number = numbers only
  59. ]]
  60. JobRanksConfig.HUDType = "number"
  61.  
  62. --[[
  63. 1 = Displays: Job
  64. 2 = Displays: Jobrank
  65. 3 = Displays: Job (JobRank)
  66. ]]
  67. JobRanksConfig.ShowJobType = 3
  68.  
  69. JobRanksConfig.UIBoxColor = Color(100,100,100,200)
  70. JobRanksConfig.UIOutlineColor = Color(200, 200, 200, 200)
  71. JobRanksConfig.UITextColor = Color(255,255,255,200)
  72. JobRanksConfig.BarBackground = Color(0,0,0,255)
  73. JobRanksConfig.Bar = Color(0,200,0,255)
  74.  
  75. JobRanks = JobRanks or {}
  76. JobRanksConfig.JobJoinRestrictments = JobRanksConfig.JobJoinRestrictments or {}
  77. JobRanksConfig.JobPermissionList = JobRanksConfig.JobPermissionList or {}
  78.  
  79. local function JBR_InitRanks()
  80. timer.Simple(3, function()
  81. --[[
  82. JBR_SetupRestrictedJob(Job, RequiredJobs)
  83. Job - The job to be restricted
  84. RequiredJobs - Table of the ranks you must reach in that specific job {[Job] = RequiredRank, [Job2] = RequiredRank} etc
  85. ]]
  86.  
  87. --[[
  88. JBR_SetupJobPermissionList(Job, AllowedJobs)
  89. Job - Job that is allowed to promote/demote
  90. AllowedJobs - The jobs the job is allowed to promote/demote {[Job] = true, [Job2] = true} etc
  91. ]]
  92. JBR_SetupJobPermissionList(TEAM_PO, {[TEAM_PO] = true, [TEAM_SWAT] = true, [TEAM_DEC] = true})
  93.  
  94. --[[
  95. JBR_SetupRankTable(Job, MaxRank, BonusSalary, PrefixSeparator, Warrant, Wanted, DisableProgression)
  96. Job - Variable for job for example TEAM_POLICE
  97. MaxRank - Maximum rank achieveable
  98. BonusSalary - Bonus salary for each rank, so Amount*Rank, if bonus is set to 15 and you are rank 3 you would recieve 45$ extra
  99. PrefixSeparator - What should be between Prefix and Name, for example . would be Pvt.ToBadForYou or _ would be Pvt_ToBadForYou
  100. Warrant - Rank required to warrant, set to nil to disable
  101. Wanted - Rank required to Wanted, set to nil to disable
  102. DisableProgression - true or false, true will not allow the player to progress through playtime only through manual promotions
  103. ]]
  104.  
  105. --[[
  106. JBR_SetupRank(RankID, TimeRequired, Name, Prefix, Permissions, ExtraStats, Loadout, Icon)
  107. RankID - RankID should start from 1
  108. TimeRequired - First rank MUST always have 0, other ranks must be above the previous one. It counts the difference between OLD and NEW rank
  109. Name - Rank name
  110. Prefix - Prefix before players name
  111.  
  112. Permissions
  113. ----------------------------------------------------
  114. Promote = true/false -> Can this rank promote?
  115. MaxPromotion = Number -> Max rank this rank can promote to
  116. Demote = true/false -> Can this rank demote?
  117. MaxDemotion = Number -> Max rank this rank can demote to
  118.  
  119. Leaving MaxPromotion empty will allow to set to highest rank
  120. Leaving MaxDemotion empty will allow to set to lowest rank
  121.  
  122. NOTE: Only add ranks that you want to grant permissions to, if the rank isn't in this config it can't promote or demote
  123. ----------------------------------------------------
  124.  
  125. ExtraStats - Extra stats (speaks for itself)
  126. Loadout - Extraloadout for this SPECIFIC rank
  127. Icon - Icon path for this ranks icon
  128. ]]
  129. //THE ICONS ARE JUST TEMPLATES, download icons online and insert their path here (Also upload it on workshop or to your FastDL and add it to force download)
  130. JBR_SetupRank(1, 0, "Cadet", "CDT", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, Material("jobranks/police/rank1.png"))
  131. JBR_SetupRank(2, 1, "Deputy", "Dpt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, Material("jobranks/police/rank2.png"))
  132. JBR_SetupRank(3, 2, "Corporeal", "Cpl", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, Material("jobranks/police/rank3.png"))
  133. JBR_SetupRank(4, 3, "Sergeant", "Sgt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, Material("jobranks/police/rank4.png"))
  134. JBR_SetupRank(5, 4, "Lieutenant", "Lt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, Material("jobranks/police/rank5.png"))
  135. JBR_SetupRank(6, 5, "Captain", "Cpt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, Material("jobranks/police/rank6.png"))
  136. JBR_SetupRank(7, 6, "Deputy Cheif of Police", "DepCheif", {Promote = true, Demote = true, MaxPromotion = 6, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, Material("jobranks/police/rank7.png"))
  137. JBR_SetupRank(8, 7, "Cheif of Police", "Cheif", {Promote = true, Demote = true}, {Health = 0, Armor = 0}, {"cw_scarl"}, Material("jobranks/police/rank8.png"))
  138.  
  139. --[[
  140. RankID - Rank to setup for, set to false if for all ranks
  141. Function - Custom lua function
  142.  
  143. NOTE: ONLY SETUP CUSTOM LUA FUNCTION IF YOU KNOW WHAT YOU ARE DOING
  144. ]]
  145. JBR_SetupRankSpawnFunc(false, function(Player) print(Player, "all ranks") end) -- This custom lua function will run for ALL ranks upon SPAWN
  146. JBR_SetupRankSpawnFunc(1, function(Player) print(Player, "rank 1") end) -- This custom lua function will run for ONLY RANK 1 upon SPAWN
  147.  
  148. --[[
  149. JBR_SetupRankModel(RankID, ModelTbl)
  150. RankID - Rank to setup for
  151. ModelTbl - Model information, {{Model = "MODELPATH", Bodygroups{{BodygroupID, Amount}}, Skin = SKINID}}
  152. ]]
  153. JBR_SetupRankModel(1, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 0},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 0},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 0})
  154. JBR_SetupRankModel(2, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 1},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 1},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 1})
  155. JBR_SetupRankModel(3, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 2},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 2},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 2})
  156. JBR_SetupRankModel(4, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 3},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 3},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 3})
  157. JBR_SetupRankModel(5, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 5},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 5},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 5})
  158. JBR_SetupRankModel(6, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 6},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 6},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 6})
  159. JBR_SetupRankModel(7, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 8},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 8},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 8})
  160. JBR_SetupRankModel(8, {{Model = "models/player/clannypolice/male_05.mdl", Bodygroups = nil, Skin = 9},{Model = "models/player/clannypolice/male_04.mdl", Bodygroups = nil, Skin = 9},{Model = "models/player/clannypolice/male_02.mdl", Bodygroups = nil, Skin = 9})
  161.  
  162. --[[
  163. JBR_AddLoadout(RankID, Weapons)
  164. RankID - RankID
  165. Weapons - List of weapons
  166. This adds the loadout to this rank AND all ranks ABOVE this rank
  167. ]]
  168. JBR_AddLoadout(1, {"weapon_physgun"})
  169. JBR_AddLoadout(1, {"weapon_physgun"})
  170.  
  171. --[[
  172. JBR_AddEntity(RankID, Entities)
  173. RankID - RankID required to buy the entities
  174. Entities - List of entities
  175. This will allow the input rank and all ABOVE this rank to purchase these entities
  176. ]]
  177. JBR_AddEntity(1, {"universal_ammo"})
  178.  
  179. --[[
  180. JBR_AddShipment(RankID, Shipments)
  181. RankID - RankID required to buy the shipments
  182. Shipments - List of shipments
  183. This will allow the input rank and all ABOVE this rank to purchase these shipments
  184. ]]
  185. JBR_AddShipment(1, {"universal_ammo"})
  186.  
  187. JBR_SetupRankTable(TEAM_PO, 8, 0, ".", 0, 0, true) -- THIS MUST ALWAYS BE FIRST OR IT WILL SETUP FOR THE JOBRANK THAT WAS DEFINED BEFORE THIS
  188. JBR_SetupRank(1, 0, "Cadet", "CDT", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, nil)
  189. JBR_SetupRank(2, 1, "Deputy", "Dpt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, nil)
  190. JBR_SetupRank(3, 3, "Corporeal", "Cpl", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, nil)
  191. JBR_SetupRank(4, 4, "Sergeant", "Sgt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, nil)
  192. JBR_SetupRank(5, 5, "Lieutenant", "Lt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
  193. JBR_SetupRank(6, 6, "Captain", "Cpt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
  194. JBR_SetupRank(7, 7, "Deputy Cheif of Police", "DepCheif", {Promote = true, Demote = true, MaxPromotion = 6, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
  195. JBR_SetupRank(8, 8, "Cheif of Police", "Cheif", {Promote = true, Demote = true}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
  196.  
  197. --[[
  198. NOTE: THIS FUNCTION HAS TO BE CALLED AT THE END OF THE CONFIG
  199.  
  200. JBR_CopyRankTable(JobToCopy, Job)
  201. JobToCopy - This is the jobs ranktable it will copy and use
  202. Job - The job that should use the ranktable
  203.  
  204. Example: JBR_CopyRankTable(TEAM_CHIEF, TEAM_POLICE)
  205. This would give TEAM_POLICE the same ranks as TEAM_CHIEF
  206. However this only COPY the table, the progression is still unique for each job
  207. ]]
  208. //Just an example, copies TEAM_POLICE ranktable and sets TEAM_POLICE ranktable to this.
  209. JBR_CopyRankTable(TEAM_PO, TEAM_DEC)
  210. JBR_CopyRankTable(TEAM_PO, TEAM_SWAT)
  211. JBR_CopyRankTable(TEAM_PO, TEAM_PR)
  212. end)
  213. end
  214.  
  215. hook.Add("DarkRPFinishedLoading", "JBR_InitRanks", function()
  216.     if DCONFIG then
  217.         hook.Add("DConfigDataLoaded", "JBR_InitRanks", JBR_InitRanks)
  218.     elseif ezJobs then
  219.         hook.Add("ezJobsLoaded", "JBR_InitRanks", JBR_InitRanks)
  220.     else
  221.         hook.Add("loadCustomDarkRPItems", "JBR_InitRanks", JBR_InitRanks)
  222.     end
  223. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top