Jobs
Ajout et configuration des jobs.
Schéma
Schéma SWAT
Explications
TEAM_SWAT = Variable Lua de l'équipe. C'est utilisé pour certaines choses comme choisir qui peut acheter telles armes (autorisé uniquement la TEAM_SWAT par exemple).
DarkRP.createJob("S.W.A.T", = S.W.A.T est le nom du job affiché dans le tableau de bord.
color = Color(0,0,153,255), = C'est la couleur du job affiché dans le tableau de bord, en format RGB. Vous pouvez chercher la couleur parfaite en utilisant l'outil de couleur du jeu.
model = "models/player/barney.mdl", = Le model du joueur que vous avez une fois que vous apparaissez. Si le client n'a pas le model, il aura un model ERROR à la place.
Depuis la révision 529, vous pouvez ajouter plusieurs models pour chaque job, quand un joueur choisit le job dans le menu F4, un menu GUI apparaît avec tous les models possibles. Pour ajouter plus de 1 model, vous devez les lister entre les accolades {}, séparés par des virgules, ex : {"models/player/barney.mdl","models/player/alyx.mdl"}.
description = [[Tuer et proteger des terroristes]], = La description de ce métier qui peut être vu dans le menu F4. Cette fonctionnalité est rarement utilisée, mais peut aidée.
weapons = {"weapon_deagle2", "weapon_mp52", "weapon_pumpshotgun2"}, = Les armes avec lesquelles on apparaît une fois dans le métier. Vous devez utiliser les noms d'entités d'armes ou ça ne marchera pas.
"swat", = La commande pour devenir ce métier. (Assurez vous 'exclure le slash / car DarkRP le fait automatiquement).
max = 3, = Combien de joueurs peuvent devenir de ce job en même temps ?
salary = 300, = Salaire gagné durant le jour de paie.
admin = 0, = Qui peut être de ce job ? (0 = tout le monde, 1 = admin, 2 = superadmin uniquement)
vote = true, = Avez-vous besoin de voter pour être dans cette team ? (false = non et true = oui)
hasLicense = true, = Est-ce que cette team nécessite une licence d'arme ? (false = non et true = oui)
Exemples
Champs Avancés
Vous pouvez créer des travaux personnalisés dans DarkRP. Cependant, il y a beaucoup de choses à tripoter. Cette page explique chaque "champ". Vous pouvez créer des emplois personnalisés dans DarkRP. Sinon, il y a beaucoup de choses.
Exemple avec toutes les fonctions
Voici un exemple avec toutes les fonctions disponibles
Explications
color (Color) (required) : La couleur de la team.
model (string/table) (required) : Le model de la team. Cela peut être une chaîne de caractères ou une table de caractères. Deux exemples :
A string, players who have this job have ONE model, namely the one given in the string:
A table, the model of the player holding this job is randomly chosen from the list of given models:
description (string) (required)
The description of a job shows up in the F4 menu when selecting the job. Describe what your job does and what the use of it is.
weapons (table) (required)
The list of weapons people with this job spawn with (besides the default weapons).
The following example means that the job spawns with the weapons in the list:
command (string) (required)
What do you have to enter in chat to get this job?
Example: type /example in chat to get the example job
If the job requires voting, a command "/voteexample" is added.
The "/" at the start of the command should be omitted.
max (number) (required)
How many people can have this job at any given time.
Set to a number between 0 and 1 to make it a percentage. E.g. max = 0.3 means at most 30% of the players can have this job.
Set to a whole number to set an absolute limit.
salary (number) (required)
The salary this job gets.
admin (number) (required)
What (admin) access you need to get this job.
If you want to customize this further (with donators, moderators and whatnot), look at customCheck (scroll down).
vote (boolean)
Do players need to create a vote to get this job? true for yes, false for no.
hasLicense (boolean)
Does this job get a gun license for free? true for yes, false for no.
It's useful to give the cops gun licenses.
You can only get this job if you had a specific other job first.
Example: You can only become a chief of police when you're already a CP:
Example 2: You can only become a mayor if you're either a CP or a chief:
customCheck (function)
Custom message when someone tries and fails to get the job.
See here for an example with donator jobs.
If using this as a function, the arguments are:
modelScale (number)
How big are the players that have this job?
Don't make it too big or too small, people will get trouble with jumping and crouching.
maxpocket (number)
The amount of items that can fit in the pocket of people having this job. If not set, it will revert to the setting in settings.lua, which is set to 10 by default.
maps (table)
In what maps this job will be available. This is just a list of maps.
candemote (boolean)
Can people who have this job be demoted? By default hobo's and citizens cannot be demoted because it has no use to demote them.
mayor (boolean)
People with this job can do things the mayor can do (create a lottery, accept warrants etc.).
chief (boolean)
People with this job can do things the chief can do.
medic (boolean)
People with this job can do things the medic can do.
cook (boolean)
People with this job can do things the cook can do.
hobo (boolean)
People with this job can do things the hobo can do.
ammo (table)
The ammo people spawn with.
The keys in the table are the ammo names and the values are how much of each ammo is given.
category (string)
The category it belongs to in the F4 menu.
This will throw an error if the category doesn't exist! Please see the categories page.
category (number)
Location in the category. Lower number means more on top of the list. By default this is set 100.
More advanced fields
playerClass (string)
The GMod player class to assign to the player when they change to this job.
CanPlayerSuicide (function)
A function that decides whether players with this job can commit suicide.
Arguments are:
Player ply
CanPlayerSuicide (function)
A function that decides whether players with this job can commit suicide.
Arguments are:
Player ply
PlayerCanPickupWeapon (function)
A function that decides whether players with this job can pick up a certain weapon.
Arguments are:
PlayerDeath (function)
Called when a player dies.
Arguments are:
PlayerLoadout (function)
Called when a player gets his weapons. Return true to prevent him from getting his default weapons!
Arguments are:
Player ply
PlayerSelectSpawn (function)
Called when a spawn is selected for this player.
Arguments are:
PlayerSetModel (function)
A function that decides what the model should be. Return a string to override the default model.
Arguments are:
Player ply
PlayerSpawn (function)
Called when a player spawns.
Arguments are:
Player ply
PlayerSpawnProp (function)
Called when a player attempts to spawn a prop.
Arguments are:
RequiresVote (function)
Decides whether the player needs to make a vote to get the job.
Overrides the vote field! (the vote field will have no effect when this is set)
Arguments are:
Example :
People need to make a vote if there are three or more people who have this job. People DON'T need to make a vote if there are fewer than three people with this job.
Autre :
VIPS can skip the vote
ShowSpare1 (function)
Called when a player presses the F1 key.
Arguments are:
Player ply
ShowSpare2 (function)
Called when a player presses the F2 key.
Arguments are:
Player ply
OnPlayerChangedTeam (function)
Called when a player switches to this job.
Arguments are:
Dernière mise à jour