PDA

View Full Version : -> /stats doesn't shows up <-


RaZzZzoR
25/11/2012, 03:34 PM
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 ?

Camorra
25/11/2012, 03:38 PM
Just a format? Where is the send msg?

Luis-
25/11/2012, 03:38 PM
Show the "SPD" function. Also, try adding some prints to see where it stops working.

Boooth
25/11/2012, 03:40 PM
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", "");

Nordic
25/11/2012, 03:44 PM
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..

Skimmer
25/11/2012, 03:45 PM
Why has the variable stts the amount 5000 ? There is a limit, lol.
See this. http://wiki.sa-mp.com/wiki/Limits
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 );
}

Nordic
25/11/2012, 03:52 PM
Why has the variable stts the amount 5000 ? There is a limit, lol.


wut limit r u talking about.

Konstantinos
25/11/2012, 04:22 PM
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 "\".

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