SA-MP Forums Archive
Does not write it out properly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Does not write it out properly (/showthread.php?tid=639498)



Does not write it out properly - SecretMax - 18.08.2017

Hello, that would be my problem with this command that when I type then I will not list all the admin names, but write only one line.

(Sorry for bad english)

Код:
else if( Compare(command, "/offlineadminok") ) {
	    if( playerInfo[playerid][pi_admin] < 1 ) return SendClientMessage( playerid, 0xc40000AA, "• {ffffff}(( You are not admin. ))" );
        
        new nevek[50][24],
	    	szam;

		format( Query, sizeof(Query), "SELECT `name` FROM `players` WHERE `admin` > 0");
		mysql_query( Query );
		mysql_store_result();
		
		while( mysql_fetch_row_format(nevek[szam], "|") ) { szam++; }
		
		for( new i; i < szam; i ++ ) {
			format( global_bugfix_string, sizeof(global_bugfix_string), "%s", nevek[i] );
		}

		if( szam == 0 ) {
  			format( global_bugfix_string, sizeof(global_bugfix_string), "There isnt admins.");
		}
		
		SendClientMessage( playerid, 0x6fafbfAA, "(( Offline admins: ))" );
		SendClientMessage( playerid, 0x6fafbfAA, global_bugfix_string );

		return 1;
	}



Re: Does not write it out properly - HoussemGaming - 18.08.2017

Switch to mysql-R39, you using the outdated plugin.
Thats my opnion


Re: Does not write it out properly - SecretMax - 18.08.2017

If I do this with a dialog I work properly, but I want to write it out for chat.


Re: Does not write it out properly - Misiur - 18.08.2017

pawn Код:
for( new i; i < szam; i ++ ) {
    format( global_bugfix_string, sizeof(global_bugfix_string), "%s", nevek[i] );
}
You overwrite the string every time. Do something like
pawn Код:
global_bugfix_string[0] = EOS;
for( new i; i < szam; i ++ ) {
    strcat(global_bugfix_string, nevek[i]);
}