SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 04/12/2019, 03:43 AM   #1
Big Clucker
CrystalMethod's Avatar
Join Date: Dec 2011
Location: Michigan
Posts: 119
Reputation: 26
Default Formatting in dialog.

All screenshots taken at the same. We ruled out different resolutions being the issue and the version of 0.3.7 we were using. The user Naldo is the only one where the dialogs display exactly the way they should.


	new string[400],Dodo1[40],Cargo1[40],Heli1[40],Big1[40],Army1[40],Shamal1[40],Skimmer1[40],Van1[40];
	if(PlayerInfo[playerid][Dodo] > 499) strmid(Dodo1,"{00FF00}Completed",0,20,20);
		else strmid(Dodo1,"{FF0000}Not completed",0,30,30);
	if(PlayerInfo[playerid][Cargo] > 499) strmid(Cargo1,"{00FF00}Completed",0,20,20);
	    else strmid(Cargo1,"{FF0000}Not completed",0,30,30);
	if(PlayerInfo[playerid][Helicopter] > 499) strmid(Heli1,"{00FF00}Completed",0,20,20);
	    else strmid(Heli1,"{FF0000}Not completed",0,30,30);
	if(PlayerInfo[playerid][AT300] > 499) strmid(Big1,"{00FF00}Completed",0,20,20);
		else strmid(Big1,"{FF0000}Not completed",0,30,30);
	if(PlayerInfo[playerid][Miltary] > 499) strmid(Army1,"{00FF00}Completed",0,20,20);
	    else strmid(Army1,"{FF0000}Not completed",0,30,30);
	if(PlayerInfo[playerid][Shamal] > 499) strmid(Shamal1,"{00FF00}Completed",0,20,20);
	    else strmid(Shamal1,"{FF0000}Not completed",0,30,30);
 	if(PlayerInfo[playerid][Skimmer] > 499) strmid(Skimmer1,"{00FF00}Completed",0,20,20);
	    else strmid(Skimmer1,"{FF0000}Not completed",0,30,30);
    if(PlayerInfo[playerid][Van] > 499) strmid(Van1,"{00FF00}Completed",0,20,20);
	    else strmid(Skimmer1,"{FF0000}Not completed",0,30,30);
	ShowPlayerDialog(playerid, LICENSES,DIALOG_STYLE_LIST,"Achievements",string,"Ok","");
	return 1;
	new string[300],dodostring[40],shamalstring[40],maverickstring[50],nevadastring[40];
	if(PlayerInfo[playerid][dLicense] == 1) strmid(dodostring,"{00FF00}Completed",0,20,20);
	    else strmid(dodostring,"{FF0000}Not Completed",0,30,30);
	if(PlayerInfo[playerid][sLicense] == 1) strmid(shamalstring,"{00FF00}Completed",0,20,20);
	    else strmid(shamalstring,"{FF0000}Not Completed",0,30,30);
	if(PlayerInfo[playerid][mLicense] == 1) strmid(maverickstring,"{00FF00}Completed",0,25,25);
		else strmid(maverickstring,"{FF0000}Not Completed",0,30,30);
	if(PlayerInfo[playerid][nLicense] == 1) strmid(nevadastring,"{00FF00}Completed",0,25,25);
		else strmid(nevadastring,"{FF0000}Not Completed",0,30,30);
	format(string,sizeof(string),"Dodo License\t\t%s\nShamal License\t\t%s\nMaverick License\t%s\nNevada License\t\t%s",dodostring,shamalstring,maverickstring,nevadastring);
	ShowPlayerDialog(playerid, LICENSES,DIALOG_STYLE_LIST,"Your Licenses",string,"Ok","");
	return 1;
Basically need to make sure these dialogs all display like naldos.

Version: 0.3.7-R2

CrystalMethod is offline   Reply With Quote
Old 04/12/2019, 05:23 AM   #2
Big Clucker
Join Date: Feb 2018
Location: Germany
Posts: 64
Reputation: 1
Default Re: Formatting in dialog.

Test that:
PHP Code:
if(PlayerInfo[playerid][Dodo] > 499Dodo1="{00FF00}Completed";
Dodo1="{FF0000}Not completed"
If it works, change all of them to this type
SiNaGaMeR is offline   Reply With Quote
Old 04/12/2019, 05:35 AM   #3
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: Formatting in dialog.

DIALOG_STYLE_TABLIST does what you need.

But why `strmid` and not `strcat`?
Calisthenics is offline   Reply With Quote
Old 04/12/2019, 11:57 AM   #4
Big Clucker
CXdur's Avatar
Join Date: Jun 2014
Location: Norway
Posts: 57
Reputation: 6
Default Re: Formatting in dialog.

As Calisthenics pointed out, you could check out DIALOG_STYLE_TABLIST.

I would also suggest you rewrite your code to improve its readability and make it easier to work on for others. You can also get rid of unnecessary variables and function calls (strmid).

Here's an example of how you could format the info[] parameter of the dialog:

new confirmed[] = "{199e05}Confirmed";
new notConfirmed[] = "{c40024}Not confirmed";

new info[420];
format(info, sizeof(info), 
	"Dodo license: \t\t%s\n\
	Shamal license: \t\t%s\n\
	Maverick license: \t\t%s\n\
	Nevada license: \t\t%s\n",
	PlayerInfo[playerid][dLicense] ? confirmed : notConfirmed,
	PlayerInfo[playerid][sLicense] ? confirmed : notConfirmed,
	PlayerInfo[playerid][mLicense] ? confirmed : notConfirmed,
	PlayerInfo[playerid][nLicense] ? confirmed : notConfirmed
I haven't tested the code above! It's only there to serve as an example of a way to better structure your code.
CXdur is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Dialog Styles] Formatting ApolloScripter Scripting Help 6 03/12/2019 09:45 AM
dialog formatting rhash Scripting Help 3 20/01/2018 08:37 AM
new dialog styles with formatting beckzy Scripting Help 3 30/03/2015 12:27 PM
Dialog Formatting [LoF]Zak Scripting Help 2 02/02/2012 09:03 PM
Formatting Dialog HondaCBR Scripting Help 4 01/01/2012 04:03 PM

All times are GMT. The time now is 02:03 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.