Looping
#9

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
PHP код:
for (new isizeof(Stadium); i++) {
     if(
IsPlayerInRangeOfPoint(playerid2.5StadiumEntrance[i][x], StadiumEntrance[i][y], StadiumEntrance[i][z])) {
        
SendClientMessage(playerid, -1"successful");
                return 
1;
    }
} else {
    
SendClientMessage(playerid, -1"not successful");
    return 
1;

You realize...
You're calling the ELSE statement every single time right?
So lets say you have...
10 Inside your array..
You're going to get 10 messages...
The code Posted above should work.
Maybe you're talking about the first problem which is already solved (thanks to Vince).
The problem wasn't spamming with messages. There's break; in the code, which will prevent the spam.

The problem now is this:
Quote:
Originally Posted by Darkwood17
Посмотреть сообщение
I'm using this code (this is a command):
Код:
for (new i; i < sizeof(Stadium); i++)
{
     if (IsPlayerInRangeOfPoint(playerid, 2.5, StadiumEntrance[i][x], StadiumEntrance[i][y], StadiumEntrance[i][z]))
     APlayerData[playerid][NearStadium] = true;
}
if (APlayerData[playerid][NearStadium] == true) SendMessage(playerid, "you're near the stadium");
else SendMessage(playerid, "you're away from the stadium");
NearStadium is in the player data enum, and it's false by default (when player connect).
When I enter the server (not near the stadium) and type the command, it return "you're away from the stadium", which is right.
Then when I'm standing near the stadium and enter the command it return "you're near the stadium", which is right too.
But after that, when I go away from the stadium, it always return "you're near the stadium", which is wrong.
Reply


Messages In This Thread
Looping (solved) - by Darkwood17 - 10.07.2015, 15:35
Re: Looping - by notime - 10.07.2015, 15:40
Re: Looping - by Darkwood17 - 10.07.2015, 15:45
Re: Looping - by notime - 10.07.2015, 15:46
Re: Looping - by Vince - 10.07.2015, 16:44
Re: Looping - by Darkwood17 - 10.07.2015, 17:48
Re: Loop - by Darkwood17 - 11.07.2015, 05:39
Re: Looping - by Prokill911 - 11.07.2015, 06:12
Re: Looping - by Darkwood17 - 11.07.2015, 06:29
Re: Looping - by Prokill911 - 11.07.2015, 06:34

Forum Jump:


Users browsing this thread: 5 Guest(s)