25.07.2011, 07:01
Can you make a callback IsPlayerInGangZone please?
stock IsPlayerInAnyZone(playerid)
{
for(new i = 0; i < MAX_AREAS; i++)
{
if(!AreaInfo[i][aCreated]) continue; //Better perfomance, mostly
if(IsPlayerInArea(playerid, i) return true;
continue;
}
return false;
}
Ehm, and what should it do? Check if the player is in any zone, or if the player's in gangzone 'id'. For the first one, there is no function yet, but it's easy to make. For the second one: IsPlayerInArea(playerid, areaid);. And now 'bout the first one:
pawn Код:
|
Originally Posted by Main post -.-
OnPlayerEnterArea(playerid, areaid);
OnPlayerExitArea(playerid, areaid); |
MinX = AreaInfo[areaid][aPosMinX]; MaxX = AreaInfo[areaid][aPosMaxX]; MinY = AreaInfo[areaid][aPosMinY]; MaxY = AreaInfo[areaid][aPosMaxY]; MaxZ = AreaInfo[areaid][aPosMaxZ]; |
aztecas = GangZoneCreate(1652.164428, -2159.922851, 1980.164428, -1839.922729);
aztecas = CreateArea3(1652.164428, -2159.922851, 1980.164428, -1839.922729);
CreateArea(Float:MinX, Float:MaxX, Float:MinY, Float:MaxY, Float:MinZ = -1.0, Float:MaxZ = -1.0) - Creates an area CreateArea2(Float:MinX, Float:MinY, Float:MaxX, Float:MaxY, Float:MinZ = -1.0, Float:MaxZ = -1.0) - Creates an area (gangzone format) CreateArea3(Float:MaxX, Float:MinX, Float:MaxY, Float:MinY, Float:MinZ = -1.0, Float:MaxZ = -1.0) - Creates an area (worldbounds format) |
public OnPlayerEnterDynamicArea(playerid, areaid) { for(new i = 0; i < MAX_AREAS; i++) { if(Areas[i][AreaID] == areaid) { new Fname[50]; format(Fname, sizeof(Fname), "OnAr_%s", Areas[i][AreaName]); CallLocalFunction(Fname, "i", playerid); break; } } } public OnPlayerLeaveDynamicArea(playerid, areaid) { for(new i = 0; i < MAX_AREAS; i++) { if(Areas[i][AreaID] == areaid) { new Fname[50]; format(Fname, sizeof(Fname), "ExitAr_%s", Areas[i][AreaName]); CallLocalFunction(Fname, "i", playerid); break; } } } // macro #define OnArea:%1(%2) \ forward OnAr_%1(%2); \ public OnAr_%1(%2) #define ExitArea:%1(%2) \ forward ExitAr_%1(%2); \ public ExitAr_%1(%2)