Question
#1

How can i make if someone enters the zone
pawn Code:
Aztec = GangZoneCreate(1695.218, -1958.204, 1820.712, -1863.458);
It will show, "You have enter Varrios Los Aztecas Territory"
Reply
#2

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 1.0,1695.218, -1958.204, 1820.712, -1863.458))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You have enter Varrios Los Aztecas Territory.");
    }
Reply
#3

Where do i add that xD??
Reply
#4

https://sampwiki.blast.hk/wiki/Areacheck
Reply
#5

Quote:
Originally Posted by Darnell
View Post
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 1.0,1695.218, -1958.204, 1820.712, -1863.458))
    {
        SendClientMessage(playerid,0xFFFFFFFF,"You have enter Varrios Los Aztecas Territory.");
    }
wouldnt that just be a circle?

Edit: Nvm just saw your areacheck post, that is the way to check for a square/rectangle area.
Reply
#6

I get a spam full of you have enter varios terriotorY**
pawn Code:
forward isPlayerInArea();
public isPlayerInArea()
{
        for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
        {
        GetPlayerPos(i,X,Y,Z);
        if(X <= 2725 && X >= -1662 && Y <= 2858 && Y >= -1500)
        {
            SendClientMessage(i,orange,"You have entered Varrios Los Aztecas Territory");
        }
        }
        return 1;
}
OnGameModeInIt
pawn Code:
SetTimer("isPlayerInArea", 1000, 1);
Reply
#7

This is how I would do it.

pawn Code:
//Somewhere on top of your script
new bool:IsPlayerInLosAztTer[MAX_PLAYERS];

//Somewhere in the middle between the Callbacks (public's)
forward isPlayerInArea();
public isPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
    {
        new Float:Pos_X, Float:Pos_Y, Float:Pos_Z);
        GetPlayerPos(i , Pos_X, Pos_Y, Pos_Z);
        if(Pos_X <= 2725 && Pos_X >= -1662 && Pos_Y <= 2858 && Pos_Y >= -1500)
        {
            if(IsPlayerInLosAztTer[i]) return 1;
            if(!IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i,orange,"You have entered the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = true;
                return 1;  
            }
        }
        else
        {
            if(!IsPlayerInLosAztTer[i]) return 1;
            if(IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i, orange, "You have left the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = false;
                return 1;
            }
        }
    }
    return 1;
}
FIRST EDIT: Just editted everything into foreach, sorry didn't saw it earlier.

If you would like me to //comment everything and explain it all for you, just reply to this topic .
I hope this helps.

Kind Regards,
Improvement™
Reply
#8

Quote:
Originally Posted by Improvement™
View Post
This is how I would do it.

pawn Code:
//Somewhere on top of your script
new bool:IsPlayerInLosAztTer[MAX_PLAYERS];

//Somewhere in the middle between the Callbacks (public's)
forward isPlayerInArea();
public isPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
    {
        new Float:Pos_X, Float:Pos_Y, Float:Pos_Z);
        GetPlayerPos(i , Pos_X, Pos_Y, Pos_Z);
        if(Pos_X <= 2725 && Pos_X >= -1662 && Pos_Y <= 2858 && Pos_Y >= -1500)
        {
            if(IsPlayerInLosAztTer[i]) return 1;
            if(!IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i,orange,"You have entered the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = true;
                return 1;  
            }
        }
        else
        {
            if(!IsPlayerInLosAztTer[i]) return 1;
            if(IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i, orange, "You have left the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = false;
                return 1;
            }
        }
    }
    return 1;
}
FIRST EDIT: Just editted everything into foreach, sorry didn't saw it earlier.

If you would like me to //comment everything and explain it all for you, just reply to this topic .
I hope this helps.

Kind Regards,
Improvement™
Also, if you have multiple areas instead of making a who bunch of boolean values you could have a variable store the id of the area they are in.
Reply
#9

Dude when i connect to server i get a message saying i enter and when i spawn it says i leave
Reply
#10

Quote:
Originally Posted by Tanush123
View Post
Dude when i connect to server i get a message saying i enter and when i spawn it says i leave
Do you have any such player variables compared to these?:
pawn Code:
new bool:IsPlayerSpawned[MAX_PLAYERS];
new bool:IsPlayerLogged[MAX_PLAYERS];
new gPlayerSpawned[MAX_PLAYERS];
new gPlayerLogged[MAX_PLAYERS];
If so then please post them, I will fix this issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)