[darkrp]How do i make it so vip jobs are visible to all players?

I used this code:

[lua]TEAM_UnderCover = AddExtraTeam(“UnderCover Police”, {
color = Color(25, 25, 170, 255),
model = {“models/player/Group01/Female_01.mdl”,
“models/player/Group01/Female_02.mdl”,
“models/player/Group01/Female_03.mdl”,
“models/player/Group01/Female_04.mdl”,
“models/player/Group01/Female_06.mdl”,
“models/player/group01/male_01.mdl”,
“models/player/Group01/Male_02.mdl”,
“models/player/Group01/male_03.mdl”,
“models/player/Group01/Male_04.mdl”,
“models/player/Group01/Male_05.mdl”,
“models/player/Group01/Male_06.mdl”,
“models/player/Group01/Male_07.mdl”,
“models/player/Group01/Male_08.mdl”,
“models/player/Group01/Male_09.mdl”},
description = [[The hidden protector of every citizen that lives in the city.
You have the power to arrest criminals and protect innocents.
Hit a player with your arrest baton to put them in jail.
Bash a player with a stunstick and they may learn to obey the law.
The Battering Ram can break down the door of a criminal, with a warrant for their arrest.
The Battering Ram can also unfreeze frozen props (if enabled).
Type /wanted <name> to alert the public to the presence of a criminal.]],
weapons = {“arrest_stick”, “unarrest_stick”, “weapon_glock2”, “stunstick”, “door_ram”, “weaponchecker”,“rphands”},
command = “undercover”,
max = 4,
salary = 65,
admin = 0,
vote = false,
hasLicense = true,
customCheck = function(ply) return table.HasValue({“Donater”, “VIP”, “DonerAdmin”, “superadmin”, “DonerMod”}, ply:GetNWString(“usergroup”)) end
})[/lua]

[editline]10th June 2014[/editline]

wat do i add?

I believe you have to use this:


customCheck = function(ply) return CLIENT or table.HasValue({"Donater", "VIP", "DonerAdmin", "superadmin", "DonerMod"}, ply:GetNWString("usergroup")) end

CLIENT is only true on the client (read: player’s computer). When the client opens the F4 menu, DarkRP shows the jobs where the customCheck returns “true”. Since “CLIENT” is true for clients, it will show the job. As soon as the client clicks the job, a “message” is sent to the server, saying “I want to be this job”, the server does the customCheck again, and since “CLIENT” is false on the server (“SERVER” is true), it will not allow the person to get his / her job unless they are in the table of allowed groups.

However, I suggest you define the table of allowed groups on top of your jobs.lua file, otherwise you have to edit every donator job if you ever change admin mods or want to add / remove a rank.

It’ll be something like this.


TEAM_UnderCover = AddExtraTeam("UnderCover Police", {
color = Color(25, 25, 170, 255),
model = {"models/player/Group01/Female_01.mdl",
"models/player/Group01/Female_02.mdl",
"models/player/Group01/Female_03.mdl",
"models/player/Group01/Female_04.mdl",
"models/player/Group01/Female_06.mdl",
"models/player/group01/male_01.mdl",
"models/player/Group01/Male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/Male_04.mdl",
"models/player/Group01/Male_05.mdl",
"models/player/Group01/Male_06.mdl",
"models/player/Group01/Male_07.mdl",
"models/player/Group01/Male_08.mdl",
"models/player/Group01/Male_09.mdl"},
description = [[The hidden protector of every citizen that lives in the city.
You have the power to arrest criminals and protect innocents.
Hit a player with your arrest baton to put them in jail.
Bash a player with a stunstick and they may learn to obey the law.
The Battering Ram can break down the door of a criminal, with a warrant for their arrest.
The Battering Ram can also unfreeze frozen props (if enabled).
Type /wanted <name> to alert the public to the presence of a criminal.]],
weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker","rphands"},
command = "undercover",
max = 4,
salary = 65,
admin = 0,
vote = false,
hasLicense = true,
customCheck = function(ply) return CLIENT or
    table.HasValue({'superadmin', 'admin', 'vip',}, ply:GetNWString('usergroup'))
    end,
    CustomCheckFailMsg = 'The job is for VIP only!',
})