list dialog help
#1

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

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

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

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

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

and tell what it says.
Reply
#6

umm it works with sendclientmessage o.o
Reply
#7

What is with that DIALOG_MANAGEWEED+4?
Reply
#8

DIALOG_MANAGEWEED is dialog id + 4
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)