How can my /stats command be modified to show more stats?
#1

I've tried a couple of different formatting things, but sadly none of them worked. How can I make this command:

Код:
CMD:stats(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		new money = PlayerInfo[playerid][pCash];
		new deaths = PlayerInfo[playerid][pDeaths];
		new kills = PlayerInfo[playerid][pKills];
		new crack = PlayerDrugInfo[playerid][pCrack];
		new string1[128],stats[1050];
		format(string1, sizeof string1, "{44A1D0}Money: {FFFFFF}[$%d] {44A1D0}Deaths: {FFFFFF}[%d] {44A1D0}Kills: {FFFFFF}[%d] {44A1D0}Crack: {FFFFFF}[%d]", money,deaths,kills,crack);
		format(stats, sizeof stats, "%s", string1);
    	ShowPlayerDialog(playerid,102,DIALOG_STYLE_MSGBOX,""COL_BLUE"Your account:",stats,"Ok","");
    	return 1;
	}
	return 1;
}
Include more stats? Such as an admin level? If anyone has a suggestion that requires just scrapping this dialog idea, that's fine, I just want to be able to display a large amount of stats for the player.
Reply
#2

pawn Код:
CMD:stats(playerid, params[])
{
    new money = GetPlayerMoney(playerid);
    new deaths = PlayerInfo[playerid][pDeaths];
    new kills = PlayerInfo[playerid][pKills];
    new crack = PlayerDrugInfo[playerid][pCrack];
    new string1[1050];
    format(string1, sizeof string1, "{44A1D0}Money: {FFFFFF}[$%d]\n {44A1D0}Deaths: {FFFFFF}[%d]\n {44A1D0}Kills: {FFFFFF}[%d]\n {44A1D0}Crack: {FFFFFF}[%d]\n{44A1D0}Admin Level: {FFFFF}[%d]\n", money,deaths,kills,crack,PlayerInfo[playerid][pAdminLevel]);
    ShowPlayerDialog(playerid,102,DIALOG_STYLE_MSGBOX,""COL_BLUE"Your account:",string1,"Ok","");

    return 1;
}
Try this.

"\n" means it will show it in the next line, if you aren't going to add this, everything will be just messed up in a single line.
Instead of doing PlayerInfo[playerid][pCash], you can use GetPlayerMoney(playerid);
Reply
#3

Quote:
Originally Posted by biker122
Посмотреть сообщение
pawn Код:
CMD:stats(playerid, params[])
{
    new money = GetPlayerMoney(playerid);
    new deaths = PlayerInfo[playerid][pDeaths];
    new kills = PlayerInfo[playerid][pKills];
    new crack = PlayerDrugInfo[playerid][pCrack];
    new string1[1050];
    format(string1, sizeof string1, "{44A1D0}Money: {FFFFFF}[$%d]\n {44A1D0}Deaths: {FFFFFF}[%d]\n {44A1D0}Kills: {FFFFFF}[%d]\n {44A1D0}Crack: {FFFFFF}[%d]\n{44A1D0}Admin Level: {FFFFF}[%d]\n", money,deaths,kills,crack,PlayerInfo[playerid][pAdminLevel]);
    ShowPlayerDialog(playerid,102,DIALOG_STYLE_MSGBOX,""COL_BLUE"Your account:",string1,"Ok","");

    return 1;
}
Try this.

"\n" means it will show it in the next line, if you aren't going to add this, everything will be just messed up in a single line.
Instead of doing PlayerInfo[playerid][pCash], you can use GetPlayerMoney(playerid);
Alright, thanks for these ideas. Hadn't even thought about using \n.
Reply
#4

Ah, Good luck scripting! ;p
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)