02.06.2009, 12:27
Description
This script will allows you to create easily area, for one player or for all palyers
Functions
Code:
CreateArea(Float:minX, Float:maxX, Float:minY, Float:maxY); // Create area for all players, return id of the zone or INVALID_AREA if the number of maximum area is reached DestroyArea(areaid); // Destroy area, return true if the area has been destroyed, false if the id is incorrect or that the area was not created IsPlayerInArea(playerid, areaid); //Check if a player is in the 'areaid', return: true if the player is in area, false if not in area GetPlayerInArea(playerid); //return: the id of the area in which is the player, INVALID_AREA if the player is not in an area SetPlayerInArea(playerid,areaid); //Place the player in the center of the area, return: true if the player has been placed in the area, false if the id of the zone is incorrect or that the area was not created // The following function returns the same as their equivalent in area for all player CreatePlayerArea(playerid,Float:minX, Float:maxX, Float:minY, Float:maxY); DestroyPlayerArea(playerid,areaid); IsPlayerInPlayerArea(playerid, areaid); GetPlayerInPlayerArea(playerid); SetPlayerInPlayerArea(playerid,areaid);
V1.0
Install
- Place the file 'areas.inc' in your folder /pawno/include
- Add '# include <areas>' at the top of your gamemode
- Add 'AR_OnGameModeInit();' At the top of the 'OnGameModeInit'
- Add 'AR_OnGameModeExit();' in 'OnGameModeExit'
- Add 'AR_OnPlayerConnect(playerid)'; in 'OnPlayerConnect'
- Add 'AR_OnPlayerDisconnect(playerid)'; in 'OnPlayerDisconnect'
- Add at the bottom of your script this:
pawn Code:
public OnPlayerEnterArea(playerid,areaid)
{
return 1;
}
public OnPlayerExitArea(playerid,areaid)
{
return 1;
}
public OnPlayerEnterPlayerArea(playerid,areaid)
{
return 1;
}
public OnPlayerExitPlayerArea(playerid,areaid)
{
return 1;
}