DarkRP.CanVote

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 vote on a certain vote.
Syntax
GAMEMODE:CanVote(Player ply, table vote)
ReturnsCanVote (boolean): whether the player can vote on this vote
message (string): the message shown when they can't

Arguments

  • ply (Player)
  • The player to decide suffrage for

  • vote (table)
  • the table that contains all the information about the vote

    Examples

    DescriptionOnly donators and admins can vote (such censorship, god damn)
    Code
    hook.Add("CanVote", "example", function(ply, vote)
     
    	if ply:GetNWString("usergroup") ~= "donator" and not ply:IsAdmin() then
    		return false, "Nein!"
    	end
    	-- Return nothing otherwise to take the default 
    end)
    OutputNazi Germany