SA-MP Forums Archive
How can my /stats command be modified to show more stats? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How can my /stats command be modified to show more stats? (/showthread.php?tid=506596)



How can my /stats command be modified to show more stats? - K9IsGodly - 13.04.2014

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.


Re: How can my /stats command be modified to show more stats? - biker122 - 13.04.2014

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);


Re: How can my /stats command be modified to show more stats? - K9IsGodly - 13.04.2014

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.


Re: How can my /stats command be modified to show more stats? - biker122 - 13.04.2014

Ah, Good luck scripting! ;p