SA-MP Forums Archive
Help making a long dialog list using strings - 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: Help making a long dialog list using strings (/showthread.php?tid=479252)



Help making a long dialog list using strings - AIped - 03.12.2013

Hello there,

I made this simple command that shows a clientmessage with all companynames.
Since there are very much of them and i want to add them simply i wanted to put them into a dialog with using the same format.
pawn Код:
if(!strcmp(cmdtext, "/soldornot", true))
    {
        new hugestring[500];
        for(new h = 0; h < MAX_COMPANIES; h++)
        {
        format(hugestring, sizeof(hugestring),"%s",CompanyNames[h]);
        SendClientMessage(playerid,COLOR_ORANGE,hugestring);
        }
        return 1;
    }
Unfortunatly this does not work well with a dialog;

pawn Код:
ShowPlayerDialog(playerid,BANK_DIALOGID,DIALOG_STYLE_LIST,"Company's",hugestring,"Info","Exit");
I can only see the last company name in the dialog. I searched a bit and found one person with a simular problem but i didnt realy understand their conclusion.

Help will obviously become a +rep and 7 years of luck XD


Re: Help making a long dialog list using strings - eblood1 - 03.12.2013

Код:
if(!strcmp(cmdtext, "/soldornot", true))
{
    new hugestring[500];
    for(new h = 0; h < MAX_COMPANIES; h++) {
    	format(hugestring, sizeof(hugestring),"%s%s\n", hugestring, CompanyNames[h]);
	    SendClientMessage(playerid,COLOR_ORANGE,hugestring);
    }
    return 1;
}



Re: Help making a long dialog list using strings - Blademaster680 - 03.12.2013

Код:
format(hugestring, sizeof(hugestring),"%s %d",CompanyNames[h],);
You are trying to declare 2 variables yet you only displaying 1.
Код:
"%s %d",CompanyNames[h],);
See the "," and then you close the code, you should be defining what "%d" is... Currently only "%s" is being used.

Hope it makes sense


Re: Help making a long dialog list using strings - AIped - 03.12.2013

aahh crap i was showing the wrong example it should be without the %d..(changed edited the post now) the thing is i just want a list of (companie) names into a dialog
using a loop and one string


Re: Help making a long dialog list using strings - eblood1 - 03.12.2013

Quote:

aahh crap i was showing the wrong example it should be without the %d..(changed edited the post now) the thing is i just want a list of (companie) names into a dialog
using a loop and one string

Have you tried what I posted? That will work.


Re: Help making a long dialog list using strings - AIped - 03.12.2013

It has a clientmessage..i need it in a dialog


Re: Help making a long dialog list using strings - eblood1 - 03.12.2013

I didn't even notice, I just editted the format.
Here you go:
pawn Код:
if(!strcmp(cmdtext, "/soldornot", true))
{
    new hugestring[500];
    for(new h = 0; h != MAX_COMPANIES; h++)
        format(hugestring, sizeof(hugestring),"%s%s\n", hugestring, CompanyNames[h]);
    ShowPlayerDialog(playerid, BANK_DIALOGID, DIALOG_STYLE_LIST, "Company's", hugestring, "Info", "Exit");
    return 1;
}



Re: Help making a long dialog list using strings - AIped - 03.12.2013

Quote:
Originally Posted by eblood1
Посмотреть сообщение
I didn't even notice, I just editted the format.
Here you go:
pawn Код:
if(!strcmp(cmdtext, "/soldornot", true))
{
    new hugestring[500];
    for(new h = 0; h != MAX_COMPANIES; h++)
        format(hugestring, sizeof(hugestring),"%s%s\n", hugestring, CompanyNames[h]);
    ShowPlayerDialog(playerid, BANK_DIALOGID, DIALOG_STYLE_LIST, "Company's", hugestring, "Info", "Exit");
    return 1;
}
No ....if i try it with a clientmessage instead is does work though..i still only see the last cmpany


Re: Help making a long dialog list using strings - eblood1 - 03.12.2013

There's nothing wrong with that code, your problem is elsewhere.


Re: Help making a long dialog list using strings - AIped - 03.12.2013

Quote:
Originally Posted by eblood1
Посмотреть сообщение
There's nothing wrong with that code, your problem is elsewhere.
Okay i tested again only this time i just copied your entire code and now it works... i probably made a typo

Thanks!