SA-MP Forums Archive
What this script will do ? - 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: What this script will do ? (/showthread.php?tid=307280)



What this script will do ? - Amine_Mejrhirrou - 29.12.2011

Is this gonna send a msg to all the admins or just one ?
(cause in my server it send only to one admin ... and normaly all the admins should get the msg)
Код:
		for (new i = 0; i < MAX_PLAYERS; i++)
		{
			if (IsPlayerConnected(i)&&GetAdminLevel(i) >= 1)
			{
				SendClientMessage(i, COLOR_GRAY, str);
				return 1;
			}
		}



Re: What this script will do ? - AndreT - 29.12.2011

Don't use a return there. That will break out of the loop and stop processing the code.


Re : What this script will do ? - Amine_Mejrhirrou - 29.12.2011

it's in the end of the cmd so no effect i think


Re: What this script will do ? - PowerPC603 - 29.12.2011

As AndreT said, remove the "return 1" from the loop.
The way it's now, it will only send the message to the first admin in the list of connected players and will then stop, preventing all admins to be informed.

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
{
    if (IsPlayerConnected(i) && GetAdminLevel(i) >= 1)
    {
        SendClientMessage(i, COLOR_GRAY, str);
    }
}

return 1;



Re: What this script will do ? - Azzeto - 29.12.2011

That'll send a message to the people if their connected and their admin level is higher then 1.

After you fix the loop


Re : Re: What this script will do ? - Amine_Mejrhirrou - 29.12.2011

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
{
    if (IsPlayerConnected(i) && GetAdminLevel(i) >= 1)
    {
        SendClientMessage(i, COLOR_GRAY, str);
    }
}

return 1;
This way is to all admins right ? (just because of the return XD) thnks dude ++ rep for those how helped me