Gaining data from database
#6

I've managed to get the code working after your tips, thanks. But how in the hell am I going to put this in ondialogresponse so it'll change THAT person. and not someone else.

pawn Код:
COMMAND:banlist(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 2) {
        new banQuery[500], finalString[600], rows;
        format(banQuery,sizeof(banQuery),"SELECT * FROM bans WHERE HasExpired ='0'");
        mysql_query(banQuery);
        mysql_store_result();
        rows = mysql_num_rows();
        if(!rows)
        {
            ShowPlayerDialog(playerid, DIALOG_NO_BANS, DIALOG_STYLE_MSGBOX,"{ff6600}No bans","Unfortunatly there weren't any bans in the database","Ok","Cancel");
        }
        else {
            new tmp[MAX_PLAYER_NAME];
            for (new i = 0; i < rows; ++i)
            {
                while(mysql_fetch_row_format(banQuery, "|"))
                {
                    mysql_fetch_field_row(tmp, "BannedPlayer");
                    strcat(finalString,tmp);
                    strcat(finalString,"\n");
                }
            }
            strcat(finalString, tmp);
            ShowPlayerDialog(playerid,DIALOG_BANLIST,DIALOG_STYLE_LIST, "{ff6600}Banlist", finalString,"Change","Cancel");
        }
        mysql_free_result();

    }  
    else {
    return 0;
    }
    return 1;
}
Reply


Messages In This Thread
Gaining data from database[MySQL] - by SomebodyAndMe - 07.04.2013, 10:41
Re: Gaining data from database - by iJumbo - 07.04.2013, 11:08
Re: Gaining data from database - by SomebodyAndMe - 07.04.2013, 11:10
Re: Gaining data from database - by SomebodyAndMe - 07.04.2013, 18:03
Re: Gaining data from database - by ReVo_ - 07.04.2013, 18:55
Re: Gaining data from database - by SomebodyAndMe - 08.04.2013, 16:24
Re: Gaining data from database - by ReVo_ - 08.04.2013, 17:49
Re: Gaining data from database - by SomebodyAndMe - 09.04.2013, 16:18
Re: Gaining data from database - by RicaNiel - 09.04.2013, 16:21
Re: Gaining data from database - by M3mPHi$_S3 - 09.04.2013, 16:25

Forum Jump:


Users browsing this thread: 1 Guest(s)