DarkRP.Player.IsCP

From DarkRP
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 functions.
Function
Function name Player:IsCP()
Description:
Returns true or false depending on if the player is in any of the police jobs as defined in shared.lua.
Returns: boolean
Part of Library: Player
Realm:
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.IsCP]Player:IsCP[/url][/b]

Examples[edit]

DescriptionAutomaticly unarrests all cops. (Untested code, might not work)
Used on
Code
local function Tick()
	local players = player.GetAll()
	for _,ply in ipairs(players) do
		if ply:IsCP() then
			ply:Unarrest()
		end
	end
end
hook.Add("Think","DarkRPExampleTick",Tick)
OutputAll cops unarrested.


Additional Notes[edit]

  • A job can be set as a CP in shared.lua.