#1

Hi, i have this code:
Код:
#define SLOTY 50

forward FotoradarUpdate();
public FotoradarUpdate()
{
	for(new i = 0;i<SLOTY;i++)
	{
		if(!IsPlayerConnected(i)) break;
		if(!IsPlayerInAnyVehicle(i)) break;
		for(new b = 0;b<MAX_FOTORADARY +1;b++)
		{
			if(IsPlayerInRangeOfPoint(i,FotoInfo[b][Range],FotoInfo[b][posX],FotoInfo[b][posY],FotoInfo[b][posZ]))
			{
				if(GetVehicleSpeed(GetPlayerVehicleID(i)) > FotoInfo[b][vMax])
				{
					SendClientMessage(i, COLOR_RED, "Przekroczyłeś prędkość");
					ShowPlayerFadeScreenToBlank(i, 15, 255, 255, 255, 200);
				}
					format(dstring,sizeof(dstring),"[INFO] Jesteś blisko radaru UID:"CWHITE" %d!",FotoInfo[b][UID]);
					SendClientMessage(i, COLOR_YELLOW, dstring);
			}
		}
	}
	return 1;
}
And i have problem. It works only for ID 0. How can in fix that ?
Reply
#2

Quote:
Originally Posted by Starve
Посмотреть сообщение
Hi, i have this code:
Код:
#define SLOTY 50

forward FotoradarUpdate();
public FotoradarUpdate()
{
	for(new i = 0;i<SLOTY;i++)
	{
		if(!IsPlayerConnected(i)) break;
		if(!IsPlayerInAnyVehicle(i)) break;
		for(new b = 0;b<MAX_FOTORADARY +1;b++)
		{
			if(IsPlayerInRangeOfPoint(i,FotoInfo[b][Range],FotoInfo[b][posX],FotoInfo[b][posY],FotoInfo[b][posZ]))
			{
				if(GetVehicleSpeed(GetPlayerVehicleID(i)) > FotoInfo[b][vMax])
				{
					SendClientMessage(i, COLOR_RED, "Przekroczyłeś prędkość");
					ShowPlayerFadeScreenToBlank(i, 15, 255, 255, 255, 200);
				}
					format(dstring,sizeof(dstring),"[INFO] Jesteś blisko radaru UID:"CWHITE" %d!",FotoInfo[b][UID]);
					SendClientMessage(i, COLOR_YELLOW, dstring);
			}
		}
	}
	return 1;
}
And i have problem. It works only for ID 0. How can in fix that ?
Change break; to continue;

Break entirely stops the loop and continue essentially just skips the iteration and it moves on to the next. You can read more about break and continue here... https://sampwiki.blast.hk/wiki/Control_Structures#break https://sampwiki.blast.hk/wiki/Control_Structures#continue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)