asay command doubled message
#1

I've made a simple asay command that should be sent globally to everyone and have a color depending on the admin level.Level 1 admin has a blue colors, level 2 has red and level 3 has green.The problem is when i do /asay with multiple admins ingame, for example 2 it sends the message twice with different colors since he was lvl 2 and i was lvl 3.
CMD:
Код:
CMD:asay(playerid,params[])
{
	if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid,COLOR_ERROR,"Error: {FFFFFF}Unknown command, type /cmds for the list of commands.");
	else
	{
		new text[200];
		if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /asay [message]");
		format(text,sizeof(text),"Admin: %s",text);
		SendMessageToPlayers(text);
	}
	return 1;
}
Stock:
Код:
stock SendMessageToPlayers(text[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if(PlayerInfo[i][pAdmin] == 1)
	{
		SendClientMessageToAll(COLOR_LEVEL1,text);
	}
	else if(PlayerInfo[i][pAdmin] == 2)
	{
  		SendClientMessageToAll(COLOR_LEVEL2,text);
	}
	else if(PlayerInfo[i][pAdmin] == 3)
	{
		SendClientMessageToAll(COLOR_LEVEL3,text);
	}
	}
	return 1;
}
Reply


Messages In This Thread
asay command doubled message - by Mike861 - 04.07.2018, 13:52
Re: asay command doubled message - by Exhibit - 04.07.2018, 13:57
Re: asay command doubled message - by Slawi - 04.07.2018, 14:07
Re: asay command doubled message - by Banditul18 - 04.07.2018, 14:08
Re: asay command doubled message - by Mike861 - 04.07.2018, 14:09
Re: asay command doubled message - by Lokii - 04.07.2018, 14:32
Re: asay command doubled message - by Calisthenics - 04.07.2018, 14:46
Re: asay command doubled message - by Slawi - 04.07.2018, 14:49
Re: asay command doubled message - by Mike861 - 04.07.2018, 14:52

Forum Jump:


Users browsing this thread: 2 Guest(s)