SA-MP Forums Archive
How to create a long 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: How to create a long dialog (/showthread.php?tid=581175)



How to create a long dialog - ChandraLouis - 11.07.2015

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.



Re: How to create a long dialog - ExcLus - 11.07.2015

Hey there have a look here!
[TUTORIAL] Making long dialog without crashing.


Re: How to create a long dialog - ChandraLouis - 11.07.2015

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.


Here is the code:
pawn Код:
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;
}



AW: Re: How to create a long dialog - Nero_3D - 11.07.2015

Quote:
Originally Posted by ChandraLouis
Посмотреть сообщение
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:
pawn Код:
// 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


Re : How to create a long dialog - KillerDVX - 11.07.2015

Change the size of array :

PHP код:
new pDialog[512]; 
To :

PHP код:
new pDialog[1000];