PDA

View Full Version : How to create a long dialog


ChandraLouis
11/07/2015, 08:25 AM
Hello there,
I want to ask how to create a long dialog like this one.

I have tried to create one but it only shows a little message.

Thanks in advance.
http://i.imgur.com/s2wGkRT.png

ExcLus
11/07/2015, 08:45 AM
Hey there have a look here!
[TUTORIAL] Making long dialog without crashing. (http://forum.sa-mp.com/showthread.php?t=336102)

ChandraLouis
11/07/2015, 09:48 AM
Thank you for the reply.
I have created a command with the tutorials.
But, still, it doesn't show all of the texts that i create.
http://i.imgur.com/PVLMXRv.png

Here is the code:
CMD:shop(playerid, params[])
{
new pDialog[512];
strcat(pDialog, ""COL_YELLOW"Handguns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Pistol ["COL_LGREEN"2000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Silenced Pistol ["COL_LGREEN"2500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Desert Eagle ["COL_LGREEN"5000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Shotguns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Pump Shotgun ["COL_LGREEN"5000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Combat Shotgun ["COL_LGREEN"7500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Sawn Off Shotgun ["COL_LGREEN"10000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Sub Machine Guns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Tec-9 ["COL_LGREEN"12500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Micro SMG ["COL_LGREEN"12500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"MP5 ["COL_LGREEN"14500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Assault Guns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"AK-47 ["COL_LGREEN"16500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"M4 ["COL_LGREEN"17500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Rifle Guns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Country Rifle ["COL_LGREEN"20000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Sniper Rifle ["COL_LGREEN"25000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Heavy Guns:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Rocket Launcher/RPG ["COL_LGREEN"30000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Melees:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Katana ["COL_LGREEN"1000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Knife ["COL_LGREEN"1000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Baseball Bat ["COL_LGREEN"1000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_YELLOW"Others:\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Full Health ["COL_LGREEN"5000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"Full Armour ["COL_LGREEN"5000$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"50 Health ["COL_LGREEN"2500$]\n", sizeof(pDialog));
strcat(pDialog, ""COL_GREEN"["WHITE"-"COL_GREEN"] "COL_LIGHTBLUE"50 Armour ["COL_LGREEN"2500$]\n", sizeof(pDialog));
ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Weapons Shop", pDialog, "Buy", "Cancel");
return 1;
}

Nero_3D
11/07/2015, 10:19 AM
Thank you for the reply.
I have created a command with the tutorials.
But, still, it doesn't show all of the texts that i create.

IMAGE

Here is the code:

// CODE
new pDialog[512];
// CODE


@Preamble
This method isn't good because each time you call the command you recreate the string
If you use strcat at least do it in OnGameModeInit and store the string globally
The better method would be to do it without strcat

@Your problem
Increase the size of your array "pDialog" to fit the string

KillerDVX
11/07/2015, 12:08 PM
Change the size of array :

new pDialog[512];

To :

new pDialog[1000];