-
Notifications
You must be signed in to change notification settings - Fork 0
Home
PrivateArea.inc is a library that allows you to create private areas on a server in SA: MP.
- When a player tries to enter a private area, they are knocked back.
- Streamer and foreach are required to work with this library.
- You can only create zones with type Sphere.
- MAX_PRIVATE_AREA - the maximum number of privacy zones to be created (50 by default);
- PRIVATE_AREA_NONE - no private zone exists;
- PRIVATE_AREA_FULL_LIMIT - the limit for creating private zones has been exceeded.
public OnPlayerTriedEnterPrivateArea(playerid, areaid);
CreatePrivateArea(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, priority = 0);
DestroyPrivateArea(areaid);
DenyEntryToPrivateArea(areaid, playerid = -1);
AllowEntryToPrivateArea(areaid, playerid = -1);
IsPlayerAddInPrivateArea(playerid, areaid);
OnPlayerTriedEnterPrivateArea - is an auto-called function that is called when a player tries to enter a private area.
- Options: playerid - player ID; areaid - ID dynamic area.
CreatePrivateArea - Creates a private area on the server.
-
Returned values: Dynamic zone ID if successful; PRIVATE_AREA_FULL_LIMIT - if the limit for creating private zones has been exceeded.
-
Options: x, y, z - zone coordinates; size - zone size; worldid - virtual world (default -1); innerid - interior (default -1); playerid - specify the Id of the player if you want to create a zone only for him (by default -1); priority - set the priority of the zone loading (by default 0).
DestroyPrivateArea - Destroys the private area from the server.
-
Returned values: 1 - if the private zone was successfully deleted; PRIVATE_AREA_NONE - if the private zone does not exist.
-
Options: areaid - ID dynamic area;
DenyEntryToPrivateArea - prohibits the player from entering the private area.
-
Returned values: 1 - if successful; 0 - if the player's ID is less than 0 or more than MAX_PLAYERS-1; PRIVATE_AREA_NONE - if the private zone does not exist.
-
Options: areaid - ID dynamic area; playerid - the ID of the player to deny entry (default -1 (denies entry to all)).
AllowEntryToPrivateArea - Allows the player to enter a private area.
-
Returned values: 1 - if successful; 0 - if the player's ID is less than 0 or more than MAX_PLAYERS-1; PRIVATE_AREA_NONE - if the private zone does not exist.
-
Options: areaid - ID dynamic area; playerid - the ID of the player who needs to be allowed to enter (by default -1 (denies entry to everyone)).
IsPlayerAddInPrivateArea - Checks if the player has been added to the private area.
-
Returned values: 1 - if the player is added to the private zone; 0 - if the player's ID is less than 0 or greater than MAX_PLAYERS-1, or the player has not been added to the private zone; PRIVATE_AREA_NONE - if the private zone does not exist.
-
Options: playerid - player ID; areaid - ID dynamic area.
new PrivateArea;
public OnGameModeInit() {
PrivateArea = CreatePrivateArea(0.0, 0.0, 0.0, 100.0);
DenyEntryToPrivateArea(PrivateArea);
return 1;
}
public OnPlayerTriedEnterPrivateArea(playerid, areaid) {
if(areaid == PrivateArea)
SendClientMessage(playerid, -1, !"Forbidden territory. No entry!");
return 1;
}