Unknown Command /stats
#1

Hello i working at a admin script and i remade the stats and now it's not working when i go in game and i type /stats it doesn't work and when i compile no error.
Here's the code.

And ignore the second part of the stats.

Command: /stats

Quote:

CMDtats(playerid, params[])
{
if(!sscanf(params, "u", giveid))
{
if(IsPlayerConnected(giveid))
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "{D1D1D1}Player Stats", ShowStats(giveid), "Ok", "");
return 1;
}
else return SendClientMessage(playerid, red, "ERROR: Player not connected!");
}
else return ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "{D1D1D1}Player Stats", ShowStats(playerid), "Ok", "");
}

And the Function ShowStats.
Quote:

stock ShowStats(playerid)
{
//Killer Rank's
new KRank[29];
if(PlayerInfo[playerid][Kills] < 100) KRank = "Begginer";
else if(PlayerInfo[playerid][Kills] >= 100 && PlayerInfo[playerid][Kills] < 250)
{
KRank = "Recruit";
}
else if(PlayerInfo[playerid][Kills] >= 250 && PlayerInfo[playerid][Kills] < 400)
{
KRank = "Thug";
}
else if(PlayerInfo[playerid][Kills] >= 400 && PlayerInfo[playerid][Kills] < 700)
{
KRank = "No Heart";
}
else if(PlayerInfo[playerid][Kills] >= 700 && PlayerInfo[playerid][Kills] < 1000)
{
KRank = "Savage";
}
else if(PlayerInfo[playerid][Kills] >= 1000 && PlayerInfo[playerid][Kills] < 1500)
{
KRank = "Beast";
}
else if(PlayerInfo[playerid][Kills] >= 1500 && PlayerInfo[playerid][Kills] < 3000)
{
KRank = "Murderer";
}
else if(PlayerInfo[playerid][Kills] >= 3000)
{
KRank = "Hitman";
}
//================================================== ============================
new ADMIN[166];
if(PlayerInfo[playerid][Level] > 1)
{
ADMIN = "Yes";
}
else if(PlayerInfo[playerid][Level] < 10000)
{
ADMIN = "No";
}
//================================================== ============================
new statstr[700],statstrbig[4000],playername[24];
GetPlayerName(playerid, playername, sizeof(playername));
//Stats First Part
format(statstr, 700, "{FF0000}%s's {CBC8C8}Stats\n\n\
Kills:{FF0000} %d\n\
{CBC8C8}Killer Rank:{FF0000} %s\n\
{CBC8C8}Deaths:{FF0000} %d\n\
{CBC8C8}Ratio:{FF0000} %0.2f\n\
{CBC8C8}Money:{FF0000} $%d\n\
{CBC8C8}Admin:{FF0000} %s {CBC8C8}- Level:{FF0000} %d",
playername, PlayerInfo[playerid][Kills],KRank, PlayerInfo[playerid][Deaths],
Float:PlayerInfo[playerid][Deaths]/Float:PlayerInfo[playerid][Deaths],
GetPlayerMoney(playerid),ADMIN,PlayerInfo[playerid][Level]);
//Stats Second Part
/*format(statstr[1], 700, "\n\n\
Kills:{FF0000} %d\n\
{CBC8C8}Deaths:{FF0000} %d\n\
{CBC8C8}Ratio:{FF0000} %0.2f\n\
{CBC8C8}Money:{FF0000} $%d\n\
{CBC8C8}Admin:{FF0000} %s {CBC8C8}- Level:{FF0000} %d",
playername, PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths],
Float:PlayerInfo[playerid][Deaths]/Float:PlayerInfo[playerid][Deaths],
GetPlayerMoney(playerid),ADMIN,PlayerInfo[playerid][Level]);*/
//================================================== ============================
//format(statstrbig, 4000, "%s", statstr[0]);

return statstr;
}

Reply
#2

Try this:

Код:
CMD:stats(playerid, params[])
{
	new giveid;
	if(!sscanf(params, "u", giveid))
	{
		if(IsPlayerConnected(giveid))
		{
			ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "{D1D1D1}Player Stats", ShowStats(giveid), "Ok", "");
		}
		else { SendClientMessage(playerid, red, "ERROR: Player not connected!"); }
	}
	else { ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "{D1D1D1}Player Stats", ShowStats(playerid), "Ok", ""); }
	return 1;
}
If the problem is still not solved with the command I gave you, then it's probably a too big string which shows the stats.
Reply
#3

Nope.
I tried this to it's not from the CMD: stats
The problem it's from ShowStats.
Reply
#4

Try changing this:
Код:
Float:PlayerInfo[playerid][Deaths]/Float:PlayerInfo[playerid][Deaths],
to

Код:
PlayerInfo[playerid][Kills]/PlayerInfo[playerid][Deaths],
You have to check Kills/Deaths not Deaths/Deaths

You are also using too big string, you are using ADMIN string with 166 characters for max 3 characters ( "YES" ). Change it to ADMIN[3];

Also the KRank[29] to KRank[10];
Reply
#5

No man , it's something from the return because it's not showing my the dialog the stats was working until i put the Killer Ranks if i remove the Killer Ranks it's Working so maybe it's something wrong with killer ranks.
Reply
#6

In that case, try this:

Код:
if(PlayerInfo[playerid][Kills] < 100){ format(KRank,sizeof(KRank),"Begginer"); }
else if(PlayerInfo[playerid][Kills] >= 100 && PlayerInfo[playerid][Kills] < 250)
{
format(KRank,sizeof(KRank),"Recruit");
}
else if(PlayerInfo[playerid][Kills] >= 250 && PlayerInfo[playerid][Kills] < 400)
{
format(KRank,sizeof(KRank),"Thug");
}
else if(PlayerInfo[playerid][Kills] >= 400 && PlayerInfo[playerid][Kills] < 700)
{
format(KRank,sizeof(KRank),"No Heart");
}
else if(PlayerInfo[playerid][Kills] >= 700 && PlayerInfo[playerid][Kills] < 1000)
{
format(KRank,sizeof(KRank),"Savage");
}
else if(PlayerInfo[playerid][Kills] >= 1000 && PlayerInfo[playerid][Kills] < 1500)
{
format(KRank,sizeof(KRank),"Beast");
}
else if(PlayerInfo[playerid][Kills] >= 1500 && PlayerInfo[playerid][Kills] < 3000)
{
format(KRank,sizeof(KRank),"Murderer");
}
else if(PlayerInfo[playerid][Kills] >= 3000)
{
format(KRank,sizeof(KRank),"Hitman");
}
//================================================== ============================
new ADMIN[3];
if(PlayerInfo[playerid][Level] > 1)
{
format(ADMIN,sizeof(ADMIN),"Yes");
}
else if(PlayerInfo[playerid][Level] < 10000)
{
format(ADMIN,sizeof(ADMIN),"No");
}
Reply
#7

Thanks dude it's works perfectly fine you know what was the problem LOL! )
it was the problem from "statstrbig" LOL i remove that and it's working now!
Thanks :* for helping
http://imgur.com/y3TPRLC
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)