Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Added a function to config to copy existing jobrank tables for other jobs:
- JBR_CopyRankTable(JobToCopy, Job)
- JobToCopy - This is the jobs ranktable it will copy and use
- Job - The job that should use the ranktable
- Example: JBR_CopyRankTable(TEAM_CHIEF, TEAM_POLICE)
- This would give TEAM_POLICE the same ranks as TEAM_CHIEF
- However this only COPY the table, the progression is still unique for each job
- NOTE: THIS FUNCTION HAS TO BE CALLED AT THE END OF THE CONFIG
- 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)
- Restart server once this command has been used as it doesn't update current players
- "jobranks_convertsql_all"
- Config changes:
- ]]
- JobRanksConfig = JobRanksConfig or {}
- //Use MySQL or not, edit database in sv_mysql.lua
- JobRanksConfig.MYSQLOO = false
- //Who can access admin commands,menus etc
- JobRanksConfig.AdminAccessCustomCheck = function(Player)
- if Player:IsAdmin() or Player:IsSuperAdmin() then
- return true
- else
- return false
- end
- end
- //How often should it update and save?
- JobRanksConfig.UpdateTimer = 30
- //Players Required to be able to earns playtime through timer
- JobRanksConfig.PlayersRequired = 0
- //Should it give SALARY*Bonus instead of SALARY+Bonus?
- //NOTE: This calculates BaseSalary + (BaseSalary/100*Bonus)
- //So if you set BonusSalary to 15 it will be 15% of the original salary
- JobRanksConfig.BonusSalaryPercent = false
- //Disables progression if player is AFK
- JobRanksConfig.DisableAFKProgress = true
- //NOTE: These uses DarkRPs chatcommand system, which means it will always use / before the command so by default it would be -> /rpromote NICK REASON
- //Chatcommand to promote
- JobRanksConfig.PromotionChatCommands = {"rpromote"}
- //Chatcommand to demote
- JobRanksConfig.DemotionChatCommands = {"rdemote"}
- //Should ranks reset when you die?
- JobRanksConfig.ResetRanksOnDeath = false
- //HUD Jobranks
- JobRanksConfig.HUD = true
- //Defined 0-100, 0 is as much left as it can and 100 is as much right as it can
- JobRanksConfig.UIW = 100
- //Defined 0-100, 0 is as much up as it can and 100 is as much down as it can
- JobRanksConfig.UIH = 0
- --[[
- bar = a bar for progress
- time = text for time left
- number = numbers only
- ]]
- JobRanksConfig.HUDType = "number"
- --[[
- 1 = Displays: Job
- 2 = Displays: Jobrank
- 3 = Displays: Job (JobRank)
- ]]
- JobRanksConfig.ShowJobType = 3
- JobRanksConfig.UIBoxColor = Color(100,100,100,200)
- JobRanksConfig.UIOutlineColor = Color(200, 200, 200, 200)
- JobRanksConfig.UITextColor = Color(255,255,255,200)
- JobRanksConfig.BarBackground = Color(0,0,0,255)
- JobRanksConfig.Bar = Color(0,200,0,255)
- JobRanks = JobRanks or {}
- JobRanksConfig.JobJoinRestrictments = JobRanksConfig.JobJoinRestrictments or {}
- JobRanksConfig.JobPermissionList = JobRanksConfig.JobPermissionList or {}
- local function JBR_InitRanks()
- timer.Simple(3, function()
- --[[
- JBR_SetupRestrictedJob(Job, RequiredJobs)
- Job - The job to be restricted
- RequiredJobs - Table of the ranks you must reach in that specific job {[Job] = RequiredRank, [Job2] = RequiredRank} etc
- ]]
- --[[
- JBR_SetupJobPermissionList(Job, AllowedJobs)
- Job - Job that is allowed to promote/demote
- AllowedJobs - The jobs the job is allowed to promote/demote {[Job] = true, [Job2] = true} etc
- ]]
- JBR_SetupJobPermissionList(TEAM_PO, {[TEAM_PO] = true, [TEAM_SWAT] = true, [TEAM_DEC] = true})
- --[[
- JBR_SetupRankTable(Job, MaxRank, BonusSalary, PrefixSeparator, Warrant, Wanted, DisableProgression)
- Job - Variable for job for example TEAM_POLICE
- MaxRank - Maximum rank achieveable
- 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
- PrefixSeparator - What should be between Prefix and Name, for example . would be Pvt.ToBadForYou or _ would be Pvt_ToBadForYou
- Warrant - Rank required to warrant, set to nil to disable
- Wanted - Rank required to Wanted, set to nil to disable
- DisableProgression - true or false, true will not allow the player to progress through playtime only through manual promotions
- ]]
- --[[
- JBR_SetupRank(RankID, TimeRequired, Name, Prefix, Permissions, ExtraStats, Loadout, Icon)
- RankID - RankID should start from 1
- TimeRequired - First rank MUST always have 0, other ranks must be above the previous one. It counts the difference between OLD and NEW rank
- Name - Rank name
- Prefix - Prefix before players name
- Permissions
- ----------------------------------------------------
- Promote = true/false -> Can this rank promote?
- MaxPromotion = Number -> Max rank this rank can promote to
- Demote = true/false -> Can this rank demote?
- MaxDemotion = Number -> Max rank this rank can demote to
- Leaving MaxPromotion empty will allow to set to highest rank
- Leaving MaxDemotion empty will allow to set to lowest rank
- 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
- ----------------------------------------------------
- ExtraStats - Extra stats (speaks for itself)
- Loadout - Extraloadout for this SPECIFIC rank
- Icon - Icon path for this ranks icon
- ]]
- //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)
- JBR_SetupRank(1, 0, "Cadet", "CDT", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, Material("jobranks/police/rank1.png"))
- JBR_SetupRank(2, 1, "Deputy", "Dpt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, Material("jobranks/police/rank2.png"))
- JBR_SetupRank(3, 2, "Corporeal", "Cpl", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, Material("jobranks/police/rank3.png"))
- JBR_SetupRank(4, 3, "Sergeant", "Sgt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, Material("jobranks/police/rank4.png"))
- 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"))
- 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"))
- 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"))
- JBR_SetupRank(8, 7, "Cheif of Police", "Cheif", {Promote = true, Demote = true}, {Health = 0, Armor = 0}, {"cw_scarl"}, Material("jobranks/police/rank8.png"))
- --[[
- RankID - Rank to setup for, set to false if for all ranks
- Function - Custom lua function
- NOTE: ONLY SETUP CUSTOM LUA FUNCTION IF YOU KNOW WHAT YOU ARE DOING
- ]]
- JBR_SetupRankSpawnFunc(false, function(Player) print(Player, "all ranks") end) -- This custom lua function will run for ALL ranks upon SPAWN
- JBR_SetupRankSpawnFunc(1, function(Player) print(Player, "rank 1") end) -- This custom lua function will run for ONLY RANK 1 upon SPAWN
- --[[
- JBR_SetupRankModel(RankID, ModelTbl)
- RankID - Rank to setup for
- ModelTbl - Model information, {{Model = "MODELPATH", Bodygroups{{BodygroupID, Amount}}, Skin = SKINID}}
- ]]
- 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})
- 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})
- 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})
- 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})
- 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})
- 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})
- 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})
- 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})
- --[[
- JBR_AddLoadout(RankID, Weapons)
- RankID - RankID
- Weapons - List of weapons
- This adds the loadout to this rank AND all ranks ABOVE this rank
- ]]
- JBR_AddLoadout(1, {"weapon_physgun"})
- JBR_AddLoadout(1, {"weapon_physgun"})
- --[[
- JBR_AddEntity(RankID, Entities)
- RankID - RankID required to buy the entities
- Entities - List of entities
- This will allow the input rank and all ABOVE this rank to purchase these entities
- ]]
- JBR_AddEntity(1, {"universal_ammo"})
- --[[
- JBR_AddShipment(RankID, Shipments)
- RankID - RankID required to buy the shipments
- Shipments - List of shipments
- This will allow the input rank and all ABOVE this rank to purchase these shipments
- ]]
- JBR_AddShipment(1, {"universal_ammo"})
- 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
- JBR_SetupRank(1, 0, "Cadet", "CDT", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, nil)
- JBR_SetupRank(2, 1, "Deputy", "Dpt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {}, nil)
- JBR_SetupRank(3, 3, "Corporeal", "Cpl", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, nil)
- JBR_SetupRank(4, 4, "Sergeant", "Sgt", {Promote = false, Demote = false}, {Health = 0, Armor = 0}, {"cw_ar15"}, nil)
- JBR_SetupRank(5, 5, "Lieutenant", "Lt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
- JBR_SetupRank(6, 6, "Captain", "Cpt", {Promote = true, Demote = true, MaxPromotion = 4, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
- JBR_SetupRank(7, 7, "Deputy Cheif of Police", "DepCheif", {Promote = true, Demote = true, MaxPromotion = 6, MaxDemotion = 1}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
- JBR_SetupRank(8, 8, "Cheif of Police", "Cheif", {Promote = true, Demote = true}, {Health = 0, Armor = 0}, {"cw_scarl"}, nil)
- --[[
- NOTE: THIS FUNCTION HAS TO BE CALLED AT THE END OF THE CONFIG
- JBR_CopyRankTable(JobToCopy, Job)
- JobToCopy - This is the jobs ranktable it will copy and use
- Job - The job that should use the ranktable
- Example: JBR_CopyRankTable(TEAM_CHIEF, TEAM_POLICE)
- This would give TEAM_POLICE the same ranks as TEAM_CHIEF
- However this only COPY the table, the progression is still unique for each job
- ]]
- //Just an example, copies TEAM_POLICE ranktable and sets TEAM_POLICE ranktable to this.
- JBR_CopyRankTable(TEAM_PO, TEAM_DEC)
- JBR_CopyRankTable(TEAM_PO, TEAM_SWAT)
- JBR_CopyRankTable(TEAM_PO, TEAM_PR)
- end)
- end
- hook.Add("DarkRPFinishedLoading", "JBR_InitRanks", function()
- if DCONFIG then
- hook.Add("DConfigDataLoaded", "JBR_InitRanks", JBR_InitRanks)
- elseif ezJobs then
- hook.Add("ezJobsLoaded", "JBR_InitRanks", JBR_InitRanks)
- else
- hook.Add("loadCustomDarkRPItems", "JBR_InitRanks", JBR_InitRanks)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement