DarkRP.PlayerBuyVehicle
Jump to navigation
Jump to search
ply (Player)
ent (Entity)
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 | Called when a player wants to buy a vehicle |
---|---|
Syntax |
GAMEMODE:PlayerBuyVehicle(Player ply, Entity ent)
|
Returns | allowed (boolean): whether the player is allowed to buy this vehicle. reason (string): the reason to give to the player if they are not allowed to buy the vehicle |
Arguments
The player who wants to buy it
The vehicle in question
Examples[edit]
Description | Allows only citizens to buy vehicles. The reason it gives to non-citizens is that they're not citizens. It also makes sure the message "You bought this vehicle!" does not appear (that's what the last true does) |
---|---|
Code | hook.Add( "PlayerBuyVehicle", "example", function(ply, ent)
return ply:Team() == TEAM_CITIZEN, "You're not a citizen!", true
end)
|
Output | All vehicles are citizen only |