DarkRP:Factions

From Official DarkRP Wiki
Jump to: navigation, search
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | France-flag.png Français

It would come to no surprise to me, if your server has come to a point where you want or need expanding.

The large amount and the with-coming variety of GMOD servers, requires us to keep up with the new school. Custom jobs, entities and interfaces are the new showcase for your server. If you want an easy way to offer your players a goal, occupancy and rarity to the server: I'll learn you to create your own faction system for DarkRP, only using one file. Let me start off by showcasing the possibilities, up and down sides of the system and its limits. This does not require a database.


Factions

A collective name for 'faction', in other words: groups of players with each a own identity and purpose. We could be.. ordinary street-gangs or.. evil lawyers.

Using this will allow you to give every group their own unique job. Their own player-models, weapons they spawn with, a permanent base, group-chat and even different layers of ranks within the group.

This, all, with the interface of DarkRP. No database or complicated code necessary.


Adding a faction to your DarkRP server:

Add this to jobs.lua found in lua/darkrp_customthings (see here).

TEAM_FACTIONNAME = DarkRP.createJob("JOB TITLE", {
   --^Change the FACTIONNAME to the name of the desired faction. Job title is the title of which will appear in F4-jobs.
   color = Color(255, 242, 0, 255),
   --^Color of job. This will influence colors of chat broadcasting and possibly the TAB color.
   model = "models/player/soldier_stripped.mdl",
   --^Player-model of the faction members. You may find exact paths in your garrysmod\models\player folder. USE .MDL.
   description = [[My first supercool faction thanks to Ent:King, join us!]],
   --^Description seen in the F4 menu when selecting or hovering the job.
   weapons = {},
   --^What weapon to start with? Example: "lockpick". Find more by using tab and reading the green notification.possible, example:         
   command = "FACTIONNAME",
   --^The command to join the faction.
   max = 5,
   --^Max members in the job simultaneously.
   salary = 120,
   --^Salary
   admin = 0,
   --^Admin job? if so = 1
   vote = false,
   --^Require vote to join the job?
   hasLicense = true,
   --^Has a gun license? If not make = false
   customCheck = function(ply) return
      ply:SteamID() == "STEAM_0:1:11517492"  or
      ply:SteamID() == "STEAM_0:0:5971531"   or
      ply:SteamID() == "ADD"                 or
      ply:SteamID() == "ADD"                 or
      ply:SteamID() == "ADD"                 or
      ply:SteamID() == "ADD"                 or
      ply:SteamID() == "ADD"                 or
      ply:SteamID() == "ADD"
   end
   --^SteamIDs of the members.
})
 
GM:AddGroupChat(function(ply) return ply:IsCP() end)
GM:AddGroupChat(TEAM_FACTIONNAME)
--^Faction name for your Group chat. Must be the same as above, mind capitals!
AddDoorGroup("FACTION NAME", TEAM_FACTIONNAME)
--^Faction name for door groups. TEAM_ must be the same as above, mind capitals!

You can choose to remoe the doorgroup and groupchat, this will cause them to keep the job but without group communications and permanent basing options as set by administrators.

How to work it as administrator

If you wish to set a base for a gang: Press F2 on a door as administrator and go to Jobs only: Job name