SA-MP Forums Archive
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: Dialog (/showthread.php?tid=371069)



Dialog - SumX - 22.08.2012

Hey! Can this dialog be turned into strcat? Or can I make it bigger? Every time when I add another 1-2 lines to /stats command,my complier crashes.If I delete those lines,my complier works perfect.

Код:
CMD:stats( playerid, params[ ] )
{
	if ( GetPVarInt( playerid, "Logged" ) == 0 )
	    return SendClientMessage( playerid, -1, ""COLOR_RED"To view your stats you must be logged in.");

	new
		iBox[ 1024 ],
		RegDate[ 40 ],
		pLastOn[ 20 + 20 ],
		pLevel = GetPVarInt( playerid, "AdminLevel")
	;
	GetPVarString( playerid, "Date", RegDate, sizeof RegDate );
	GetPVarString( playerid, "On", pLastOn, sizeof pLastOn );

	format( iBox, sizeof iBox, ""BLUESV"Hello "REDSV"%s"BLUESV", these are your stats\n\n\
	                            "ORANGESV"Admin Level{FFFFFF}: "ORANGESV"%s{FFFFFF}["ORANGESV"%d{FFFFFF}]\n\
	                           	"VIPSV"VIP Level: "VIPSV"%d\n\
	                            "BLUESV"Money: "REDSV"%d\n\
	                            "BLUESV"Score: "REDSV"%d\n\
	                            "BLUESV"Coins: "REDSV"%d\n\
	                            "BLUESV"Drugs: "REDSV"%d\n\
	                            "BLUESV"Kills: "REDSV"%d\n\
	                            "BLUESV"Deaths: "REDSV"%d\n",
											  pName( playerid ),
											  GetPlayerLevelName( playerid ),
											  pLevel,
											  GetPlayerVLevel( playerid ),
											  GetPlayerMoney( playerid ),
											  GetPlayerScore( playerid ),
											  GetPVarInt( playerid,"Coins" ),
											  GetPVarInt( playerid,"Drugs" ),
											  GetPVarInt( playerid,"Kills" ),
											  GetPVarInt( playerid,"Deaths" ) );

	format( iBox, sizeof iBox, "%s"BLUESV"Team: %s\n\
	                            "BLUESV"Club: %s\n\
								"BLUESV"SkinID: "REDSV"%d\n\
								"BLUESV"Registration Date: "REDSV"%s\n\
								"BLUESV"Last On: "REDSV"%s\n\
								"BLUESV"PM Disabled: "REDSV"%s\n\
								"BLUESV"Car God: "REDSV"%s\n\
								"BLUESV"Player God: "REDSV"%s",
											  iBox,
											  GetPlayerTeamName( playerid ),
											  GetPlayerClubName( playerid ),
											  GetPlayerSkin( playerid ),
											  RegDate,
											  pLastOn,
											  GetPVarInt( playerid, "Disable_PM" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"),
											  GetPVarInt( playerid, "CGod" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"),
											  GetPVarInt( playerid, "God" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"));

	ShowPlayerDialog( playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, ""BLUESV"Your Stats!", iBox, "OK", "");
	return 1;
}
I want to make this dialog BIGGER!


Re: Dialog - Ranama - 22.08.2012

Yeah, i think you have to use strcat, otherwise, why don't you just do it with SendClientMessage? easier and you can fit much more there, and you don't close the dialog where all the stats are
But yeah, try using strcat and see if it works.


Re: Dialog - SumX - 22.08.2012

SendClientMessage? I type /stats ,I see them,but I forgot something,I type again,but I update my stats and I type AGAIN!
My chat is spammed


Re: Dialog - SumX - 22.08.2012

I tried like this,but i got errors.I've seen on some posts that strcat doesn't support variables.So what should I use for a bigger dialog?

Код:
CMD:stats( playerid, params[ ] )
{
	if ( GetPVarInt( playerid, "Logged" ) == 0 )
	    return SendClientMessage( playerid, -1, ""COLOR_RED"To view your stats you must be logged in.");

	new
		iBox[ 1024 ],
		RegDate[ 40 ],
		pLastOn[ 20 + 20 ]
	;
	GetPVarString( playerid, "Date", RegDate, sizeof RegDate );
	GetPVarString( playerid, "On", pLastOn, sizeof pLastOn );
	
	strcat(iBox,""BLUESV"Hello "REDSV"%s"BLUESV", these are your stats:",pName( playerid ));//13427
	strcat(iBox,"\n\n"ORANGESV"Admin Level{FFFFFF}: "ORANGESV"%s{FFFFFF}["ORANGESV"%d{FFFFFF}]",GetPlayerLevelName( playerid ),GetPVarInt( playerid, "AdminLevel"));//13428
	strcat(iBox,"\n"VIPSV"VIP Level: "VIPSV"%d",GetPlayerVLevel( playerid ));
	strcat(iBox,"\n"BLUESV"Money: "REDSV"%d",GetPlayerMoney( playerid ));
	strcat(iBox,"\n"BLUESV"Coins: "REDSV"%d",GetPVarInt( playerid,"Coins" ));
	strcat(iBox,"\n"BLUESV"Score: "REDSV"%d",GetPlayerScore( playerid ));
	strcat(iBox,"\n"BLUESV"Drugs: "REDSV"%d",GetPVarInt( playerid,"Drugs" ));
	strcat(iBox,"\n"BLUESV"Materials: "REDSV"%d",GetPVarInt( playerid,"Mats" ));
	strcat(iBox,"\n"BLUESV"Kills: "REDSV"%d",GetPVarInt( playerid,"Kills" ));
	strcat(iBox,"\n"BLUESV"Deaths: "REDSV"%d",GetPVarInt( playerid,"Deaths" ));
	strcat(iBox,"\n"BLUESV"Team: %s",GetPlayerTeamName( playerid ));//13437
	strcat(iBox,"\n"BLUESV"Club: %s",GetPlayerClubName( playerid ));//13438
	strcat(iBox,"\n"BLUESV"SkinID: "REDSV"%d",GetPlayerSkin( playerid ));
	strcat(iBox,"\n"BLUESV"Registration Date: "REDSV"%s",RegDate);//13440
	strcat(iBox,"\n"BLUESV"Last On: "REDSV"%s",pLastOn);//13441
	strcat(iBox,"\n"BLUESV"PM Disabled: "REDSV"%s",GetPVarInt( playerid, "Disable_PM" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"));//13442
	strcat(iBox,"\n"BLUESV"Car God: "REDSV"%s",GetPVarInt( playerid, "CGod" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"));//13443
	strcat(iBox,"\n"BLUESV"Player God: "REDSV"%s",GetPVarInt( playerid, "God" ) ? (""COLOR_GREEN"YES") : (""COLOR_RED"NO"));//13444

	ShowPlayerDialog( playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, ""BLUESV"Your Stats!", iBox, "OK", "");
	return 1;
}
Код:
(13427) : error 035: argument type mismatch (argument 3)
(13428) : error 035: argument type mismatch (argument 3)
(13437) : error 035: argument type mismatch (argument 3)
(13438) : error 035: argument type mismatch (argument 3)
(13440) : error 035: argument type mismatch (argument 3)
(13441) : error 035: argument type mismatch (argument 3)
(13442) : error 035: argument type mismatch (argument 3)
(13443) : error 035: argument type mismatch (argument 3)
(13444) : error 035: argument type mismatch (argument 3)



Re: Dialog - Ranama - 22.08.2012

https://sampwiki.blast.hk/wiki/Strcat
You'll have to set a value for the 3rd parameter, like how big the text can be as biggest all together.