Stats in dialog
#1

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.
Reply
#2

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.
Reply
#3

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:
Reply
#4

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

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

Reply
#6

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

Ahhh thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)