Jump to content

Question

Posted

Salut, vreau sa fac o comanda /lastchat cu care sa pot sa vad ultimele x mesaje ale unui jucator. Am incercat asa dar nu imi afiseaza nimic.

YCMD:lastchat(playerid, params[], help) {
    if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Wait %d seconds.", aspam[playerid]);
    if(PlayerInfo[playerid][pAdmin] < 😎 return SCM(playerid,COLOR_WHITE,AdminOnly);
    new giveplayerid[25],id,cont,name[30];
    if(sscanf(params, "s[25]d", giveplayerid, id)) return SCM(playerid,COLOR_GREY, "Syntax: {FFFFFF}/lastchat <name> <number of messages>");
    cont = MySQLCheckAccount(giveplayerid);
    if(cont == 0) return SCM(playerid,COLOR_ERROR,"Error:{FFFFFF} This account was not found in the database!");
    GetPlayerName(playerid, name, sizeof name);
    //
    new szQuery[256], string[180], MemberString[1024], szResult[180], text[180],TitleString[180];
    format(szQuery, sizeof(szQuery), "SELECT * FROM `logs` WHERE `Name`='%s' ORDER BY `ID` DESC LIMIT %d", GetName(playerid), id);
    new Cache: result = mysql_query(SQL, szQuery);
    for(new i, j = cache_num_rows(); i != j; ++i)
    {
        cache_get_field_content(i, "player", szResult); format(name, 256, szResult);
        cache_get_field_content(i, "Text", szResult);  format(text, 256, szResult);
        format(string, sizeof(string), "%s", text);strcat(MemberString, string, sizeof(MemberString));
    }
    cache_delete(result);
    format(TitleString, sizeof(TitleString), "Last %d messages from player %s.", id, name);
    ShowPlayerDialog(playerid, DIALOG_LASTCHAT, DIALOG_STYLE_TABLIST_HEADERS, TitleString, MemberString, "Ok", "Exit");
    //
    return 1;
}

case DIALOG_LASTCHAT: {
            if(!response) return true;
        }

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.