Foreach question.
#1

Код:
	foreach(new i : Player)
	{
	    if(Data[i][Sr] == 1)
	    {
	        if(Data[i][pPower] < 150)
			{
		 		SendClientMessage(playerid, COLOR_RED, "Error: You do not have enough energy!");
		 		Data[i][Sr] = 0;
		 		Data[i][trans] = 0;
		 		Data[i][pPower] = Data[i][sPower];
		 		return 1;
			}
So basically, if I use 'i' after I have determined who it's not talking about, will it still effect everyone?
Reply
#2

Quote:

foreach(new i : Player)
{
if(Data[i][Sr] == 1)
{
if(Data[i][pPower] < 150)
{
SendClientMessage(i, COLOR_RED, "Error: You do not have enough energy!");
Data[i][Sr] = 0;
Data[i][trans] = 0;
Data[i][pPower] = Data[i][sPower];
}}}
return 1;
}

try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)