DarkRP.CanDemote
Jump to navigation
Jump to search
ply (Player)
target (Player)
reason (string)
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[edit]
Description | Decides whether a player can create a demotion vote. |
---|---|
Syntax |
GAMEMODE:CanDemote(Player ply, Player target, string reason)
|
Returns | CanDemote (boolean): whether the player is allowed to create a demotion vote message (string): the message shown when they can't |
Arguments
The player who can or cannot demote the other player
The target of the demote
The reason for the demote
Examples[edit]
Description | You 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)
|
Output | A fix for every player related problem in DarkRP |