Dialog on Area help
#1

Having an issue with a dialog coming up when you enter an area, but the issue is the dialog keeps coming up, any codes or anything needed, and i will surely post them
Reply
#2

Well , you can put a cooldown after the player enters the checkpoint or when the player is entering the checkpoint you can put a boolean as true and when he left the area the boolean goes to false.
Reply
#3

its not a checkpoint, its a certain area

pawn Код:
forward IsPlayerInGArea();
pawn Код:
public IsPlayerInGArea()
{
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] != POLICE)
        {
            GetPlayerPos(i, X, Y, Z);
            if (X <= 1798.3859 && X >= 1779.8478 && Y <= -1294.5912 && Y >= -1306.7544)
            {
                ShowPlayerDialog(i, DIALOG_C, DIALOG_STYLE_MSGBOX, "Pay", "You will have to pay a fee of $1000 to get in", "Pay", "Cancel");
            }
        }
    }
}
Reply
#4

So you can use something like this.On the top of the script:
pawn Код:
new bool:IsInArea[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
IsInArea[playerid] = false;
pawn Код:
public IsPlayerInGArea()
{
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] != POLICE)
        {
            GetPlayerPos(i, X, Y, Z);
            if (X <= 1798.3859 && X >= 1779.8478 && Y <= -1294.5912 && Y >= -1306.7544)
            {
              if(IsInArea[i] == false)
              {
                ShowPlayerDialog(i, DIALOG_C, DIALOG_STYLE_MSGBOX, "Pay", "You will have to pay a fee of $1000 to get in", "Pay", "Cancel");
                IsInArea[i] = true;
              }
            }
            else
            {
              if(IsInArea[i] == true) IsInArea[i] = false;
            }
        }
    }
}
Reply
#5

Quote:
Originally Posted by Aly
Посмотреть сообщение
So you can use something like this.On the top of the script:
pawn Код:
new bool:IsInArea[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
IsInArea[playerid] = false;
pawn Код:
public IsPlayerInGArea()
{
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] != POLICE)
        {
            GetPlayerPos(i, X, Y, Z);
            if (X <= 1798.3859 && X >= 1779.8478 && Y <= -1294.5912 && Y >= -1306.7544)
            {
              if(IsInArea[i] == false)
              {
                ShowPlayerDialog(i, DIALOG_C, DIALOG_STYLE_MSGBOX, "Pay", "You will have to pay a fee of $1000 to get in", "Pay", "Cancel");
                IsInArea[i] = true;
              }
            }
            else
            {
              if(IsInArea[i] == true) IsInArea[i] = false;
            }
        }
    }
}
i dont think that will work

EDIT: tested it and the dialog wont even come up now

EDIT(2): Fixed it myself
Reply
#6

I suggest using CreateDynamicArea and OnPlayerEnterDynamicArea(from incognitos streamer). It would be much more efficient.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)