AddKey
lua
The new key holder gets entry access. All extra permissions start turned off. The owner can change them later in the property menu.
Parameters
- playerId:
number | false | 0The player who gives the key. Passfalseor0for a server call, which skips all checks. - propertyId:
numberThe property ID - keyHolder:
stringThe identifier (citizenid) of the player who gets the key
Return Value
booleanWhether the key was addedstring?The reason, if it failed
Behavior
- The player must be allowed to manage keys: the owner, a key holder with the
manage_property_keyspermission, or an admin. - It fails during a police lockdown that blocks key management.
- The target must be online.
- A player can only give a key to themselves if
Config.AllowSelfAsKeyholderis on. - Both players get a notification.
- No checks are done.
- The target can be offline. The identifier is stored as given.
- The target gets a notification if they are online.
Player call
Server call