Dialog string -
Richie - 21.11.2011
I need help, i dont know what to search for so.
I have a dialog lets say like this:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tog", "Join Msgs - On \nGlobal Chat - Off", "Tog", "Cancel");
Joining msgs is a player variable that is 0 or 1 if enabled, same with global chat.
But is there a way to set the string in textdraw with 'on' or 'off' according to the joiningmsgs var?
So when i click on 'Join msgs' it will show the same dialog again but with 'Join Msgs - Off'.
Re: Dialog string -
[MG]Dimi - 21.11.2011
Yes. Use
PHP код:
if([Player variable] == 1)
{
ShowPlayerDialog(...);// if it's ON
}
else
{
ShowPlayerDialog(...);// if it's OFF
}
Re: Dialog string -
Richie - 21.11.2011
that could work, but the challenge is that there is many variables in the same dialog.
Join Msgs, Global Chat etc... So if im gonna use that way, it will be a hell alot of if, else if, else if...
Re: Dialog string -
AndreT - 21.11.2011
[MG]Dimi, it couldn't get any worse than that.
What you need is quite simple.
pawn Код:
// I'll just assume your variable names are something like this:
new dialogLine[128];
dialogLine = "Join messages - ";
strcat(dialogLine, (JoinMSGs == true) ? ("on\n") : ("off\n"));
if(GlobalChat == true)
strcat(dialogLine, "Global chat - on\n");
else
strcat(dialogLine, "Global chat - off\n");
// Show the dialog...
And so on...
If the first lines seem confusing to you, it can also be perfectly done like this:
pawn Код:
// I'll just assume your variable names are something like this:
new dialogLine[128];
if(JoinMSGs == true)
strcat(dialogLine, "Join messages - on\n");
else
strcat(dialogLine, "Join messages - off\n");
if(GlobalChat == true)
strcat(dialogLine, "Global chat - on\n");
else
strcat(dialogLine, "Global chat - off\n");
// Show the dialog
Re: Dialog string -
[MG]Dimi - 21.11.2011
Well maybe you could format a lot of messages in one. Like this:
PHP код:
if(variable1) format(option1,sizeof(option1),...);
if(!variable1) format(option1,sizeof(option1),...);
....
format(text,sizoef(text),"%s\n%s\n...",option1,option2...);
ShowPlayerDialog(playerid,dialog,id, dialog_style,cation[],text/*here is last msg we formatted*/,...);
Re: Dialog string -
Richie - 21.11.2011
Thanks all! I used ******'s one, cuz it was the easiest one