SA-MP Forums Archive
Stats in dialog - 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: Stats in dialog (/showthread.php?tid=425218)



Stats in dialog - Squirrel - 25.03.2013

I got a problem with stats in a dialog. I never tried making it so far so dont judge me if I failed hard pl0x.

Код:
CMD:stats(playerid,params[])
{
    new money = PlayerInfo[playerid][pMoney];
    new score = PlayerInfo[playerid][pScores];
    
    new admin = PlayerInfo[playerid][pAdminLevel];
    new vip = PlayerInfo[playerid][pVIPlevel];
    new helper = PlayerInfo[playerid][pHelper];
    
    new Weed = PlayerInfo[playerid][pWeed];
	new Coca = PlayerInfo[playerid][pCoca];
	new Heroin = PlayerInfo[playerid][pHeroin];
	new Meth = PlayerInfo[playerid][pMeth];
	
	new Dlic = PlayerInfo[playerid][pDriversLic];
	
	new Skin = PlayerInfo[playerid][pModel];
	
    new string[500];
	format(string,sizeof(string), "Money:%d || Level: %d", money,score);
	format(string,sizeof(string), "Admin: %d ||Helper: %d || VIP: %d", admin, helper, vip);
	format(string,sizeof(string), "Weed: %d || Coca: %d || Heroin: %d || Meth: %d", Weed, Coca, Heroin, Meth);
	format(string,sizeof(string), "Licenses: Drivers[%d]", Dlic);
	format(string,sizeof(string), "Skin: %d", Skin);
	ShowPlayerDialog(playerid, D_STATS, DIALOG_STYLE_MSGBOX, "Your stats", string, "Close", "");
    return 1;
}
It just shows the last line for the Skin. It doesnt show anything else :/


When I make it with

SendClientMessage works perfectly.


Re: Stats in dialog - LarzI - 25.03.2013

In every format except the first, add "%s\n" and "string":

pawn Код:
format(string,sizeof(string), "%s\nAdmin: %d ||Helper: %d || VIP: %d", string, admin, helper, vip);
Else you won't, A: Get a new line, and B: Add to the string.


Re: Stats in dialog - Squirrel - 25.03.2013

So it should work like something like this
Код:
format(string,sizeof(string), "Money:%d || Level: %d", money,score);
	format(string,sizeof(string), "%s\nAdmin: %d ||Helper: %d || VIP: %d", string, admin, helper, vip);
	format(string,sizeof(string), "%s\nWeed: %d || Coca: %d || Heroin: %d || Meth: %d", Weed, Coca, Heroin, Meth);
	format(string,sizeof(string), "%s\nLicenses: Drivers[%d]", Dlic);
	format(string,sizeof(string), "%s\nSkin: %d", Skin);
	ShowPlayerDialog(playerid, D_STATS, DIALOG_STYLE_MSGBOX, "Your stats", string, "Close", "");
This wont work too :\


It just shows me the Skin:


Re: Stats in dialog - LarzI - 25.03.2013

Almost. You forgot to add "string," in the beginning of the 3 last formats.


Re: Stats in dialog - Squirrel - 25.03.2013

Sory but I dont get it.

Quote:

format(string,sizeof(string), "%s\nAdmin: %d ||Helper: %d || VIP: %d", string, admin, helper, vip);
format(string,sizeof(string), "%s\nWeed: %d || Coca: %d || Heroin: %d || Meth: %d", Weed, Coca, Heroin, Meth);
format(string,sizeof(string), "%s\nLicenses: Drivers[%d]", Dlic);
format(string,sizeof(string), "%s\nSkin: %d", Skin);




Re: Stats in dialog - LarzI - 25.03.2013

Like this:

pawn Код:
format(string,sizeof(string), "Money:%d || Level: %d", money,score);
    format(string,sizeof(string), "%s\nAdmin: %d ||Helper: %d || VIP: %d", string, admin, helper, vip);
    format(string,sizeof(string), "%s\nWeed: %d || Coca: %d || Heroin: %d || Meth: %d", string, Weed, Coca, Heroin, Meth);
    format(string,sizeof(string), "%s\nLicenses: Drivers[%d]", string, Dlic);
    format(string,sizeof(string), "%s\nSkin: %d", string, Skin);



Re: Stats in dialog - Squirrel - 25.03.2013

Ahhh thanks