problem command /BanList
#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


Messages In This Thread
problem command /BanList - by rollercaster - 17.07.2018, 16:56
Re: problem command /BanList - by Calisthenics - 17.07.2018, 17:48
Re: problem command /BanList - by rollercaster - 17.07.2018, 18:04
Re: problem command /BanList - by Calisthenics - 17.07.2018, 21:57
Re: problem command /BanList - by rollercaster - 18.07.2018, 05:02
Re: problem command /BanList - by Calisthenics - 18.07.2018, 08:20
Re: problem command /BanList - by rollercaster - 18.07.2018, 15:11
Re: problem command /BanList - by Calisthenics - 18.07.2018, 16:34
Re: problem command /BanList - by rollercaster - 18.07.2018, 18:33
Re: problem command /BanList - by rollercaster - 19.07.2018, 12:10

Forum Jump:


Users browsing this thread: 1 Guest(s)