Help making a long dialog list using strings
#1

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
Reply
#2

Код:
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;
}
Reply
#3

Код:
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
Reply
#4

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
Reply
#5

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.
Reply
#6

It has a clientmessage..i need it in a dialog
Reply
#7

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;
}
Reply
#8

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
Reply
#9

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

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)