problem command /BanList
#1

Hello, I have a problem viewing accounts banned in the dialog.. not exactly can not see everything.
is it possible to put "the next list? {Next Button}" ?

if anyone can help me, thank you very much.
I'm sorry I'm not so English

ScreenShot Exemple:
https://imgur.com/a/tHuWnIf


CODE MY SCRIPT:
Код HTML:
CMD:banlist( playerid, params[] )
{
	new strt[226];
	format(strt, sizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0");
	mysql_tquery(SQL, strt, "BanList", "d", playerid);
	return 1;
}

stock BanList( playerid )
{
    new szDialog[MAX_STRING], szDialog2[1024];
	new liRows, liFields, OnName[ MAX_PLAYER_NAME ], OnName2[ MAX_PLAYER_NAME ], BBanDate[200];
	cache_get_data( liRows, liFields );

	strcat(szDialog2, "{FFFF00}ID\t{FFFF00}BanName\t{FFFF00}Admin\t{FFFF00}Ban Date\n");
	for( new i = 0; i < liRows; i ++ )
	{
		cache_get_field_content( i, "PlayerName", OnName );
		cache_get_field_content( i, "AdminName", OnName2 );
		cache_get_field_content( i, "BanTimeDate", BBanDate, 1, 200 );

		format(szDialog, sizeof(szDialog), "%d\t%s\t%s\t%s\n", i + 1, OnName, OnName2, BBanDate);
		strcat(szDialog2, szDialog);
		strmid(UniversalVar[i + 1][vNameBanList], OnName, 0, strlen(OnName), 255);
	}
	ShowPlayerDialog(playerid, DIALOG_BANLISTX, 5, "{6699FF}The List Of Players Banned:", szDialog2, "Select", "Exit");
	return ( 1 );
}



OnDialogResponse

	if(dialogid == DIALOG_BANLISTX)
	{
		if(response)
		{
			if(listitem >= 0)
			{
   				new IdBanList = listitem+1;
				new qstr[256];

			    new cont = MySQLCheckAccount(UniversalVar[IdBanList][vNameBanList]);
			    if(cont == 0) return SCM(playerid,COLOR_WHITE,"{FFB870}Nu exista nici un jucator cu acest nume, banat.");
		        format(qstr,sizeof(qstr),"SELECT * FROM bans WHERE `PlayerName`='%s' AND `Active`='1'", UniversalVar[IdBanList][vNameBanList]);
	    		new Cache: banuri = mysql_query(SQL, qstr);
	    		if(cache_get_row_count() > 0)
	    		{
					new Security1[24];
					new query22[256];
				    mysql_real_escape_string(UniversalVar[IdBanList][vNameBanList], Security1);
				    format(query22, sizeof(query22), "SELECT * FROM `bans` WHERE `PlayerName` = '%s'", Security1);
				    mysql_tquery(SQL, query22, "OnInfoBanCalled", "ds", playerid, UniversalVar[IdBanList][vNameBanList]);
					return 1;
				}
				else
				{
				    SendClientMessage(playerid, COLOR_LIGHTRED, "This player is not banned.");
				}
				cache_delete(banuri);
			}
		}
		return 1;
	}
Reply
#2

MySQL provides LIMIT clause. Have a variable that holds the total number of bans. Then you can use offset and items per page.

pawn Код:
SELECT ... LIMIT 20, 10
it will select 10 items starting from rowid 20. So basically you have a variable that stores page.
pawn Код:
..., "SELECT ... LIMIT %d,%d", page * ITEMS_PER_PAGE, ITEMS_PER_PAGE);
to determinate if there is "Next Page":
pawn Код:
if (page * ITEMS_PER_PAGE > total_bans)
{
    strcat(dialog_string_here, "Next Page");
}
Reply
#3

but here I do not understand how they do exactly.. I tried, but it did not come out

I do not understand how to do this with the next page
Reply
#4

Follow my steps exactly and do an attempt. If it doesn't work, you can then post your code so we can look at it and fix it.
Reply
#5

My Tested Script: https://imgur.com/a/Uu9w3WB

My Script:

PHP код:
#include <a_samp>
#include <sscanf2>
#include <a_mysql>
#include <zcmd>
#define FC%0(%1) forward%0(%1); public%0(%1)
#define SCM SendClientMessage
#define MAX_STRING 2400
#define MAX_RESULTS 5
#define GetPageCount(%0,%1) floatround(%1 / %0, floatround_floor) + 1
enum
{
    
DIALOG_BANLISTX,
    
DIALOG_InfoBan,
    
DIALOG_OK,
    
DIALOG_BAN_LIST
}
new 
SQL = -1,    EroareDeConectare 0;
new 
aswstring[2400];
new 
pLastPage[MAX_PLAYERS];
enum VarInfo
{
    
vName[255],
    
vNameBanList[255]
};
//new UniversalVar[1000][VarInfo];
main()
{
   print(
"New Project");
}
public 
OnGameModeInit()
{
    
mysql_log(LOG_ERROR LOG_WARNINGLOG_TYPE_HTML);
    
SQL mysql_connect("localhost","root","test","");
    if(
mysql_errno(SQL) != 0)
    {
        
EroareDeConectare 0;
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Failed to connect to the database! (Error)   #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Shut up as something went wrong, please check!      #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    else
    {
        
EroareDeConectare 1;
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Connect to the successful database!          #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    
SetGameModeText("NEW Project");
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
EroareDeConectare == 0)
    {
        return 
1;
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_OK: return 1;
        case 
DIALOG_BAN_LIST:
        {
            if(!
response) return 1;
            else if(
response)
            {
                
pLastPage[playerid] ++;
                
ShowBanList(playerid);
            }
        }
    }
    return 
1;
}
FC OnInfoBanCalled(playeridPlayer[])
{
    new 
RowsFieldsDDayDMonthDYearBReason100 ], BAdmin100 ], BBanDate200 ], BBanTime100 ], BBanDays100 ], BID100 ], BIP100 ];
    
cache_get_dataRowsFieldsSQL );
    
cache_get_field_content0"Reason"BReason1100 );// MOTIV
    
cache_get_field_content0"AdminName"BAdmin1100 );// ADN N
    
cache_get_field_content0"BanTimeDate"BBanDate1200 );
    
cache_get_field_content0"Permanent"BBanTime1100 );
    
cache_get_field_content0"Days"BBanDays1100 );
    
cache_get_field_content0"IP"BIP1100 );
    
cache_get_field_content0"ID"BID1100 );
    
sscanf(BBanDate"p<->ddd"DYearDMonthDDay);
    
format(aswstringsizeof(aswstring), "{FF0000}- {FFFFFF}Cu motivul: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}Data Banarii: {FF0000}'{FFFFFF}%d/%d/%d\n{FF0000}- {FFFFFF}Ban permanent (0= NU 1= DA): {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}UnBan dupa: {FF0000}'{FFFFFF}%s{FF0000}' {FFFFFF}zile"BReasonDDayDMonthDYearBBanTimeBBanDays );
    
format(aswstringsizeof(aswstring), "{FF0000}'{FFFFFF} Detalii jucator Banat: {FF0000}'{FF0000}%s{FF0000}'\n\n{FF0000}- {FFFFFF}ID Ban: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}IP jucator Banat: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}De catre Adminul: {FF0000}'{FFFFFF}%s{FF0000}'\n%s"PlayerBIDBIPBAdminaswstring );
    
ShowPlayerDialog(playeridDIALOG_InfoBanDIALOG_STYLE_MSGBOX"{FFFFFF}IBan Sistem:"aswstring"OK""");
    return ( 
);
}
CMD:banlist(playeridparams[])
{
    new 
strt[226];
    
format(strtsizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0");
    
mysql_tquery(SQLstrt"ShowBanList""");
    
pLastPage[playerid] = 1;
    return 
1;
}
FC ShowBanList(playerid)
{
    new 
OnNameMAX_PLAYER_NAME ], OnName2MAX_PLAYER_NAME ], BBanDate[200];
    new 
IDD cache_num_rows();
    new 
title[128], string[300], pages GetPageCount(MAX_RESULTSIDD) ,resultcount = ((MAX_RESULTS pLastPage[playerid]) - MAX_RESULTS), bool:nextpage false;
    
strcat(string"ID\tName\tAName\tDate");
    new 
sdg[226];
    
format(sdgsizeof(sdg), "%d | %d"pagesIDD);
    
SCM(playerid, -1sdg);
    for(new 
resultcountIDD++)
    {
        
resultcount ++;
        
cache_get_field_contenti"PlayerName"OnName );
        
cache_get_field_contenti"AdminName"OnName2 );
        
cache_get_field_contenti"BanTimeDate"BBanDate1200 );
        if(
resultcount <= MAX_RESULTS pLastPage[playerid])
        {
            
format(stringsizeof(string), "%s\n%d\t%s\t%s\t%s"stringresultcountOnNameOnName2BBanDate);
//            SCM(playerid, -1, string);
        
}
        if(
resultcount MAX_RESULTS pLastPage[playerid])
        {
            
nextpage true;
            break;
        }
    }
    
format(titlesizeof(title), "{FFFF00}Bans - Page %d of %d"pLastPage[playerid], pages);
    if(
nextpage) return ShowPlayerDialog(playeridDIALOG_BAN_LISTDIALOG_STYLE_TABLIST_HEADERStitlestring"Next""Close");
    return 
ShowPlayerDialog(playeridDIALOG_OKDIALOG_STYLE_TABLIST_HEADERStitlestring"Select""Cancel");
}
public 
OnQueryErrorerroriderror[ ], callback[ ], query[ ], connectionHandle )
{
    print( 
"====================================================================" );
    
printf"Error ID: %d, Error: %s"erroriderror );
    
printf"Callback: %s"callback );
    
printf"gQuery: %s"query );
    print( 
"====================================================================" );
    return 
1;

Reply
#6

When server starts, count total bans to store.
pawn Код:
new gTotalBans;

//OnGameModeInit
mysql_tquery(SQL, "SELECT COUNT(*) FROM bans;", "OnTotalBansNumberLoad", "");

forward OnTotalBansNumberLoad();
public OnTotalBansNumberLoad()
{
    gTotalBans = cache_get_row_int(0, 0, SQL);
}
Now the page part. For testing purposes, set MAX_RESULTS to 3:
pawn Код:
#define MAX_RESULTS 3

...

//command /banlist:
format(strt, sizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0 LIMIT 0,%d", MAX_RESULTS);
mysql_tquery(SQL, strt, "ShowBanList", "d", playerid);
pawn Код:
//OnPlayerConnect:
pLastPage[playerid] = 0;
pawn Код:
//ShowBanList:
pLastPage[playerid] = 1; //set first page at top

new OnName[ MAX_PLAYER_NAME ], OnName2[ MAX_PLAYER_NAME ], BBanDate[200];
new title[128], string[300];

string = "ID\tName\tAName\tDate";

for(new i = 0, j = cache_num_rows(); i < j; i ++)
{
    cache_get_field_content( i, "PlayerName", OnName );
    cache_get_field_content( i, "AdminName", OnName2 );
    cache_get_field_content( i, "BanTimeDate", BBanDate, 1, 200 );

    format(string, sizeof(string), "%s\n%d\t%s\t%s\t%s", string, i + 1, OnName, OnName2, BBanDate);
}

if (gTotalBans > pLastPage[playerid] * MAX_RESULTS) //Total bans 5 > 3 (page 1 * 3 items per page) so last option is "Next Page"
{
    strcat(string, "Next Page");
}

format(title, sizeof(title), "{FFFF00}Bans - Page %d of %d", pLastPage[playerid], floatround(float(gTotalBans) / float(MAX_RESULTS), floatround_ceil));
There are total of 5 bans, it shows 3 and the last item (4th) is "Next Page". In OnDialogResponse, you can do:
pawn Код:
if (response)
{
    if (MAX_RESULTS + 1 == listitem)
    {
        // player selected "Next Page");

        new strt[226];
        format(strt, sizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0 LIMIT %d,%d", pLastPage[playerid] * MAX_RESULTS, MAX_RESULTS);
        mysql_tquery(SQL, strt, "ShowBanList", "d", playerid);

        pLastPage[playerid]++;
    }
}
else pLastPage[playerid] = 0;
But this method needs to increase gTotalBans every time a player is banned.
Reply
#7

Not working..

ScreenShot: https://imgur.com/a/9hcqr65

Script:

PHP код:
#include <a_samp>
#include <sscanf2>
#include <a_mysql>
#include <zcmd>
#define FC%0(%1) forward%0(%1); public%0(%1)
#define SCM SendClientMessage
#define MAX_STRING 2400
#define MAX_RESULTS 3
new gTotalBans;
new 
pLastPage[MAX_PLAYERS];
enum
{
    
DIALOG_BAN_LIST2
}
new 
SQL = -1;
main()
{
   print(
"New Project");
}
public 
OnGameModeInit()
{
    
mysql_log(LOG_ERROR LOG_WARNINGLOG_TYPE_HTML);
    
SQL mysql_connect("localhost","root","test","");
    if(
mysql_errno(SQL) != 0)
    {
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Failed to connect to the database! (Error)   #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Shut up as something went wrong, please check!      #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    else
    {
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Connect to the successful database!          #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    
SetGameModeText("NEW Project");
    
mysql_tquery(SQL"SELECT COUNT(*) FROM bans;""OnTotalBansNumberLoad""");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_BAN_LIST2:
        {
            if (
response)
            {
                if (
MAX_RESULTS == listitem)
                {
                    
// player selected "Next Page");
                    
new strt[226];
                    
format(strtsizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0 LIMIT %d,%d"pLastPage[playerid] * MAX_RESULTSMAX_RESULTS);
                    
mysql_tquery(SQLstrt"ShowBanList2""d"playerid);
                    
pLastPage[playerid]++;
                }
            }
            else 
pLastPage[playerid] = 0;
        }
    }
    return 
1;
}
FC OnTotalBansNumberLoad()
{
    
gTotalBans cache_get_row_int(00SQL);
}
CMD:banlist2(playeridparams[])
{
    new 
strt[126];
    
pLastPage[playerid] = 0;
    
format(strtsizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0 LIMIT 0,%d"MAX_RESULTS);
    
mysql_tquery(SQLstrt"ShowBanList2""d"playerid);
    return 
1;
}
FC ShowBanList2(playerid)
{
    
pLastPage[playerid] = 1//set first page at top
    
new OnNameMAX_PLAYER_NAME ], OnName2MAX_PLAYER_NAME ], BBanDate[200];
    new 
title[128], string[300];
    
string "ID\tName\tAName\tDate";
    for(new 
0cache_num_rows(); j++)
    {
        
cache_get_field_contenti"PlayerName"OnName );
        
cache_get_field_contenti"AdminName"OnName2 );
        
cache_get_field_contenti"BanTimeDate"BBanDate1200 );
        
format(stringsizeof(string), "%s\n%d\t%s\t%s\t%s\n"string1OnNameOnName2BBanDate);
    }
    if (
gTotalBans pLastPage[playerid] * MAX_RESULTS//Total bans 5 > 3 (page 1 * 3 items per page) so last option is "Next Page"
    
{
        
strcat(string"Next Page");
    }
    
format(titlesizeof(title), "{FFFF00}Bans - Page %d of %d"pLastPage[playerid], floatround(float(gTotalBans) / float(MAX_RESULTS), floatround_ceil));
    
ShowPlayerDialog(playeridDIALOG_BAN_LIST2DIALOG_STYLE_TABLIST_HEADERStitlestring"OK""Close");
    return 
1;
}
public 
OnQueryErrorerroriderror[ ], callback[ ], query[ ], connectionHandle )
{
    print( 
"====================================================================" );
    
printf"Error ID: %d, Error: %s"erroriderror );
    
printf"Callback: %s"callback );
    
printf"gQuery: %s"query );
    print( 
"====================================================================" );
    return 
1;

Reply
#8

The code I provided was for the "Next Page" in dialog. When you select last item which is "Next Page" should show the next results. If what you want is selecting any ban record to do something, your script is empty.
Reply
#9

Here is the script with all the functions but on several banned accounts it does not show everything
And how can I do it next page?
or if someone helps me I am grateful
I also give money only to solve the problem

My default code "No next page":

PHP код:
#include <a_samp>
#include <sscanf2>
#include <a_mysql>
#include <zcmd>
#define FC%0(%1) forward%0(%1); public%0(%1)
#define SCM SendClientMessage
#define MAX_STRING 2400
#define GetPageCount(%0,%1) floatround(%1 / %0, floatround_floor) + 1
enum
{
    
DIALOG_BANLISTX,
    
DIALOG_InfoBan
}
new 
aswstring[2400];
new 
SQL = -1,    EroareDeConectare 0;
enum VarInfo
{
    
vName[255],
    
vNameBanList[255]
};
new 
UniversalVar[1000][VarInfo];
main()
{
   print(
"New Project");
}
public 
OnGameModeInit()
{
    
mysql_log(LOG_ERROR LOG_WARNINGLOG_TYPE_HTML);
    
SQL mysql_connect("localhost","root","test","");
    if(
mysql_errno(SQL) != 0)
    {
        
EroareDeConectare 0;
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Failed to connect to the database! (Error)   #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Shut up as something went wrong, please check!      #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    else
    {
        
EroareDeConectare 1;
        print( 
" ");
        print( 
" ");
        print( 
" ");
        print( 
"          #########################################################" );
        print( 
"          #                                                       #" );
        print( 
"          #            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _          #" );
        print( 
"          #           _I_N_F_O_ _S_E_R_V_E_R_ _L_O_A_D_S_         #" );
        print( 
"          #                                                       #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   MySQL: Connect to the successful database!          #");
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #   Thank you for using Script Gold.                    #" );
        print( 
"          #  __________________________________________________   #" );
        print( 
"          #                                                       #" );
        print( 
"          #########################################################" );
        print( 
" ");
        print( 
" ");
    }
    
SetGameModeText("NEW Project");
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
EroareDeConectare == 0)
    {
        return 
1;
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_BANLISTX)
    {
        if(
response)
        {
            if(
listitem >= 0)
            {
                   new 
IdBanList listitem+1;
                new 
qstr[256];
                
format(qstr,sizeof(qstr),"SELECT * FROM bans WHERE `PlayerName`='%s' AND `Active`='1'"UniversalVar[IdBanList][vNameBanList]);
                new 
Cachebanuri mysql_query(SQLqstr);
                if(
cache_get_row_count() > 0)
                {
                    new 
Security1[24];
                    new 
query22[256];
                    
mysql_real_escape_string(UniversalVar[IdBanList][vNameBanList], Security1);
                    
format(query22sizeof(query22), "SELECT * FROM `bans` WHERE `PlayerName` = '%s'"Security1);
                    
mysql_tquery(SQLquery22"OnInfoBanCalled""ds"playeridUniversalVar[IdBanList][vNameBanList]);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playerid, -1"This player is not banned.");
                }
                
cache_delete(banuri);
            }
        }
        return 
1;
    }
    return 
1;
}
CMD:banlistplayeridparams[] )
{
    new 
strt[226];
    
format(strtsizeof(strt), "SELECT * FROM `bans` WHERE `ID` > 0");
    
mysql_tquery(SQLstrt"BanList""d"playerid);
    return 
1;
}
FC BanListplayerid )
{
    new 
szDialog[MAX_STRING], szDialog2[1024];
    new 
liRowsliFieldsOnNameMAX_PLAYER_NAME ], OnName2MAX_PLAYER_NAME ], BBanDate[200];
    
cache_get_dataliRowsliFields );
    
strcat(szDialog2"{FFFF00}ID\t{FFFF00}BanName\t{FFFF00}Admin\t{FFFF00}Ban Date\n");
    for( new 
0liRows++ )
    {
        
cache_get_field_contenti"PlayerName"OnName );
        
cache_get_field_contenti"AdminName"OnName2 );
        
cache_get_field_contenti"BanTimeDate"BBanDate1200 );
        
format(szDialogsizeof(szDialog), "%d\t%s\t%s\t%s\n"1OnNameOnName2BBanDate);
        
strcat(szDialog2szDialog);
        
strmid(UniversalVar[1][vNameBanList], OnName0strlen(OnName), 255);
    }
    
ShowPlayerDialog(playeridDIALOG_BANLISTX5"{6699FF}The List Of Players Banned:"szDialog2"Select""Exit");
    return ( 
);
}
FC OnInfoBanCalled(playeridPlayer[])
{
    new 
RowsFieldsDDayDMonthDYearBReason100 ], BAdmin100 ], BBanDate200 ], BBanTime100 ], BBanDays100 ], BID100 ], BIP100 ];
    
cache_get_dataRowsFieldsSQL );
//    if( !Rows )
//        return Eroare( playerid, "Nu exista nici un jucator cu acest nume, banat." );
    
cache_get_field_content0"Reason"BReason1100 );// MOTIV
    
cache_get_field_content0"AdminName"BAdmin1100 );// ADN N
    
cache_get_field_content0"BanTimeDate"BBanDate1200 );
    
cache_get_field_content0"Permanent"BBanTime1100 );
    
cache_get_field_content0"Days"BBanDays1100 );
    
cache_get_field_content0"IP"BIP1100 );
    
cache_get_field_content0"ID"BID1100 );
    
sscanf(BBanDate"p<->ddd"DYearDMonthDDay);
    
format(aswstringsizeof(aswstring), "{FF0000}- {FFFFFF}Cu motivul: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}Data Banarii: {FF0000}'{FFFFFF}%d/%d/%d\n{FF0000}- {FFFFFF}Ban permanent (0= NU 1= DA): {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}UnBan dupa: {FF0000}'{FFFFFF}%s{FF0000}' {FFFFFF}zile"BReasonDDayDMonthDYearBBanTimeBBanDays );
    
format(aswstringsizeof(aswstring), "{FF0000}'{FFFFFF} Detalii jucator Banat: {FF0000}'{FF0000}%s{FF0000}'\n\n{FF0000}- {FFFFFF}ID Ban: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}IP jucator Banat: {FF0000}'{FFFFFF}%s{FF0000}'\n{FF0000}- {FFFFFF}De catre Adminul: {FF0000}'{FFFFFF}%s{FF0000}'\n%s"PlayerBIDBIPBAdminaswstring );
    
ShowPlayerDialog(playeridDIALOG_InfoBanDIALOG_STYLE_MSGBOX"{FFFFFF}IBan Sistem:"aswstring"OK""");
    return ( 
);
}
public 
OnQueryErrorerroriderror[ ], callback[ ], query[ ], connectionHandle )
{
    print( 
"====================================================================" );
    
printf"Error ID: %d, Error: %s"erroriderror );
    
printf"Callback: %s"callback );
    
printf"gQuery: %s"query );
    print( 
"====================================================================" );
    return 
1;

MySql Accounts Banned:

PHP код:
CREATE TABLE IF NOT EXISTS `bans` (
  `
IDint(11NOT NULL AUTO_INCREMENT,
  `
PlayerNamevarchar(30NOT NULL,
  `
AdminNamevarchar(30NOT NULL,
  `
Reasonvarchar(128NOT NULL,
  `
IPvarchar(16NOT NULL,
  `
Daysint(11NOT NULL,
  `
IPBanint(11NOT NULL,
  `
Permanentint(11NOT NULL,
  `
Timeint(15NOT NULL,
  `
BanTimeDatetimestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `
Activeint(11NOT NULL,
  
PRIMARY KEY (`ID`)
ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=30 ;
INSERT INTO `bans` (`ID`, `PlayerName`, `AdminName`, `Reason`, `IP`, `Days`, `IPBan`, `Permanent`, `Time`, `BanTimeDate`, `Active`) VALUES
(23'EnErGizanT''RaDuCu''test''109.98.164.144'0110'2018-07-08 13:57:03'1),
(
24'NULL''RaDuCu''very good''109.98.95.74'0110'2018-07-08 14:04:11'0),
(
25'TheKing@''D3liryk..''hi''5.13.188.173'0010'2018-07-11 19:22:33'1),
(
26'lider''Florinel_Gaming''hack (flyhack)''89.136.253.172'0110'2018-07-11 19:37:52'1),
(
27'raducu''D3liryk..''hello''0'0010'2018-07-11 21:20:08'0),
(
28'rebeca22''RaDuCu''test bass''0'0010'2018-07-12 18:59:45'1),
(
29'rebeca223''RaDuCu2''the best''0'0010'2018-07-12 18:59:45'1),
(
30'rebeca223''RaDuCu2''test 5''0'0010'2018-07-12 18:59:45'1),
(
31'Alex12345''RaDuCu''ok''62.121.69.232'0110'2018-07-13 10:04:57'1); 
Reply
#10

I've resolved with the next page: https://imgur.com/a/h4DY4CV

but how do I select an item in the dialog?
when I choose something gives me the next page ..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)