PDA

View Full Version : My Stats Command Showing An Unknown Command


ohmy
24/12/2014, 07:27 AM
Hello

Why my stats command showing up an unknown command. here my code
CMD:stats(playerid, params[])
{
new namajudul[100000];
new stats[100000];
GetPlayerName(playerid, namajudul, sizeof(namajudul));
format(namajudul, sizeof(namajudul), "Stats Player %s", namajudul);
format(stats, sizeof(stats), "Name: %s\nMoney: %d\nKills: %d\nDeath: %d\nScore: %d\nAdmin Level: %d\nV.I.P Level: %d\n\nDi Dalam PB: %d", User[playerid][USER_NAME], User[playerid][USER_MONEY], User[playerid][USER_KILLS], User[playerid][USER_DEATHS], User[playerid][USER_SCORE], User[playerid][USER_ADMIN], User[playerid][USER_VIP], User[playerid][USER_PB]);
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, namajudul, stats, "OK", "");
return 1;
}

And My Enum
enum USER_DATA
{
USER_ID,
USER_NAME[MAX_PLAYER_NAME],
USER_PASSWORD[129],
USER_ADMIN,
USER_VIP,
USER_MONEY,
USER_SCORE,
USER_KILLS,
USER_DEATHS,
USER_KD,
USER_PB,
USER_SKIN,

bool: USER_LOGGED_IN
};
new User[MAX_PLAYERS][USER_DATA];

It Compile without an error or warning, but when i type the command, it show an Unknown command

M4D
24/12/2014, 07:33 AM
new namajudul[100000];
new stats[100000];


you created variables with VERY BIG size !!!
for namajudul you just need 24 !! because name character limite is 24 you don't need to make it with 100000 size !
you store player name in "USER_NAME[MAX_PLAYER_NAME]" variable so you don't need to get player name in command !

try:


CMD:stats(playerid, params[])
{
new namajudul[40];
new stats[128];
format(namajudul, sizeof(namajudul), "Stats Player %s", User[playerid][USER_NAME]);
format(stats, sizeof(stats), "Name: %s\nMoney: %d\nKills: %d\nDeath: %d\nScore: %d\nAdmin Level: %d\nV.I.P Level: %d\n\nDi Dalam PB: %d", User[playerid][USER_NAME], User[playerid][USER_MONEY], User[playerid][USER_KILLS], User[playerid][USER_DEATHS], User[playerid][USER_SCORE], User[playerid][USER_ADMIN], User[playerid][USER_VIP], User[playerid][USER_PB]);
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, namajudul, stats, "OK", "");
return 1;
}

ohmy
24/12/2014, 07:51 AM
Its worked now, thanks! rep+ for you