[FilterScript] [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons)
#7

PHP код:
new PageList[MAX_PLAYERS];
enum {
    
DIALOG_TEST
};
public 
OnPlayerConnect(playerid) {
    
PageList[playerid] = 0;
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {
    switch(
dialogid) {
        case 
DIALOG_TEST: {
            if(!
response) {
                
PageList[playerid]--;
                if(
PageList[playerid] < 0) {
                    
PageList[playerid] = 0;
                    
// Show the first page again or do whatever you want.
                    
return 1;
                }
            }
            else 
PageList[playerid]++;
            
format(Querysizeof(Query), "SELECT `ip`, `time`, `loggedin` FROM `ips` WHERE `username` = '%s' ORDER BY datetime(unix) DESC LIMIT %i, 10"TARGET_NAMEListPage[playerid] * 10);
            
// We're using x10 because you're showing only 10 rows per page. As you can see above we made it to increase the ListPage[playerid] variable + 1 whenever
            // the player click button 1 (which in your case, Next button). 1 x 10 = 10, 2 x 10 = 20 and so on.
            
Result db_query(DatabaseQuery);
            
// Make sure to reset the ListPage[playerid] to 0 when there are no rows found and before showing the dialog in your command.
            // ListPage[playerid] = 0;
        
}
    }
    return 
0;

This is just an example, didn't test it but it should work, if not inform me.
By the way, your code indentation is so horrible. There are many things you need to optimize.
Reply


Messages In This Thread
[SQLite] Advanced IP Logger V.2 (dialogs + unlimited IP saving for users) - by OverflowJ - 17.09.2017, 12:27
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by Modather - 18.09.2017, 22:28
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by oMa37 - 19.09.2017, 04:35
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by DonaldDuck - 19.09.2017, 05:19
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by iLearner - 19.09.2017, 05:34
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by OverflowJ - 19.09.2017, 12:45
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by oMa37 - 19.09.2017, 13:09
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by OverflowJ - 19.09.2017, 13:12
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by oi2871999 - 19.09.2017, 13:12
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by OverflowJ - 19.09.2017, 15:03
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by Chaprnks - 20.09.2017, 00:59
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by OverflowJ - 20.09.2017, 15:22
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by GameOvr - 06.10.2018, 01:36
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by GameOvr - 07.10.2018, 18:39
Re: [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) - by TheToretto - 28.10.2018, 19:16

Forum Jump:


Users browsing this thread: 3 Guest(s)