Jump to content

Reglare comanda /Bans


Recommended Posts

Problema intalnita (descriere): Am incercat sa fac o comanda care are functia de a arata playerii ban-ati pi server, dar, am niste probleme. Dupa cum vedeti, as dori sa-i arate doar pe cei care sunt banati, adica "1", dar mi-i arata pe primii 20 de playeri.

Ero(area / rile) / warning-(ul / urile): Nu am.

Imagini / Video (optional): untitled222.jpg

Liniile de cod / sursa / script-ul(obligatoriu):

CMD:bans(playerid, params[])
{
	BanList(playerid, "Banned", "Banned");
	return 1;
}
stock BanList(playerid, stats[], what[], limit = MAX_TOP_LIMIT)
{
	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
	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, "Banned")) 				what2 = "Banned";
	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
	format(DialString, sizeof DialString, "{00FF00}Players {0066CC}%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, "Banned")) format(DialString, sizeof DialString,
		"%s\n{AFAFAF}%d. {0066CC}%s {00FF00}Is Banned: {0066CC}%s", DialString, Qr+1, String[0], String[1]/*FormatNumber(strval(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{00FF00}Lista banurilor generata in {0066CC}%d{00FF00} ms.", DialString, GetTickCount() - Speed);
	ShowPlayerDialog( playerid, 123, DIALOG_STYLE_MSGBOX, "{00FF00}F{0066CC}S{AFAFAF} - Banned Players", DialString, "Ok", "");
	return 1;
}

Ati incercat sa rezolvati singur?: Da, dar nu-i dau de capat. nu pre stiu SQL..

Va rog frumos sa ma ajutati, va rog din tot sufletul! va multumesc anticipat pentru atentia acordata

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.