Is it possible?
#1

Hi.
I was wondering if it was possible to make a dialog that has a changeable string
pawn Код:
new string[128];
format(string,sizeof(string),"Nitro\n Restore health\n Give Armor");
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Somathing",string,"Ok","Cancle");
Nitro will show up only if you are in a vehicle otherwise the string would look like this
pawn Код:
format(string,sizeof(string),"Restore health\n Give Armor");
Is it possible to make this without making two dialogs?
Thanks
Reply
#2

Yes it is.
Reply
#3

Sure, format.
Reply
#4

ty. Any other way beside creating a new string for each change?
Reply
#5

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
ty. Any other way beside creating a new string for each change?
You only need one string, just use format().
Reply
#6

ok ty
Reply
#7

Do you mean something like this:
pawn Код:
new string[128];
if(IsPlayerInAnyVehicle(playerid))
{
   string = "Nitro\n Restore Health\n Give Armor";
} else {
   string = "Restore Health\n Give Armor";
}
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Somathing",string,"Ok","Cancle");
You don't have to use format for those things.

At OnDialogResponse:
pawn Код:
if(dialogid == 1)
{
   if(!response) return 1;
   if(IsPlayerInAnyVehicle(playerid))
   {
       if(listitem == 0) //Nitro
       {
           //Code here
       }
       if(listitem == 1) //Restore Health
       {
           // Code here
       }
       if(listitem == 2) // Give armor
       {
           // Code here
        }
        return 1;
    }
    else
    {
        if(listitem == 0) //Restore health
        {
            //code here
        }
        if(listitem == 1) // Give armor
        {
             //code here
        }
        return 1;
     }
     return 1;
}
Reply
#8

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Do you mean something like this:
pawn Код:
new string[128];
if(IsPlayerInAnyVehicle(playerid))
{
   string = "Nitro\n Restore Health\n Give Armor";
} else {
   string = "Restore Health\n Give Armor";
}
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Somathing",string,"Ok","Cancle");
You don't have to use format for those things.
That will give tag mismatch warnings.
Reply
#9

Quote:
Originally Posted by admantis
Посмотреть сообщение
That will give tag mismatch warnings.
No, it won't. Give me any reason why it would give a mismatch warning.
Reply
#10

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
No, it won't. Give me any reason why it would give a mismatch warning.
My bad, I didn't really read well the code.. but you can use format() to set the string as well.
So I apologize then.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)