SA-MP Forums Archive
Have a Big Problem with 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: Have a Big Problem with Dialog (/showthread.php?tid=618969)



DELETE - TYDS - 12.10.2016

DELETE


Re: Have a Big Problem with Dialog - SickAttack - 12.10.2016

Because you never use stringmot.


Re: Have a Big Problem with Dialog - TYDS - 12.10.2016

oh sorry i change to string but it still not show distance


Re: Have a Big Problem with Dialog - SickAttack - 12.10.2016

Because you never use string.


Re: Have a Big Problem with Dialog - TYDS - 12.10.2016

how can i use it's ?


Re: Have a Big Problem with Dialog - azzerking - 12.10.2016

Information

You need to use format to replace the string formatter with the distance you have provided. putting "string" means nothing to the compiler and will interpret it as just the text "string". You need to replace "string" with the value for distance.

Where you have used format to make string have the value for distance, you need to instead put the dialog content in there and at the end use a format specifier to replace that with distance as I have done for you below

Код:
CMD:findjob( playerid, params[] ) 
{
	new 
		string[ 128 ] // increase this to allow for all your text to fit
	;

	format(
		string,
		sizeof( string ),
		"Job\tLocation\tDistance\n \
		Pizza Boy\tSan Fierro\t%.02f", 
		GetPlayerDistanceFromPoint( playerid, -1720.962646, 1364.456176, 7.187500 )
	);

	return ShowPlayerDialog(
		playerid, 
		DIALOG_FINDJOB, 
		DIALOG_STYLE_TABLIST_HEADERS, 
		"FINDJOB",
		string,
		"Select", 
		"Cancel"
	);
}



Re: Have a Big Problem with Dialog - TYDS - 12.10.2016

oke thank you. but how can i ad another job


Re: Have a Big Problem with Dialog - azzerking - 12.10.2016

Solution

Where you have the line "Pizza Boy\tSan Fierro\t%.02f" you will need to add a new line followed by the content you wish to add.

When using Dialogs and specifically the DIALOG_STYLE_LIST or DIALOG_STYLE_TABLIST_HEADERS, using \n means new line and a new line makes a new list item.

so to add on to what you had before you may use:
Код:
"Job\tLocation\tDistance\n \
Pizza Boy\tSan Fierro\t%.02f\n \
Dish Washer\tLas Venturas\t%.02f", // Just an example
So what did I add? I added \n to the end of the line to tell the compiler that your working on a list item. Then you fill in each column followed by a \t to separate it.

Just a note: As you can see I put an extra \ at the end of each line, this tells the compiler to ignore the whitespace and continue to treat it as a string, without it if you tried to put content on a new line the compiler would error.