DarkRP.Player.IsCP

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 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: NewerShared.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.IsCP]Player:IsCP[/url][/b]

Examples

DescriptionAutomaticly unarrests all cops. (Untested code, might not work)
Used onNewerServer.png
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

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