DarkRP.CanDemote

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

DescriptionDecides whether a player can create a demotion vote.
Syntax
GAMEMODE:CanDemote(Player ply, Player target, string reason)
ReturnsCanDemote (boolean): whether the player is allowed to create a demotion vote
message (string): the message shown when they can't

Arguments

  • ply (Player)
  • The player who can or cannot demote the other player

  • target (Player)
  • The target of the demote

  • reason (string)
  • The reason for the demote

    Examples

    DescriptionYou can't make a vote if the reason contains the words RDM or NLR in it
    Code
    hook.Add("CanDemote", "example", function(ply, target, reason)
    	reason = string.lower(reason)
    	if string.find(reason, "rdm") or string.find(reason, "nlr") then 
    		return false, "shit demote, fuck off"
    	end
    	-- Return nothing otherwise to take the default 
    end)
    OutputA fix for every player related problem in DarkRP