Jump to content
  • 0

PHPMyAdmin


Go to solution Solved by TheGodfather,

Question

Salut, vrea ca prin o comanda sa pot lua numele si valoarea de tip int din campul Blacklist din baza de date a tuturor playerilor care au valoarea din Blacklist > 0. Asa am facut pana acum si imi da valoarea doar la o persoana.

YCMD:blacklistplayers(playerid, params[], help) {
    if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Asteapta %d secunde.", aspam[playerid]);
    if(PlayerInfo[playerid][pScripter] < 1) return SCM(playerid, COLOR_GREY, "Nu ai dreptul de a utiliza aceasta comanda.");
    ShowPlayerDialog(playerid, DIALOG_BLACKLISTT, DIALOG_STYLE_LIST, "Blacklist players (verificare admin)", "Admins", "Ok", "Close");
    return 1;
}

case DIALOG_BLACKLISTT: {
            if(!response) return true;
            new szQuery[256], szResult[256], szDialog2[256], Cache: result, szName[180], szAdmin, szDialog[128], szTitle[128];
            format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Blacklist`>'0' ORDER BY `users`.`Blacklist` ASC LIMIT 50");
            result = mysql_query(SQL, szQuery);            
            strcat(szDialog2, "Name\tBlacklist value\n");
            for(new i, j = cache_num_rows(); i < j; i++)
            {
                cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                cache_get_field_content(i, "Blacklist", szResult); szAdmin = strval(szResult);        
            }
            format(szDialog, sizeof(szDialog), "%s %d\n", szName, szAdmin);
            strcat(szDialog2, szDialog);
            format(szTitle, sizeof(szTitle), "Admins");
            ShowPlayerDialog(playerid, DIALOG_BLACKLISTT+2, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Back");
            cache_delete(result);
        }

case DIALOG_BLACKLISTT+2: {
            if(!response) return ShowPlayerDialog(playerid, DIALOG_BLACKLISTT, DIALOG_STYLE_LIST, "Admins", "Admins", "Ok", "Close");
        }

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Solution
Acum 7 minute, Banditul a spus:

format(szDialog, sizeof(szDialog), "%s%s %d\n", szDialog, szName, szAdmin);

Il pui in loop unde preiei numele/blacklist, si nu il pui si dupa. Pentru ce ai facut tu iti va arata doar ultima valoare care ti-o returneaza in loop.

Merge, multumesc frumos.

Link to post
Share on other sites
  • 0

format(szDialog, sizeof(szDialog), "%s%s %d\n", szDialog, szName, szAdmin);

Il pui in loop unde preiei numele/blacklist, si nu il pui si dupa. Pentru ce ai facut tu iti va arata doar ultima valoare care ti-o returneaza in loop.

Link to post
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
Answer this question...

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

  • Recently Browsing   0 members

    No registered users viewing this page.

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