Jump to content
  • 0

TOP


Ph0eniX

Question

Stockul

stock ShowTop(playerid, stats[], what[])
{
	//--------------------------------------------------------------------------
	new Speed = GetTickCount(), DialString[3_000], String[2][128],
    Query[2][256], DBResult:Result1, DB:g_dbKeptAlive, what2[30];
    g_dbKeptAlive = db_open("Accounts.db");
	//--------------------------------------------------------------------------
	format(Query[0], 256, "SELECT `name` FROM `users` ORDER BY `%s` *1 DESC limit %d", stats, limit);
	Result1 = db_query(g_dbKeptAlive, Query[0]);
	//--------------------------------------------------------------------------
 	if(!strcmp(what, "Score")) 				what2 = "Score";
	else if(!strcmp(what, "Coins")) 		what2 = "Coins";
	else if(!strcmp(what, "Hours")) 		what2 = "Hours";
	else if(!strcmp(what, "Respect")) 		what2 = "Respect";
	else if(!strcmp(what, "Kills")) 		what2 = "Kills";
	else if(!strcmp(what, "SPoints")) 		what2 = "Stunt Points";
	else if(!strcmp(what, "RaceP")) 		what2 = "Race Points";
	else if(!strcmp(what, "DriftP")) 		what2 = "Drift Points";
	else if(!strcmp(what, "KillingSpree")) 	what2 = "Best Killing Spree";
	//--------------------------------------------------------------------------
	format(DialString, sizeof DialString, "{FF9900}Top Players by {FF0000}%s\n", what2);
	for(new Qr; Qr < db_num_rows(Result1); Qr++)
	{
		db_get_field(Result1, 0, String[0], 128);
		format(Query[1], 256, "SELECT `%s` FROM `users` WHERE `Name` = '%s'", stats, String[0]);
		new DBResult:Result2 = db_query(g_dbKeptAlive, Query[1]);
		db_get_field(Result2, 0, String[1], 128);
		//----------------------------------------------------------------------
		if(!strcmp(stats, "Score")) 			format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Score: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "Coins")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Coins: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "SPoints")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Stunt Points: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "Hours")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Hours: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "Kills")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Kills: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "Respect")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Respect: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "RaceP")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Race Points: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "DriftP")) 		format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Drift Points: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		else if(!strcmp(stats, "KillingSpree")) format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {FF0000}%s {AFAFAF}Best Killing Spree: {00BBF6}%s", DialString, Qr+1, String[0], String[1]);
		//----------------------------------------------------------------------
		db_next_row(Result1);
		db_free_result(Result2);
	}
	db_free_result(Result1);
    db_close(g_dbKeptAlive);
	format(DialString, sizeof DialString, "%s\n\n{FF9900}Top list generated in {FF0000}%d{FF9900} ms.", DialString, GetTickCount() - Speed);
	ShowPlayerDialog( playerid, 123, DIALOG_STYLE_MSGBOX, "{00BBF6}Top Players", DialString, "Ok", "");
	return 1;
}
dialogul
switch(listitem)
		    {
		        //--------------------------------------------------------------
  	   			case 0: ShowTop(playerid, "Hours", "Hours");
		        case 1: ShowTop(playerid, "Score", "Score");
		        case 2: ShowTop(playerid, "Coins", "Coins");
		        case 3: ShowTop(playerid, "Kills", "Kills");
			    case 4: ShowTop(playerid, "Respect", "Respect");
			    case 5: ShowTop(playerid, "SPoints", "SPoints");
			    case 6: ShowTop(playerid, "DriftP", "DriftP");
			    case 7: ShowTop(playerid, "RaceP", "RaceP");
			    case 8: ShowTop(playerid, "KillingSpree", "KillingSpree");
			    //--------------------------------------------------------------
			}

problema este ca nu arata pe nimeni , arata topul...dar nu scrie niciun player , nimic . de la ce poate fi:| ?

PS: baza de date este facuta bine dp acest stock :| ieri mergea...azi nu mai merge de loc nu am umblat DE LOC la el. Si mai este ceva...numi merge NICIUN TOP DP SERVER orice gen ar fi el , de player , de gang :| nu functioneaza...

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.