Stats in dialog help
#1

Hi Everyone,

I tried to make a /stats command in dialog. I type /stats ingame and I see the dialog but I dont see the stats I see weird icons and its bugging like hell, whats wrong with it?

This is the /stats command in pawn.

Almost ty

pawn Code:
CMD:stats(playerid, params[])
{
    new coordsstring[128], statsstring[1024];
    new id;
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    id = playerid;
    new h, m, s,
        admin = PlayerAcc[id][Admin],
        warn = PlayerAcc[id][Warn],
        skin = PlayerAcc[id][SaveSkin],
        score = GetPlayerScore(id),
        money = GetPlayerMoney(id),
        kill = PlayerAcc[id][Kills],
        death = PlayerAcc[id][Deaths];
    TotalGameTime(id, h, m, s);
    switch(admin)
    {
        case 3: AdminRank = "Tester";
        case 4: AdminRank = "CO Moderator";
        case 5: AdminRank = "Moderator";
        case 6: AdminRank = "CO Administrator";
        case 7: AdminRank = "Administrator";
        case 8: AdminRank = "Head Admin";
        case 9: AdminRank = "Manager";
        case 10: AdminRank = "Owner";
    }
    format(coordsstring, sizeof(coordsstring),"* Admin: [%i - %s]", AdminRank, admin, Admin2);
    strcat(statsstring,coordsstring);
    format(coordsstring, sizeof(coordsstring),"\n* Warning: [%i/%i] | Score: [%i] Money: [$%i] | Kills: [%d] | Deaths: [%d]", warn, MAX_WARNINGS, score, money, kill, death);
    strcat(statsstring,coordsstring);
    format(coordsstring, sizeof(coordsstring),"\n* SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] Hours: [%i] | Minutes: [%i] | Seconds: [%i]", skin, Float:kill/Float:death, h, m, s);
    strcat(statsstring,coordsstring);
    //--
    ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Ok", "");
    //
    return 1;
}
Reply
#2

pawn Code:
CMD:stats(playerid, params[])
{
    if(!PlayerAcc[playerid][Log]) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    new coordsstring[290], statsstring[144], h, m, s, admin = PlayerAcc[playerid][Admin],
    warn = PlayerAcc[playerid][Warn], skin = PlayerAcc[playerid][SaveSkin],
    score = GetPlayerScore(playerid), money = GetPlayerMoney(playerid), arank[18],
    kill = PlayerAcc[playerid][Kills], death = PlayerAcc[playerid][Deaths];
    TotalGameTime(playerid, h, m, s);
    switch(admin)
    {
        case 3: arank = "Tester";
        case 4: arank = "CO Moderator";
        case 5: arank = "Moderator";
        case 6: arank = "CO Administrator";
        case 7: arank = "Administrator";
        case 8: arank = "Head Admin";
        case 9: arank = "Manager";
        case 10: arank = "Owner";
        default: arank = "Unknown";
    }
    format(statsstring, sizeof(statsstring), "* Admin: [%i - %s]\n* Warning: [%i/%i] | Score: [%i] | Money: [$%i] | Kills: [%d] | Deaths: [%d]", admin, arank, warn, MAX_WARNINGS, score, money, kill, death);
    format(coordsstring, sizeof(coordsstring), "\n* SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] | Hours: [%i] | Minutes: [%i] | Seconds: [%i]", skin, (kill / death), MAX_WARNINGS, /*Location*/, h, m, s);
    strcat(statsstring, coordsstring);
    ShowPlayerDialog(playerid, 5234, DIALOG_STYLE_MSGBOX, "Your stats:", statsstring, "Ok", "");
    return 1;
}
You were just formatting things that weren't even there. Like you had 'AdminRank, admin, Admin2' when there was only 2 specifiers. %i and %s.

Also, you are missing a 'location' parameter in this string:
pawn Code:
\n* SaveSkin: [%i] | Ratio: [%0.2f] | Location: [%s] Hours: [%i] | Minutes: [%i] | Seconds: [%i]
There is nothing giving a value to 'Location: %s'.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)