string spamming (+rep)
#1

Hi, Whats wrong with this code?

Код:
CMD:cc(playerid, params[])
{
	foreach(Player, i)
	{
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			for(new e = 0; e < 4; e++) ClearChatbox(i);
			new broadcast[128];
			format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid));
			ABroadCast(COLOR_LIGHTRED, broadcast, 1);
		}
	}
	return 1;
}
Its spamming like hell when im executing that command
Reply
#2

pawn Код:
CMD:cc(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(new i; i<100; i++)
        {
            SendClientMessageToAll(-1, "");
        }
        new string[128];
        format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid));
        SendClientMessageToAll(LIGHTBLUE, string);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Danijel.
Посмотреть сообщение
pawn Код:
CMD:cc(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(new i; i<100; i++)
        {
            SendClientMessageToAll(-1, "");
        }
        new string[128];
        format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid));
        SendClientMessageToAll(LIGHTBLUE, string);
    }
    return 1;
}
it should be ABroadCast not SendClientMessageToAll
Reply
#4

Quote:
Originally Posted by Danijel.
Посмотреть сообщение
pawn Код:
CMD:cc(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(new i; i<100; i++)
        {
            SendClientMessageToAll(-1, "");
        }
        new string[128];
        format(string, sizeof string, "BLRP | Admin %s cleared chat", GetName(playerid));
        SendClientMessageToAll(LIGHTBLUE, string);
    }
    return 1;
}
That will spam for 100 times to all players.


Btw, try this:
pawn Код:
CMD:cc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        foreach(Player, i)
        {  
            for(new e = 0; e < 4; e++) ClearChatbox(i);
        }
        new broadcast[128];
        format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_LIGHTRED, broadcast, 1);
    }
    return 1;
}
I'm sure "ABroadCast" already have loop to all players on it.
Reply
#5

Quote:
Originally Posted by Robo_N1X
Посмотреть сообщение
That will spam for 100 times to all players.


Btw, try this:
pawn Код:
CMD:cc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        foreach(Player, i)
        {  
            for(new e = 0; e < 4; e++) ClearChatbox(i);
        }
        new broadcast[128];
        format(broadcast, sizeof(broadcast), "AdmCMD: Administrator %s has cleared the chat", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_LIGHTRED, broadcast, 1);
    }
    return 1;
}
I'm sure "ABroadCast" already have loop to all players on it.
Excellent bro +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)