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_SetupRestrictedJob(TEAM_CHIEF, {[TEAM_POLICE] = 8})
- --[[
- 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_POLICE, {[TEAM_POLICE] = 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_SetupRankTable(TEAM_POLICE, 8, 15, ".", 5, 5, false)-- THIS MUST ALWAYS BE FIRST OR IT WILL SETUP FOR THE JOBRANK THAT WAS DEFINED BEFORE THIS
- --[[
- 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, "Recruit", "Rct", {Promote = false, Demote = false}, {Health = 5, Armor = 5}, {}, Material("jobranks/police/rank1.png"))
- JBR_SetupRank(2, 1500, "Deputy", "Dpt", {Promote = false, Demote = false}, {Health = 10, Armor = 10}, {}, Material("jobranks/police/rank2.png"))
- JBR_SetupRank(3, 3000, "Detective", "Det", {Promote = false, Demote = false}, {Health = 15, Armor = 15}, {}, Material("jobranks/police/rank3.png"))
- JBR_SetupRank(4, 6000, "Sergeant", "Sgt", {Promote = false, Demote = false}, {Health = 20, Armor = 20}, {}, Material("jobranks/police/rank4.png"))
- JBR_SetupRank(5, 12000, "Lieutenant", "Lt", {Promote = false, Demote = true, MaxDemotion = 4}, {Health = 25, Armor = 25}, {"weapon_pumpshotgun2"}, Material("jobranks/police/rank5.png"))
- JBR_SetupRank(6, 20000, "Captain", "Cpt", {Promote = true, Demote = false, MaxPromotion = 5}, {Health = 30, Armor = 30}, {}, Material("jobranks/police/rank6.png"))
- JBR_SetupRank(7, 30000, "Major", "Maj", {Promote = true, Demote = true, MaxPromotion = 5, MaxDemotion = 3}, {Health = 35, Armor = 35}, {"weapon_mp52"}, Material("jobranks/police/rank7.png"))
- JBR_SetupRank(8, 45000, "Inspector", "Insp", {Promote = true, Demote = true}, {Health = 40, Armor = 40}, {}, 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(6, {{Model = "models/player/police.mdl", Bodygroups = {{0,0},{2,1}}, Skin = 1}})--Sets model, two custom bodygroups and skin to 1
- --Skipped rank 2, it will now set default model on rank 2
- JBR_SetupRankModel(3, {{Model = "models/player/police.mdl", Bodygroups = {{0,0},{2,1}}, Skin = 1},{Model = "models/player/police_fem.mdl", Bodygroups = nil, Skin = 3}}) -- EXAMPLE OF MULTIPLY MODELS FOR ONE RANK
- JBR_SetupRankModel(4, {{Model = "models/player/police_fem.mdl", Bodygroups = nil, Skin = 3}})--Sets model, no bodygroups, sets skin to 3
- JBR_SetupRankModel(5, {{Model = nil, Bodygroups = nil, Skin = 2}})--Sets default model, no bodygroups, sets skin to 2
- --[[
- 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(5, {"weapon_pumpshotgun2"})
- JBR_AddLoadout(7, {"weapon_mp52"})
- --[[
- 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(5, {"money_printer"})
- --[[
- 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(5, {"weapon_pumpshotgun2"})
- JBR_SetupRankTable(GARDIENDELAPAIX, 4, 30, ".", 1, 1, false) -- THIS MUST ALWAYS BE FIRST OR IT WILL SETUP FOR THE JOBRANK THAT WAS DEFINED BEFORE THIS
- JBR_SetupRank(1, 0, "Chief Recruit", "Rct", {Promote = false, Demote = false}, {Health = 5, Armor = 5}, {}, nil)
- JBR_SetupRank(2, 5000, "Deputy Chief", "Dpt", {Promote = false, Demote = false}, {Health = 25, Armor = 25}, {}, nil)
- JBR_SetupRank(3, 10000, "Assistant Chief", "Asst", {Promote = false, Demote = false}, {Health = 50, Armor = 50}, {}, nil)
- JBR_SetupRank(4, 20000, "Chief of Police", "Chief", {Promote = true, Demote = true}, {Health = 100, Armor = 100}, {}, nil)
- JBR_SetupRankModel(1, {{Model = "models/darkley/sapeur_p03.mdl", Bodygroups = {{0,1}, {1,2}}, Skin = 1}})
- JBR_SetupRankTable(TEAM_MEDIC, 9, 15, ".", nil, nil, false) -- THIS MUST ALWAYS BE FIRST OR IT WILL SETUP FOR THE JOBRANK THAT WAS DEFINED BEFORE THIS
- JBR_SetupRank(1, 0, "Medic Trainee", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(2, 1500, "Medic", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(3, 3000, "Medical Scientist", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(4, 6000, "Junior Doctor", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(5, 12000, "Doctor", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(6, 20000, "Plastic Surgeon", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(7, 30000, "Brain Surgeon", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(8, 45000, "Chief Physician", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(9, 60000, "Hospital Manager", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRankTable(TEAM_MAYOR, 7, 45, ".", 1, 1, false) -- THIS MUST ALWAYS BE FIRST OR IT WILL SETUP FOR THE JOBRANK THAT WAS DEFINED BEFORE THIS
- JBR_SetupRank(1, 0, "Candidate", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(2, 5000, "Politician", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(3, 10000, "Vice Mayor", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(4, 15000, "Mayor", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(5, 20000, "Vice President", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(6, 25000, "President", nil, {Promote = false, Demote = false}, nil, {}, nil)
- JBR_SetupRank(7, 30000, "Supreme Leader", nil, {Promote = false, Demote = false}, nil, {}, 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_POLICE, TEAM_POLICE)
- 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