OnPlayerText, need advice. +pictures
#1

OK so when you do command for example : "/mdc" textdraw box appears with other textdraws in the box ordered by number.
The textdraws which ordered by numbers are options for the players. example : 1 - Registered houses" -
( Look at the picture below and you will understand )

My question is : The player chooses one of the textdraw options by inserting number between 1-24,
can be found on script under OnPlayerText -- > Code below
pawn Код:
if(Showing[playerid])
  {
    new x = strval(text);
    if(x < 1 || x > 24) return 0;
    switch(x)
    {
      case 1: ShowPlayerDialog(playerid, DialogHouses, DIALOG_STYLE_INPUT, "MDC/Registered houses:", "Type in the name of the suspect", "Search", "Cancel");
      case 2: ShowPlayerDialog(playerid, DialogBusinesses, DIALOG_STYLE_INPUT, "MDC/Registered business:", "Ype in the name of the suspect", "Search", "Cancel");
      case 3: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 4: ShowPlayerDialog(playerid, DialogVehicles, DIALOG_STYLE_INPUT, "MDC/Registered vehicles:", "Type in a name to get information", "Continue", "Cancel");
      case 5: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 6: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 7: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 8: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 9: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 10: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 11: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 12: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 13: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 14: ShowPlayerDialog(playerid, DialogRecord, DIALOG_STYLE_INPUT, "MDC/Convictions:", "Type the name of the suspect", "Search", "Cancel");
      case 15: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 16: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 17: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 18: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 19: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 21: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 22: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 23: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      case 24: SendClientMessage(playerid, COLOR_LIGHTGREY, "Option is unavailable at the moment.");
      default: SendClientMessage(playerid, 0xFF0000FF, "You must insert a number between 1 and 24!");
    }
    return 0;
  }
  return 0;
}


What I wanna do is when player types in 1-24 it wont write on chat the number he has choosen.

If some one have idea share please Thanks!
Reply
#2

Use OnDialogResponse
Reply
#3

I'm also using OnDialogResponse for it.
Reply
#4

Is this above your other if statement? You have multiple don't you?


Here's an example;

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Muted[playerid]) {
        SendClientMessage(playerid, 0xCC0000AA, "You're muted, wait until you're unmuted.");
        return 0;
    }
    if(Showing[playerid]) {
        //...
        return 0;
    }
    if(AnotherTextInputNeeded[playerid]) {
        //Same as above, it needs to be before our client messages to stop it from sending.
        return 0;
    }
    //We put this above because we don't want our new custom text below to show when they type something.
   
    new string[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s says, \"%s\"", name, text);
    SendClientMessageToAll(0xCCCCCCAA, string);
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)