-> /stats doesn't shows up <-
#1

pawn Код:
CMD:stats( playerid, params[] )
{
    new stts[ 5000 ], pName[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, pName, sizeof( pName ));

//  strcat( stats, "\t{FFFFFF}[ {FFAE00}%s {FFFFFF}Statistics: ]\n\n", pName                                  );
    format( stts, sizeof( stts ), "{FFFFFF}Admin Level: {FFAE00}%s\n", P_DATA[ playerid ][ Admin ]            );
    format( stts, sizeof( stts ), "{FFFFFF}V.I.P Level: {FFAE00}%s\n", P_DATA[ playerid ][ Vip ]              );
    format( stts, sizeof( stts ), "{FFFFFF}Score:       {FFAE00}%s\n", P_DATA[ playerid ][ Score ]            );
    format( stts, sizeof( stts ), "{FFFFFF}Cash:        {FFAE00}%s\n", P_DATA[ playerid ][ Cash ]             );
    format( stts, sizeof( stts ), "{FFFFFF}Coins:       {FFAE00}%s\n", P_DATA[ playerid ][ Coins ]            );
    format( stts, sizeof( stts ), "{FFFFFF}Reputation:  {FFAE00}%s\n", P_DATA[ playerid ][ Reputation ]       );
    format( stts, sizeof( stts ), "{FFFFFF}Kills:       {FFAE00}%s\n", P_DATA[ playerid ][ Kills ]            );
    format( stts, sizeof( stts ), "{FFFFFF}Deaths:      {FFAE00}%s\n", P_DATA[ playerid ][ Deaths ]           );
    SPD( playerid, statistics, MSGBOX, "{FFAE00}P{FFFFFF}layer {FFAE00}S{FFFFFF}tats",  stts, "Ok", ""        );
    return ( 1 );
}
I type /stats and doesn't happens anything, can anyone help me fix it ?
Reply
#2

Just a format? Where is the send msg?
Reply
#3

Show the "SPD" function. Also, try adding some prints to see where it stops working.
Reply
#4

pawn Код:
CMD:stats( playerid, params[] )
{
    new stts[ 1024 ], pName[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, pName, sizeof(pName));

//  strcat( stats, "\t{FFFFFF}[ {FFAE00}%s {FFFFFF}Statistics: ]\n\n", pName);
     format( stts, sizeof( stts ), "{FFFFFF}Admin Level: {FFAE00}%s\n", stts, P_DATA[ playerid ][ Admin ]      );
    format( stts, sizeof( stts ), "%s{FFFFFF}V.I.P Level: {FFAE00}%s\n", stts, P_DATA[ playerid ][ Vip ]          );
    format( stts, sizeof( stts ), "%s{FFFFFF}Score:       {FFAE00}%s\n", stts, P_DATA[ playerid ][ Score ]    );
    format( stts, sizeof( stts ), "%s{FFFFFF}Cash:        {FFAE00}%s\n", stts,P_DATA[ playerid ][ Cash ]          );
    format( stts, sizeof( stts ), "%s{FFFFFF}Coins:       {FFAE00}%s\n", stts, P_DATA[ playerid ][ Coins ]         );
    format( stts, sizeof( stts ), "%s{FFFFFF}Reputation:  {FFAE00}%s\n", stts, P_DATA[ playerid ][ Reputation ]     );
    format( stts, sizeof( stts ), "%s{FFFFFF}Kills:       {FFAE00}%s\n", stts,P_DATA[ playerid ][ Kills ]      );
    format( stts, sizeof( stts ), "%s{FFFFFF}Deaths:      {FFAE00}%s\n", stts,P_DATA[ playerid ][ Deaths ]     );
    SPD( playerid, statistics, DIALOG_STYLE_MSGBOX, "{FFAE00}P{FFFFFF}layer {FFAE00}S{FFFFFF}tats",  stts, "Ok", "");
Reply
#5

I assume SPD is a function that sends a DialogBox. Based on your code, stts will always be
Код:
format( stts, sizeof( stts ), "{FFFFFF}Deaths:      {FFAE00}%s\n", P_DATA[ playerid ][ Deaths ]           );
you need to concatenate stts before formating the next line.
so it will be like this:
Код:
format( stts, sizeof( stts ), "%s{FFFFFF}V.I.P Level: {FFAE00}%s\n", stts, P_DATA[ playerid ][ Vip ]              );
format( stts, sizeof( stts ), "%s{FFFFFF}Score:       {FFAE00}%s\n", stts, P_DATA[ playerid ][ Score ]           );
etc..
Reply
#6

Why has the variable stts the amount 5000 ? There is a limit, lol.
See this. https://sampwiki.blast.hk/wiki/Limits
pawn Код:
CMD:stats( playerid, params[] )
{
    new stts[300], pName[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, pName, sizeof( pName ));

    // strcat( stats, "\t{FFFFFF}[ {FFAE00}%s {FFFFFF}Statistics: ]\n\n", pName                             );
    format( stts, sizeof( stts ), "{FFFFFF}Admin Level: {FFAE00}%s\n{FFFFFF}V.I.P Level: {FFAE00}%s\n{FFFFFF}Score:       {FFAE00}%s\n{FFFFFF}Cash:        {FFAE00}%s\n{FFFFFF}Coins:       {FFAE00}%s\n{FFFFFF}Reputation:  {FFAE00}%s\n{FFFFFF}Kills:       {FFAE00}%s\n{FFFFFF}Deaths:      {FFAE00}%s", P_DATA[ playerid ][ Admin ], P_DATA[ playerid ][ Vip ], P_DATA[ playerid ][ Score ], P_DATA[ playerid ][ Cash ], P_DATA[ playerid ][ Coins ], P_DATA[ playerid ][ Reputation ], P_DATA[ playerid ][ Kills ], P_DATA[ playerid ][ Deaths ]);
    SPD(playerid, statistics, MSGBOX, "{FFAE00}P{FFFFFF}layer {FFAE00}S{FFFFFF}tats",  stts, "Ok", "");
    return ( 1 );
}
Reply
#7

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
Why has the variable stts the amount 5000 ? There is a limit, lol.
wut limit r u talking about.
Reply
#8

The limit is 1024. Don't use so much high string size because it's waste of memory. 512 would be fine.
However, you used format at the first post and it will send only the last formatted message.
I'm assuming that SPD is a define of ShowPlayerDialog, so nothing about it.

In case the line is too large, use "\".
pawn Код:
CMD:stats( playerid, params[] )
{
    new stts[ 512 ], pName[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, pName, sizeof( pName ));

    format( stts, sizeof( stts ), "\t{FFFFFF}[ {FFAE00}%s {FFFFFF}Statistics: ]\n\n \
            {FFFFFF}Admin Level: {FFAE00}%d\n \
            {FFFFFF}V.I.P Level: {FFAE00}%d\n \
            {FFFFFF}Score: {FFAE00}%d\n \
            {FFFFFF}Cash: {FFAE00}%d\n \
            {FFFFFF}Coins: {FFAE00}%d\n \
            {FFFFFF}Reputation: {FFAE00}%d\n \
            {FFFFFF}Kills: {FFAE00}%d\n \
            {FFFFFF}Deaths: {FFAE00}%d"
,
            pName,
            P_DATA[ playerid ][ Admin ],
            P_DATA[ playerid ][ Vip ],
            P_DATA[ playerid ][ Score ],
            P_DATA[ playerid ][ Cash ],
            P_DATA[ playerid ][ Coins ],
            P_DATA[ playerid ][ Reputation ],
            P_DATA[ playerid ][ Kills ],
            P_DATA[ playerid ][ Deaths ] );
    SPD( playerid, statistics, MSGBOX, "{FFAE00}P{FFFFFF}layer {FFAE00}S{FFFFFF}tats",  stts, "Ok", "" );
    return 1;
}
Last, these are numeric. It should be "%d" or "%i", not "%s".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)