[Include] Player Area's (OnPlayerEnterArea etc)
#21

Can you make a callback IsPlayerInGangZone please?
Reply
#22

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 Код:
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;
}
If you want something else with it, please say it. And why a callback by the way?
Reply
#23

Small bug i saw when checking the script: stock GetAreaInfo(areaid, &Float:MinX, &Float:MaxX, &Float:MinY, &Float:MaxY, &Float:MinZ, &Float:MaxZ)
doesnt return MaxY
Reply
#24

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
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 Код:
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;
}
If you want something else with it, please say it. And why a callback by the way?
Also OnPlayerEnterGangZone. I saw some kind of this on a server, when you entered, for example, the Grove Street Families gang zone you got a game-text 'Grove Street Zone'.
I want that kind of code, understand?
Reply
#25

It's already there
Quote:
Originally Posted by Main post -.-
OnPlayerEnterArea(playerid, areaid);
OnPlayerExitArea(playerid, areaid);
Example script: http://pastebin.com/zQzmaZti

@Wups: I'll take a look at it, but are you sure? - I've tested this script (See the example script) and it returned all the values

EDIT: Fail, we were both wrong. It does return MaxY:
Quote:

MinX = AreaInfo[areaid][aPosMinX];
MaxX = AreaInfo[areaid][aPosMaxX];
MinY = AreaInfo[areaid][aPosMinY];
MaxY = AreaInfo[areaid][aPosMaxY];
MaxZ = AreaInfo[areaid][aPosMaxZ];

But not MinZ :P. However, I'll fix this ASAP, but not now; I gotta go (holiday eh)
Reply
#26

Can you make one with gang zones for me please? Would be appreciated)))
Reply
#27

Oh do you mean the colour? If yes; I'll do that then, but only not now or maybe not even this whole week; I'm on vacance right now, on a camping. I got more to do; We're about to leave already .
If no: Please explain it then :P - Maybe reconfigured areas?
Reply
#28

Wait I think I understood the point of this filterscript, should I use the same coords like the gangzone, for example:

pawn Код:
aztecas = GangZoneCreate(1652.164428, -2159.922851, 1980.164428, -1839.922729);
For the area should I use:

pawn Код:
aztecas = CreateArea3(1652.164428, -2159.922851, 1980.164428, -1839.922729);
Reply
#29

nice fs, but why did you create UpdateArea2 and 3, i cant see any different?
Reply
#30

But I do:
Quote:

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)

So the first one is MinX-MaX-MinY-MaxY-MinZ-MaxZ (last two are optional)
The second one is for gangzones format (if you use a tool for example): MinX, MinY, MaxX, MaxY, MinZ, MaxZ (last two are optional)
And the last one for worldbounds format: MaxX,MinX,MaxY,MinY,MinZ,MaxZ (last two are optional)
That's just a bit handier

@Gangsta_: Correct. But if you want it you can edit this include a bit and automatic add gangzones. I think I'll make that, but then later off course (And also a bool:useVisualZones to turn it on or off)
Reply
#31

nice!
thanks
Reply
#32

You're welcome
Reply
#33

Sorry for pumping this.
Sir , your include fucked up my script , it disabled onplayerdisconnect,onplayerconnect
also when i restarted server ,it didn't load my vehicles.
and tried your include on lots of scripts , it disabled them , so please recheck it.
Reply
#34

Hello!
Perhaps this is happening because this include may be out-dated. When I have time, I'll go see if I can't fix it, or otherwise rebuild it.

Kind regards,
Kwarde
Reply
#35

This is all in Incognito's streamer anyways you should add area naming so people can do this....

OnEnterArea:AreaName(playerid) {}
OnExitArea:AreaName(playerid) {}

That way there isn't a heap load of congestion inside OnPlayerEnterArea() and OnPlayerExitArea()

Add something like this....

Код:
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)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)