SA-MP Forums Archive
list dialog help - 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: list dialog help (/showthread.php?tid=327766)



list dialog help - WardenCS - 22.03.2012

Hello, i tried to make a list dialog, but it aint working right.It should list all of the sorts from file but it will show only first one.

Код:
CMD:weedsorts(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] == 0)
{
SendClientMessage(playerid,COLOR_GRAD2,"You are not authorized to use this command!");
return 1;
}
for(new r = 0; r <= MAX_WEEDS; r++)
{
new fstring[256];
new string[256];
format(fstring, sizeof(fstring),"Sort: %s\n",WeedInfo[r][wSort]);
strcat(string, fstring, sizeof(string));
ShowPlayerDialog(playerid,DIALOG_MANAGEWEED+4,DIALOG_STYLE_LIST,"Weed Sorts",string,"Ok","Cancel");
}
}
return 1;
}



Re: list dialog help - SuperViper - 22.03.2012

Instead of having fstring and using strcat, just format string and before everything put a %s, which would be string.


Re: list dialog help - Bogdan1992 - 22.03.2012

pawn Код:
CMD:weedsorts(playerid, params[]){
    if(IsPlayerConnected(playerid)){
        if(PlayerInfo[playerid][pAdmin] == 0){
            SendClientMessage(playerid,COLOR_GRAD2,"You are not authorized to use this command!");
            return 1;
        }
        for(new r = 0; r <= MAX_WEEDS; r++){
            new string[256];
            format(string, sizeof(string),"Sort: %s\n",WeedInfo[r][wSort]);
            ShowPlayerDialog(playerid,DIALOG_MANAGEWEED+4,DIALOG_STYLE_LIST,"Weed Sorts",string,"Ok","Cancel");
        }
    }
    return 1;
}



Re: list dialog help - WardenCS - 22.03.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Instead of having fstring and using strcat, just format string and before everything put a %s, which would be string.
like that?
Код:
format(string,sizeof string,"%sSort: %s \n",string,WeedInfo[r][wSort]);
ShowPlayerDialog(playerid,DIALOG_MANAGEWEED+4,DIALOG_STYLE_LIST,"Weed Sorts",string,"Ok","Cancel");
it still wont work.


Quote:
Originally Posted by Bogdan1992
Посмотреть сообщение
pawn Код:
CMD:weedsorts(playerid, params[]){
    if(IsPlayerConnected(playerid)){
        if(PlayerInfo[playerid][pAdmin] == 0){
            SendClientMessage(playerid,COLOR_GRAD2,"You are not authorized to use this command!");
            return 1;
        }
        for(new r = 0; r <= MAX_WEEDS; r++){
            new string[256];
            format(string, sizeof(string),"Sort: %s\n",WeedInfo[r][wSort]);
            ShowPlayerDialog(playerid,DIALOG_MANAGEWEED+4,DIALOG_STYLE_LIST,"Weed Sorts",string,"Ok","Cancel");
        }
    }
    return 1;
}
that aint working neither


Re: list dialog help - Bogdan1992 - 22.03.2012

make some tests
Add this SendClientMessage(playerid, -1 , string); under dialog

and tell what it says.


Re: list dialog help - WardenCS - 22.03.2012

umm it works with sendclientmessage o.o


Re: list dialog help - Bogdan1992 - 22.03.2012

What is with that DIALOG_MANAGEWEED+4?


Re: list dialog help - WardenCS - 22.03.2012

DIALOG_MANAGEWEED is dialog id + 4


Re: list dialog help - Bogdan1992 - 22.03.2012

duh i know but do u have something about DIALOG_MANAGEWEED in OnDialogResponse?


Re: list dialog help - WardenCS - 22.03.2012

here it is defined :
Код:
#define DIALOG_MANAGEWEED 4659
and yes i have dialog respeons from dialog_manageweed to dialog_manageweed+3(+1,+2,+3)