cmd problem
#1

Why this code returns: Unknown command?

pawn Код:
.--------------------------.
    new stringaz[300];
    new stringaz2[128];
   
    for(new i=0;i<=100; i++)
    {
        format(stringaz2,sizeof(stringaz2),"{F58C5B}1.{FFFFFF}%s",i,gps_name[i]);
        strins(stringaz,stringaz2,strlen(stringaz),sizeof(stringaz));
        if(i!=100)
        strins(stringaz,"\n",strlen(stringaz),sizeof(stringaz));
    }
    ShowPlayerDialog(playerid,GPSDIALOG,DIALOG_STYLE_LIST,"Select",stringaz,"Go","Close");
    return 1;
.--------------------------.
Reply
#2

Show full code please.
And you need add a bracket after the return.
Reply
#3

pawn Код:
YCMD:gps(playerid, params[], help)
{
    #pragma unused params
    #pragma unused help
    new stringaz[300];
    new stringaz2[128];

    for(new i=0;i<=100; i++)
    {
        format(stringaz2,sizeof(stringaz2),"%d.%s",i,gps_name[i]);
        if(i!=100)
        strins(stringaz,"\n",strlen(stringaz),sizeof(stringaz));
    }
    ShowPlayerDialog(playerid,GPSDIALOG,DIALOG_STYLE_LIST,"Place",stringaz,"Go","Close");
    return 1;
}
Reply
#4

pawn Код:
YCMD:gps(playerid, params[], help)
{
    #pragma unused params
    if (help) return SendClientMessage(playerid, -1, "Help:");
    new stringaz[256];
    new stringaz2[128];

    for(new i=0;i<=100; i++)
    {
        format(stringaz2,sizeof(stringaz2),"%d.%s",i,gps_name[i]);
        if(i!=100)
        strins(stringaz,"\n",strlen(stringaz),sizeof(stringaz));
    }
    ShowPlayerDialog(playerid,GPSDIALOG,DIALOG_STYLE_LIST,"Place",stringaz,"Go","Close");
    return 1;
}
Reply
#5

You'll requre quite a long string to insert everything.

pawn Код:
YCMD:gps(playerid, params[], help)
{
    #pragma unused params
    new listitems[512], singleitem[64];

    for(new i=0;i<=100; i++)
    {
        format(singleitem,sizeof(singleitem),"\n%d. %s",i,gps_name[i]);
        strcat(listitems, singleitem, sizeof listitems);
    }
    ShowPlayerDialog(playerid,GPSDIALOG,DIALOG_STYLE_LIST,"Place",listitems,"Go","Close");
    return 1;
}
Reply
#6

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
You'll requre quite a long string to insert everything.

pawn Код:
YCMD:gps(playerid, params[], help)
{
    #pragma unused params
    new listitems[512], singleitem[64];

    for(new i=0;i<=100; i++)
    {
        format(singleitem,sizeof(singleitem),"\n%d. %s",i,gps_name[i]);
        strcat(listitems, singleitem, sizeof listitems);
    }
    ShowPlayerDialog(playerid,GPSDIALOG,DIALOG_STYLE_LIST,"Place",listitems,"Go","Close");
    return 1;
}
won't work :\
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)