SendClientMessage new line
#1

Hi, please help, I have a command that says all players who have contracts, but all are in a single line



as I do to make it look every player who has a contract on a different line



my code

Код:
CMD:hitlist(playerid, params[])
{
    #pragma unused params
        new count = 0;
        new string[1024];
        new fstring[1024];
       // new ARank[128];
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
	 		if (IsPlayerConnected(i))
 			{
				if(pInfo[i][Placehit] > 0)
 				{
					format(fstring, sizeof(fstring), "%s(%i) -  {FFFF00}%s |", pNameHit(i), i, Comma(pInfo[i][Placehit]));
     				strcat(string, fstring);
					count++;
				}
    			
			}
		}
  		SendClientMessage(playerid, COLOR_YELLOW, "[__________ HIT LIST __________]");
		SendClientMessage(playerid, COLOR_WHITE, string);
		return 1;
}
Reply
#2

Place the SendClientMessage inside the loop (IsPlayerConnected)
Reply
#3



:c

Код:
CMD:hitlist(playerid, params[])
{
    #pragma unused params
        new count = 0;
        new string[1024];
        new fstring[1024];
       // new ARank[128];
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
	 		if (IsPlayerConnected(i))
 			{
				if(pInfo[i][Placehit] > 0)
 				{
					format(fstring, sizeof(fstring), "%s(%i) -  {FFFF00}%s", pNameHit(i), i, Comma(pInfo[i][Placehit]));
     				strcat(string, fstring);
					count++;
				}
    			SendClientMessage(playerid, COLOR_YELLOW, "[__________ HIT LIST __________]");
				SendClientMessage(playerid, COLOR_WHITE, string);
			}
		}
  		
		return 1;
}
Reply
#4

What about inside the pInfo[i][placehit]?
Reply
#5

same result
Reply
#6

The Hit List message at the top for(new

And

SendClientMessage(playerid, -1, string) at the format
Reply
#7

pawn Код:
CMD:hitlist(playerid, params[])
{
    new count = 0,string[1024],fstring[1024];
    // new ARank[128];
    SendClientMessage(playerid, COLOR_YELLOW, "[__________ HIT LIST __________]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(pInfo[i][Placehit] > 0)
            {
                format(fstring, sizeof(fstring), "%s(%i) -  {FFFF00}%s", pNameHit(i), i, Comma(pInfo[i][Placehit]));
                strcat(string, fstring);
                count++;
            }
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
You didn't need the pragma there.
Reply
#8

pawn Код:
CMD:hitlist(playerid, params[])
{
    new count = 0,fstring[80];
    SendClientMessage(playerid, COLOR_YELLOW, "[__________ HIT LIST __________]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(pInfo[i][Placehit] > 0)
            {
                format(fstring, sizeof(fstring), "%s(%i) -  {FFFF00}$%s", pNameHit(i), i, Comma(pInfo[i][Placehit]));
                count++;
                SendClientMessage(playerid, COLOR_WHITE, fstring);
            }
        }
    }
    if(count == 0) return SendClientMessage(playerid, 0xFF0000FF, "There are currently no players with a hit contract.");
    return 1;
}
Reply
#9

Sorry, I accidentally put 'string' instead of 'fstring'. I edited my post above, so that should work now.

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
CMD:hitlist(playerid, params[])
{
    new count = 0,fstring[80];
    SendClientMessage(playerid, COLOR_YELLOW, "[__________ HIT LIST __________]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(pInfo[i][Placehit] > 0)
            {
                format(fstring, sizeof(fstring), "%s(%i) -  {FFFF00}$%s", pNameHit(i), i, Comma(pInfo[i][Placehit]));
                count++;
                SendClientMessage(playerid, COLOR_WHITE, fstring);
            }
        }
    }
    if(count == 0) return SendClientMessage(playerid, 0xFF0000FF, "There are currently no players with a hit contract.");
    return 1;
}
Reply
#10

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Sorry, I accidentally put 'string' instead of 'fstring'. I edited my post above, so that should work now.
thanks <3



and want to thank everyone for helping me <3
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)