Dialog on Area help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog on Area help (
/showthread.php?tid=442947)
Dialog on Area help -
BossZk - 09.06.2013
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
Re: Dialog on Area help -
Aly - 09.06.2013
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.
Re: Dialog on Area help -
BossZk - 09.06.2013
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");
}
}
}
}
Re: Dialog on Area help -
Aly - 09.06.2013
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;
}
}
}
}
Re: Dialog on Area help -
BossZk - 09.06.2013
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
Re: Dialog on Area help -
random123 - 10.06.2013
I suggest using CreateDynamicArea and OnPlayerEnterDynamicArea(from incognitos streamer). It would be much more efficient.