Please help me with this format - 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: Please help me with this format (
/showthread.php?tid=474896)
Please help me with this format -
AIped - 10.11.2013
Hello,
I am trying to print this values into a dialog like this;
pawn Код:
format(strings,sizeof(strings), "CrazyCock\t%d\nPizzaStack\t%d\nCluckinBell\t%d",Companies[0][Sold],Companies[1][Sold],Companies[2][Sold]);
ShowPlayerDialog(playerid,BANK_DIALOGID,DIALOG_STYLE_LIST,"Company's sold or not",strings,"Buy","Exit");
This works great!
BUT... Right now the values from 'Companies' will show as 0 or 1.
i want the 0 to be shown as "For Sale" and the 1 to be shown as "Sold". I know that i need to use %s for that but i dont know how to format into a format.
Answers would be just awesome ...thanks in advance
Re: Please help me with this format -
iZN - 10.11.2013
pawn Код:
format(strings, sizeof(strings),
"CrazyCock\t%s\nPizzaStack\t%s\nCluckinBell\t%s",
(Companies[0][Sold] == 0 ? ("For Sale") : ("Sold")),
(Companies[1][Sold] == 0 ? ("For Sale") : ("Sold")),
(Companies[2][Sold] == 0 ? ("For Sale") : ("Sold"))
);
ShowPlayerDialog(playerid,BANK_DIALOGID,DIALOG_STYLE_LIST,"Company's sold or not",strings,"Buy","Exit");
Re: Please help me with this format -
-Prodigy- - 10.11.2013
Try this:
pawn Код:
format(strings,sizeof(strings), "CrazyCock\t%s\nPizzaStack\t%s\nCluckinBell\t%s", (Companies[0][Sold] == 0) ? ("For Sale") : ("Sold"), (Companies[1][Sold] == 0) ? ("For Sale") : ("Sold"), (Companies[2][Sold] == 0) ? ("For Sale") : ("Sold"));
ShowPlayerDialog(playerid,BANK_DIALOGID,DIALOG_STYLE_LIST,"Company's sold or not",strings,"Buy","Exit");
Re: Please help me with this format -
AIped - 10.11.2013
For the looks of it (both of the answers), it seems logical but i get these errors;
pawn Код:
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
EDIT: NVM FIXED!!!
Thanks both of you
Re: Please help me with this format -
-Prodigy- - 10.11.2013
I edited my post