problem in /newbie chat
#1

i have problem in my script
Код:
CMD:n(playerid, params[])
{
     ShowPlayerDialog(playerid, DIALOG_NEWBIE, DIALOG_STYLE_LIST, "{FF0000}Newbie Chat", "{FF0000}1. {FFFFFF}Question\n{FF0000}2. {FFFFFF}Answer", "Choose", "Close");
     return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
 if(dialogid == DIALOG_NEWBIE)
 {
 if(!response)return 0;
 if(response)
    {
      if(listitem == 0)return ShowPlayerDialog(playerid, Dialogquestion, DIALOG_STYLE_INPUT, "Change {FF0000}Question", "Enter your Question here :", "Enter", "Back");
      if(listitem == 1)return ShowPlayerDialog(playerid, Dialoganswer, DIALOG_STYLE_INPUT, "Change {FF0000}Answer", "Enter your Answer here :", "Enter", "Back");
   }
   }
   if(dialogid == Dialogquestion)
   {
     if(!response)return  ShowPlayerDialog(playerid, DIALOG_NEWBIE, DIALOG_STYLE_LIST, "{FF0000}Newbie Chat", "{FF0000}1. {FFFFFF}Question\n{FF0000}2. {FFFFFF}Answer", "Choose", "Close");
     if(response)
        {
        if(!Newbie_status) return SendClientMessage(playerid, COLOR_WHITE, "{0000CD}[SERVER]: {FFFFFF}Newbie chat is disabled.");
        new question[200];
        format(question, sizeof(question),"{87CEEB}[Question] %s : %s", GetPlayerNameEx(playerid), inputtext);
        SendClientMessageToAll(-1, question);
        }
   }
   if(dialogid == Dialoganswer)
   {
	 if(!response)return  ShowPlayerDialog(playerid, DIALOG_NEWBIE, DIALOG_STYLE_LIST, "{FF0000}Newbie Chat", "{FF0000}1. {FFFFFF}Question\n{FF0000}2. {FFFFFF}Answer", "Choose", "Close");
	 if(response)
		{
		if(!Newbie_status) return SendClientMessage(playerid, COLOR_WHITE, "{0000CD}[SERVER]: {FFFFFF}Newbie chat is disabled.");
		new answer[200];
		if(IsPlayerAdmin (playerid)) format(answer, sizeof(answer),"{87CEEB}[Answer] Admin %s : %s", GetPlayerNameEx(playerid), inputtext);
		else format(answer, sizeof(answer),"{87CEEB}[Answer]%s : %s", GetPlayerNameEx(playerid), inputtext);
		SendClientMessageToAll(-1, answer);
		}
	}
	return 1;
}
but the output in Game this :
[Question] Callaghane Geraldan : hai.
[Answer] Callaghane Geraldan : hai.
they come out with the same

I want them out of the one in accordance with our selection in the dialog
example:
if i say /n = [Question] Callaghane Geraldan : hai.

others respond to a message I like this

other player say /n = [Answer] Jenifer Abigail : hai too.

can you help me




# sorry for my bad english
Reply
#2

You're starting with something too advanced, start with something easier.
Reply
#3

thanks for your suggestion, but I wonder why the question and answer appear together but already there are respectively the dialogue.

please help!

#sorry for my bad english
Reply
#4

Read about Variables and Index them. One variable holds the question and the another holds the answer.

PHP код:
#undef MAX_PLAYERS
    #define MAX_PLAYERS (10) // server total slots....
#define QUESTION_LENGTH (100) // question string length
#define ANSWER_LENGTH (100) // answer string length
new Question[MAX_PLAYERS][QUESTION_LENGTH],
    
Answer[MAX_PLAYERS][ANSWER_LENGTH]; // variables to hold the question and the answer respectively.
CMD:n(playerid) return cmd_newbie(playerid);
CMD:newbie(playerid) {
    
ShowPlayerDialog(playeridDIALOG_NEWBIEDIALOG_STYLE_LIST"{FF0000}Newbie Chat""{FF0000}1. {FFFFFF}Question\n{FF0000}2. {FFFFFF}Answer""Choose""Close");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {
    switch(
dialogid) {
        case 
DIALOG_NEWBIE: {
            if(!
response) return 0;
            if(!
listitemShowPlayerDialog(playeridDialogquestionDIALOG_STYLE_INPUT"Change {FF0000}Question""Enter your Question here :""Enter""Back");
            else 
ShowPlayerDialog(playeridDialoganswerDIALOG_STYLE_INPUT"Change {FF0000}Answer""Enter your Answer here :""Enter""Back");
        }
    }
    return 
1;

Reply
#5

I think you defined both dialog ids (question and answer ) as same check it. And also use switch instead of if structures
Reply
#6

so how the whole of this script?
Reply
#7

please help
Reply
#8

Show your definition of the dialog ids, it should look like this:

Код:
#define DIALOG_NEWBIE 1
#define Dialogquestion 2
Copy the ones from your gamemode and show them here.
Reply
#9

i only use
Quote:

#define DIALOG_NEWBIE 999

Reply
#10

where is then this "Dialogquestion" defined?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)