Question 4: Strings inside of a list dialogue!
#1

pawn Код:
CMD:inv(playerid, params[])
{
        new string[200];
        format(string, sizeof(string),"Ration: %d",PlayerInfo[playerid][pRation]);
        ShowPlayerDialog(playerid, 6,DIALOG_STYLE_LIST,"Inventory",string,"OK","EXIT");
    return 1;
}

There's a string in that dialogue, there where the contents of the list will be.

HOW DO I: Add another string, to the existing one so there's a list of 2!

For example:


When I go ingame, and type /inv

I get the box titled "Inventory" and it says; Ration: 0
I want it to say:

Ration: 0
Medkit: 0
etc..

So, how do I add another string to the existing one?


I want to add this as another string, what do I have to do?
Do I have to define a new string?


format(string, sizeof(string),"Medkit: %d",PlayerInfo[playerid][pMedkit]);
Reply
#2

Put \n in between your lines.

Edit: like this;

pawn Код:
CMD:inv(playerid, params[])
{
        new string[200];
        format(string, sizeof(string),"Ration: %d\nYour extra thing here: %s",PlayerInfo[playerid][pRation],pName); // Just a poor example and won't work, just giving you the idea of it.
        ShowPlayerDialog(playerid, 6,DIALOG_STYLE_LIST,"Inventory",string,"OK","EXIT");
    return 1;
}
Reply
#3

I tried, it didn't work!
@ Rufio!

EDIT: Will try now what you posted gonna reply asap

Shows:

Ration: 0
Medkit:
without the 0 or anything
Reply
#4

Quote:
Originally Posted by TheTerminator
Посмотреть сообщение
I tried, it didn't work!
@ Rufio!

EDIT: Will try now what you posted gonna reply asap
My example won't work, if that's what you mean. As I said, it was a poor example as if you haven't got "pName" variable scripted, it will give an error.
Reply
#5

It worked, didn't give a number though, like, no numbers just Medkit:

NVM
I think the problem is I didn't add

PlayerInfo[playerid][pMedkit] to the script

Yeah now it worked
Reply
#6

Quote:
Originally Posted by TheTerminator
Посмотреть сообщение
It worked, didn't give a number though, like, no numbers just Medkit:

NVM
I think the problem is I didn't add

PlayerInfo[playerid][pMedkit] to the script
Exactly. Add it and don't forget to change my %s for %d, %s is a string variable whereas %d is an integer variable.

Edit: Glad it did! Feel free to reply if you have got any more questions or concerns.
Reply
#7

didnt checked first reply.... removed!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)