Jump to navigation Jump to 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.
|Description||Called when a player wants to buy a door|
GAMEMODE:PlayerBuyDoor(Player ply, Entity ent)
|Returns||allowed (boolean): whether the player is allowed to buy this door.|
reason (string): the reason to give if the player is not allowed to buy the door.
The player who wants to buy it
The door in question
|Description||Allows only citizens to buy the door with EntIndex 31. The reason it gives to non-citizens is that they're not citizens. It also makes sure the message "You bought this door!" does not appear (that's what the last true does)|
hook.Add( "PlayerBuyDoor", "example", function(ply, ent) if ent:EntIndex() == 31 then return ply:Team() == TEAM_CITIZEN, "You're not a citizen!", true end end)
|Output||Door 31 is citizen only|
|Description||Makes sure hobo's can't buy any doors|
hook.Add( "PlayerBuyDoor", "example2", function(ply, ent) return ply:Team() ~= TEAM_CITIZEN, "You're homeless, you can't buy doors!", true end)
|Output||Hobo's can't purchase doors|