Code:
#define CheckLoop(%0) for(new %0; %0 <= Connects;%0) if(IsPlayerConnected(%0))
new bool:gGlPrivados[MAX_PLAYERS] = false; // Gl Privados is disabled defaultly.
EnableGlPrivados(playerid)
{
gGlPrivados[playerid] = true;
SendClientMessage(playerid, -1, "GL Enabled.");
}
DisableGlPrivados(playerid)
{
gGlPrivados[playerid] = false;
SendClientMessage(playerid, -1, "GL Disabled.");
}
CMD:togglegl(playerid, params[])
{
if (gGlPrivados[playerid] == true)
DisableGlPrivados(playerid);
else
EnableGlPrivados(playerid);
return 1;
}
public OnPlayerText(playerid, text[])
{
// rest of your code
CheckLoop(i)
{
if (gGlPrivados[i] == true)
{
new string[132];
format(string, sizeof(string), "PlayerID: %d | Text: %s", playerid, text[0]);
SendClientMessage(i, 0xFF0000FF, string);
}
}
return 0;
}