[HELP] Dialog Problem
#1

Alright, first of all, a Mobile Data Computer is a computer that the Police is using to find information about suspects.
What I want this to do is, be able to search on player ID's and find information about him or her.

This is how it looks like at the moment:

Code:
	if(strcmp(cmd, "/mdc", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(gTeam[playerid] == 2 || gTeam[playerid] == 3)
			{
	    		ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Mobile Data Computer", "Search by Name (( ID ))", "OK", "Log Out");
			}
		}
		return 1;
	}
When you hit OK on the Search by Name (( ID )) a INPUT style dialog should appear and you should be able to type a online player ID and it will search for him or her.

The information I want it to show is PlayerInfo[playerid][pCarWarn];

If you got no idea what I mean, just ask.

Thanks
Reply
#2

Under OnDialogResponse callback check if it's the correct dialogid and if they selected the "Ok" button.

So so, then format a message and send it to them with the data of PlayerInfo[selectedplayerid][pCarWarn];

Or am I completely missing your question?
Reply
#3

And change DIALOG_STYLE_LIST to DIALOG_STYLE_INPUT
Reply
#4

Quote:
Originally Posted by Nero_3D
View Post
And change DIALOG_STYLE_LIST to DIALOG_STYLE_INPUT
Hmm, let me do a example in detail:

1. /mdc
2. A LIST dialog appears.
3. Selects Search by Name (( ID )) and hits OK
4. A INPUT dialog appears
5. Enters a player ID and hits search
6. Then a MSGBOX should appear with the players information about the PlayerInfo.

That's something how I want it to look like.
Reply
#5

Why would you need them to select the ID then enter the ID?

[This forum requires that you wait 120 seconds between posts. Please try again in 76 seconds.] - fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
Reply
#6

Quote:
Originally Posted by Grim_
View Post
Why would you need them to select the ID then enter the ID?

[This forum requires that you wait 120 seconds between posts. Please try again in 76 seconds.] - fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
Are you kidding me... serious answers please. -.-

You don't select the ID, you select "Search by Name (( ID ))" then you type down the player's id in the INPUT dialog.

Picture:

Reply
#7

I ask a simple question and you act stupid.

It'd help me to understand the system you want me to help you with..

[This forum requires that you wait 120 seconds between posts. Please try again in 60 seconds.] - My god.
Reply
#8

Quote:
Originally Posted by Grim_
View Post
I ask a simple question and you act stupid.

It'd help me to understand the system you want me to help you with..

[This forum requires that you wait 120 seconds between posts. Please try again in 60 seconds.] - My god.
Well now, if you can help me, please help, if you can't, leave it to someone else...

And you maybe didn't know, the "(( ))" means OOC, that means Out of Character in Roleplay scripts.
Reply
#9

Yes, I know..

1. Use OnDialogResponse to see if the player selected "Ok" (On the first dialog) with "Select by name" selected
2. Then Show a new dialog DIALOG_STYLE_INPUT where they will input the ID
3. Use OnDialogResponse to check if they click "Ok" (Second dialog now) and if the ID is connected, if so
4. Format the data of that player and display it in another dialog DIALOG_STLYE_MSGBOX
Reply
#10

Quote:
Originally Posted by Grim_
View Post
Yes, I know..

1. Use OnDialogResponse to see if the player selected "Ok" (On the first dialog) with "Select by name" selected
2. Then Show a new dialog DIALOG_STYLE_INPUT where they will input the ID
3. Use OnDialogResponse to check if they click "Ok" (Second dialog now) and if the ID is connected, if so
4. Format the data of that player and display it in another dialog DIALOG_STLYE_MSGBOX
Yeah... that was in text, I need to see how the code would look like, this is the second time I'm dealing with Dialogs, I successfully created a register system woth it but I don't get this...
Reply
#11

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if(dialogid == /*first dialog ID*/)
   {
      if(listitem == /*listitemID of the "Select by Name", they start with 0*/)
      {
         if(response)
         {
            ShowPlayerDialog(playerid, ID,  DIALOG_STYLE_INPUT, "Mobile Data Computer", "Insert the Player Name ((ID))", "Ok", "Log Out");
         }
      }
   }
   else if(dialogid == /* id of second*/)
   {
      if(response)
      {
         if(!IsPlayerConnected(strval(inputtext)) return 1;
         new string[100];
         format(string, sizeof(string), "Data: %d", PlayerData[strval(inputtext)][pCarWarn]);
         ShowPlayerDialog(playerid, ID, DIALOG_STYLE_MSGBOX, "Mobile Data Computer", string, "Ok", "Log out");
      }
   }
   return 1;
}
A short example.
Reply
#12

Quote:
Originally Posted by Grim_
Посмотреть сообщение
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if(dialogid == /*first dialog ID*/)
   {
      if(listitem == /*listitemID of the "Select by Name", they start with 0*/)
      {
         if(response)
         {
            ShowPlayerDialog(playerid, ID,  DIALOG_STYLE_INPUT, "Mobile Data Computer", "Insert the Player Name ((ID))", "Ok", "Log Out");
         }
      }
   }
   else if(dialogid == /* id of second*/)
   {
      if(response)
      {
         if(!IsPlayerConnected(strval(inputtext)) return 1;
         new string[100];
         format(string, sizeof(string), "Data: %d", PlayerData[strval(inputtext)][pCarWarn]);
         ShowPlayerDialog(playerid, ID, DIALOG_STYLE_MSGBOX, "Mobile Data Computer", string, "Ok", "Log out");
      }
   }
   return 1;
}
A short example.
if(!IsPlayerConnected(strval(inputtext)) return 1;

expected token: ")", but found "return"
Reply
#13

Quote:
Originally Posted by Fredden1993
Посмотреть сообщение
if(!IsPlayerConnected(strval(inputtext)) return 1;

expected token: ")", but found "return"
Like the compiler says he expected a ")" but found "return"

So he wants a ")" before the "return"
Reply
#14

I lol'd

Yeah, add an extra parenthesis
pawn Код:
if(!IsPlayerConnected(strval(inputtext))) return 1;
Reply
#15

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Like the compiler says he expected a ")" but found "return"

So he wants a ")" before the "return"
Cool it works, but before I lave the project, is there any way to change lines so it looks like this in the MSG Box?

Driving License:
Firearms License:
Pilot License:
Driver Warnings:
Reply
#16

Quote:
Originally Posted by Fredden1993
Посмотреть сообщение
Cool it works, but before I lave the project, is there any way to change lines so it looks like this in the MSG Box?

Driving License:
Firearms License:
Pilot License:
Driver Warnings:
Use \r\n to create a new line

pawn Код:
"Driving License:\r\n\
 Firearms License:\r\n\
 Pilot License:\r\n\
 Driver Warnings:\r\n"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)