DarkRP.canChangeJob

From Official DarkRP Wiki
Jump to: navigation, search
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of hooks.

Syntax

DescriptionCalled when a player attempts to change their job title.
Syntax
GAMEMODE:canChangeJob(Player ply, string job)
Returnscan_change (boolean): whether the player can change their name to the name given.

msg (string): the message to be shown when the answer is no

replace (string): A replacement of the job name

Arguments

  • ply (Player)
  • The player who is trying to change their name

  • job (string)
  • The job

    Examples

    DescriptionOnly citizens can change job, and the job will become "Citizen: <jobname>"
    Code
    hook.Add("canChangeJob", "citizens", function(ply, job)
    	if ply:Team() ~= TEAM_CITIZEN then return false, "Only citizens can change job" end
     
    	return true, nil, "Citizen: " .. job
    end)
    Outputwhen saying "/job Prop surf teacher" as citizen, the job will become "Citizen: Prop surf teacher" The player will get a notification when he's not a citizen.