GUI Forcing Back
#1

Hello there,

I want to make such a GUI that if you press Cancel, it says ''Invalid selection, please choose one and press OK'' and returns you to the GUI list back. Is that possible? This is my code...

Код:
public OnPlayerSpawn(playerid)
{
	ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your spawn place...", "Blueberry\nFort Carson\nMontgomery\nPalomino Creek\nDillimore\nHampton Barns", "OK", "Cancel");
	return 1;
	}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{
  if (dialogid == 1) 
  {
    if (response == 1) 
    {
      switch (listitem)
      {
        case 0:SetPlayerPos(playerid, ...); 
        case 1:SetPlayerPos(playerid, ...); 
        case 2:SetPlayerPos(playerid, ...);
        case 3:SetPlayerPos(playerid, ...);
        case 4:SetPlayerPos(playerid, ...);
        case 5:SetPlayerPos(playerid, ...);
      }
      SendClientMessage(playerid, 0xFFFFFFFF, "You have been spawned at the place of your choice!");
    }
    else
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "Invalid selection, please choose one and press OK to continue.");
    }
    return 1;
  }
  return 0;
}
Reply
#2

Should work. It's a Dialog not a GUI, a GUI is completely different.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{
  if (dialogid == 1) 
  {
    if (response == 1) 
    {
      switch (listitem)
      {
        case 0:SetPlayerPos(playerid, ...); 
        case 1:SetPlayerPos(playerid, ...); 
        case 2:SetPlayerPos(playerid, ...);
        case 3:SetPlayerPos(playerid, ...);
        case 4:SetPlayerPos(playerid, ...);
        case 5:SetPlayerPos(playerid, ...);
      }
      SendClientMessage(playerid, 0xFFFFFFFF, "You have been spawned at the place of your choice!");
    }
    else
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "Invalid selection, please choose one and press OK to continue.");
      ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose your spawn place...", "Blueberry\nFort Carson\nMontgomery\nPalomino Creek\nDillimore\nHampton Barns", "OK", "Cancel");
    }
    return 1;
  }
  return 0;
}
Reply
#3

Init, all these people (mainly Vice City) who say it's not GUI.... IT IS GUI!

The definition of dialog isn't a good example of what DIALOG (in SA-MP) is.
But if you look up the definition of GUI, it will relate to the DIALOG, SA-MP uses.

There's a reason why it's called DIALOG in SA-MP, but just because SA-MP calls it DIALOG, doesn't mean it's not GUI.

Reply
#4

Go tell that to Kye.

Quote:
Originally Posted by Kye
Quote:
Originally Posted by 0rb
sorry Kye, but this gui system sucks. Why not making something fully scriptable?
Who said it was a GUI system? There is a GUI system in the client but these are called script dialogs. If you want to know more about what dialog boxes are search the web. I've never said anything about providing a scriptable GUI system.
Dialog Box
In graphical user interfaces, a dialog (or dialogue) box is a special window, used in user interfaces to display information to the user, or to get a response if needed. They are so-called because they form a dialog between the computer and the user—either informing the user of something, or requesting input from the user, or both. It provides controls that allow you to specify how to carry out an action.

GUI

A GUI offers graphical icons, and visual indicators, as opposed to text-based interfaces, typed command labels or text navigation to fully represent the information and actions available to a user. The actions are usually performed through direct manipulation of the graphical elements.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)