Timer problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer problem (
/showthread.php?tid=219859)
Timer problem -
xir - 02.02.2011
hello, i have a problem with my isplayerinrangeofpoint
when I enter area it works, but when i leave or just join the server it spam me with "You left test"
pawn Код:
forward Test();
public Test()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, 252.3922,117.3293,1003.2188))
{
if(Send[i] == 0)
{
SendClientMessage(i,Blue,"Welcome to Test!");
Send[i] = 1;
}
}
else
{
SendClientMessage(i,Yellow, "You left Test");
Send[i] = 0;
}
}
return 1;
}
pawn Код:
new Send[MAX_PLAYERS] = 0;
pawn Код:
SetTimer("Test", 2000, true);
help please
Re: Timer problem -
armyoftwo - 02.02.2011
pawn Код:
forward Test();
public Test()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, 252.3922,117.3293,1003.2188))
{
if(Send[i] == 0)
{
SendClientMessage(i,Blue,"Welcome to Test!");
Send[i] = 1;
}
}
else
{
if(Send[i] == 1)
{
SendClientMessage(i,Yellow, "You left Test");
Send[i] = 0;
}
}
}
return 1;
}
Should work now
Re: Timer problem -
alpha500delta - 02.02.2011
Because, you set a timer to 2 seconds right. Now every 2 seconds it is going to check if you are in the area or not. If your not in the area it is going to say "you have left the test"
Now it repeats the same teste every 2 seconds, thats why its getting spammed.
Hope I was helpfull.