Topclan not in one line

Started by Nihongo^, Dec 27, 2018, 07:11 AM

Previous topic - Next topic

Nihongo^

Hi i am trying to add top clan and facing a problem
top clans are not in line you can see after "Top 5 Killers MD" its start showing from down any solution ? Here's my code



else if ( cmd == "topclan" )
        {
          local
     query = "SELECT Clan, Kills FROM ClanStats ORDER BY Kills DESC LIMIT 5", //Top 5
      q,
      name1, name2, name3, name4, name5,
      kills1, kills2, kills3, kills4, kills5, i = 1;
   
     q = QuerySQL( db, query );
     while( GetSQLColumnData( q, 0 ) )
     {
             switch(i)
             {
                    case 1:
                              name1 = GetSQLColumnData( q, 0 );
                              kills1 = GetSQLColumnData( q, 1 );
                              break;

                   case 2:
                              name2 = GetSQLColumnData( q, 0 );
                              kills2 = GetSQLColumnData( q, 1 );
                              break;

                   case 3:
                             name3 = GetSQLColumnData( q, 0 );
                             kills3 = GetSQLColumnData( q, 1 );
                             break;

           case 4:
                             name4 = GetSQLColumnData( q, 0 );
                             kills4 = GetSQLColumnData( q, 1 );
                             break;

                case 5:
                             name5 = GetSQLColumnData( q, 0 );
                             kills5 = GetSQLColumnData( q, 1 );
                             break;
            }

             GetSQLNextRow( q );
             i++;
     }
     FreeSQLQuery(q);
      ClientMessage( "Top 5 Killers: " + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );
}

D4rkR420R

Use the escape sequence for "new line", using \n.

Nihongo^

not work with /n
ClientMessage( "Top 5 Killers: \n" + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );

D4rkR420R

Quote from: Nihongo^ on Dec 28, 2018, 11:21 AMnot work with /n
ClientMessage( "Top 5 Killers: \n" + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );

ClientMessage( "Top 5 Killers:\n "+ name1 + " Kills: " + kills1 + "\n" + name2 + " Kills: " + kills2 + "\n" + name3 + " Kills: " + kills3 + "\n" + name4 + " Kills: " + kills4 + "\n" + name5 + " Kills: " + kills5 + ".", player, 255, 255, 0 );

Nihongo^


MEGAMIND

Quote from: KuRuMi^ on Dec 28, 2018, 05:19 PM
Quote from: Nihongo^ on Dec 28, 2018, 11:21 AMnot work with /n
ClientMessage( "Top 5 Killers: \n" + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );

ClientMessage( "Top 5 Killers:\n "+ name1 + " Kills: " + kills1 + "\n" + name2 + " Kills: " + kills2 + "\n" + name3 + " Kills: " + kills3 + "\n" + name4 + " Kills: " + kills4 + "\n" + name5 + " Kills: " + kills5 + ".", player, 255, 255, 0 );
this is what actually he told u too \n means a newline so as u  can see there are many \n so obviously each clan tag will start from new line

Nihongo^

Quote from: MEGAMIND on Dec 29, 2018, 05:56 AM
Quote from: KuRuMi^ on Dec 28, 2018, 05:19 PM
Quote from: Nihongo^ on Dec 28, 2018, 11:21 AMnot work with /n
ClientMessage( "Top 5 Killers: \n" + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );

ClientMessage( "Top 5 Killers:\n "+ name1 + " Kills: " + kills1 + "\n" + name2 + " Kills: " + kills2 + "\n" + name3 + " Kills: " + kills3 + "\n" + name4 + " Kills: " + kills4 + "\n" + name5 + " Kills: " + kills5 + ".", player, 255, 255, 0 );
this is what actually he told u too \n means a newline so as u  can see there are many \n so obviously each clan tag will start from new line
I know bro the question is how can i appear "MD" in one line /n seems not work for me

DizzasTeR

You guys can't be serious, he is literally asking to show it on one line, not show each in separate line, damn.

As for your issue, it seems like the clan "MD" has a new line char in it, try checking the db or wherever you are storing them and make sure the clan names don't have a new line.

Nihongo^

Quote from: Doom_Kill3R on Dec 29, 2018, 09:54 AMAs for your issue, it seems like the clan "MD" has a new line char in it, try checking the db or wherever you are storing them and make sure the clan names don't have a new line.
Ah my bad Thank you so much Doom Solved

Strike Eagle

Quote from: Nihongo^ on Dec 29, 2018, 11:50 AM
Quote from: Doom_Kill3R on Dec 29, 2018, 09:54 AMAs for your issue, it seems like the clan "MD" has a new line char in it, try checking the db or wherever you are storing them and make sure the clan names don't have a new line.
Ah my bad Thank you so much Doom Solved

Btw Thanks all
Best Game Hosting ever for VCMP
https://gamehosting.co/aff.php?aff=112