Help with on dialog response
#1

Hello, i've been working on a new death match and all is well, it's just this response, it all works fine, it's just not teleporting me nor giving me a weapon when i press yes on the dialog, i am not that good with responses, so this is me trying to learn it.
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
        {
            switch(dialogid == Deathmatch)
           {
               case 1:
               {
                    switch(listitem)
                    {
                         case 0:
                         {
                          ShowPlayerDialog(playerid, LSDM, DIALOG_STYLE_MSGBOX, "LS carpark DM", "You have chosen LS carpark DM, do you want to start the death match?", "Yes", "No");
                         }
                         case 1:
                         {
                          ShowPlayerDialog(playerid, LVDM, DIALOG_STYLE_MSGBOX, "LV warehouse DM", "You have chosen LV warehouse DM, do you want to start the death match?", "Yes", "No");
                         }
                         case 2:
                         {
                         ShowPlayerDialog(playerid, SFDM, DIALOG_STYLE_MSGBOX, "SF tennis courts DM", "You have chosen SF tennis courts DM, do you want to start the death match?", "Yes", "No");
                         {
                         if(dialogid == LSDM)
                         {
                         if(response)
                         {
                         new string[240];
                         format(string, sizeof(string), "has started LS carpark deathmatch, type /dm to join!");
                         SendClientMessageToAll(-1, string);
                         SetPlayerPos(playerid, 2798.2031,-1465.9199,24.1875);
                         GivePlayerWeapon(playerid, 28, 999999);
                         SetPlayerHealth(playerid, 100);
                         }
                         }
                         }

                    }
                }
            }
        }
}
    return 1;
}
If you can tell me where i am going wrong that would be great, thank you!
Reply
#2

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)// SWITCHES BETWEEN THE DIALOG IDS
    {
        case Deathmatch:// DIALOG ID
        {
            if(response) // IF PLAYER CLICKED POSITIVE "YES"
            {
                switch(listitem)// SWITCHES BEETWEEN THE DIALOG ROWS LISTITEMS
                {
                    case 0:// LISTITEM 1
                    {
                        ShowPlayerDialog(playerid, LSDM, DIALOG_STYLE_MSGBOX, "LS carpark DM", "You have chosen LS carpark DM, do you want to start the death match?", "Yes", "No");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid, LVDM, DIALOG_STYLE_MSGBOX, "LV warehouse DM", "You have chosen LV warehouse DM, do you want to start the death match?", "Yes", "No");
                    }
                    case 2:
                    {
                        ShowPlayerDialog(playerid, SFDM, DIALOG_STYLE_MSGBOX, "SF tennis courts DM", "You have chosen SF tennis courts DM, do you want to start the death match?", "Yes", "No");
                    }
                }
            }
        }
        case LSDM: // ANOTHER DIALOGID THAT IS CALLED
        {
            if(response)
            {
                //CODE HERE
            }
        }
        case LVDM:
        {
            if(response)
            {
                //CODE HERE
            }
        }
        case SFDM:
        {
            if(response)
            {
                //CODE HERE
            }
        }
    }
    return 1;
}
Reply
#3

Yeah, i'm getting these errors
Quote:

C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : warning 217: loose indentation
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : error 014: invalid statement; not in switch
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : warning 215: expression has no effect
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : error 001: expected token: ";", but found ":"
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : error 029: invalid expression, assumed zero
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMat ch.pwn(224) : fatal error 107: too many error messages on one line

Reply
#4

Uh compiles fine for me..

Give me the code on that line and one line above it.
Reply
#5

Code:
       	case LSDM: // ANOTHER DIALOGID THAT IS CALLED
        {
            if(response)
            {
                		 new string[240];
						 format(string, sizeof(string), "has started LS carpark deathmatch, type /dm to join!");
 						 SendClientMessageToAll(-1, string);
   					     SetPlayerPos(playerid, 2798.2031,-1465.9199,24.1875);
        			  	 GivePlayerWeapon(playerid, 28, 999999);
						 SetPlayerHealth(playerid, 100);
            }
        }
full code
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
        {
            switch(dialogid == Deathmatch)
           {
               case 1:
               {
                    switch(listitem)
                    {
                         case 0:
                         {
                          ShowPlayerDialog(playerid, LSDM, DIALOG_STYLE_MSGBOX, "LS carpark DM", "You have chosen LS carpark DM, do you want to start the death match?", "Yes", "No");
                         }
                         case 1:
                         {
                          ShowPlayerDialog(playerid, LVDM, DIALOG_STYLE_MSGBOX, "LV warehouse DM", "You have chosen LV warehouse DM, do you want to start the death match?", "Yes", "No");
                         }
                         case 2:
                         {
                         ShowPlayerDialog(playerid, SFDM, DIALOG_STYLE_MSGBOX, "SF tennis courts DM", "You have chosen SF tennis courts DM, do you want to start the death match?", "Yes", "No");
                         }
                         }
                         }

                    }
                }
        case LSDM: // ANOTHER DIALOGID THAT IS CALLED
        {
            if(response)
            {
                         new string[240];
                         format(string, sizeof(string), "has started LS carpark deathmatch, type /dm to join!");
                         SendClientMessageToAll(-1, string);
                         SetPlayerPos(playerid, 2798.2031,-1465.9199,24.1875);
                         GivePlayerWeapon(playerid, 28, 999999);
                         SetPlayerHealth(playerid, 100);
            }
        }
        /*case LVDM:
        {
            if(response)
            {
                //CODE HERE
            }
        }
        case SFDM:
        {
            if(response)
            {
                //CODE HERE
            }*/

        }
    return 1;
}
Reply
#6

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])// DON'T TOUCH ANYTHING
{
    switch(dialogid)// SWITCHES BETWEEN THE DIALOG IDS
    {
        case Deathmatch:// DIALOG ID
        {
            if(response) // IF PLAYER CLICKED POSITIVE "YES"
            {
                switch(listitem)// SWITCHES BEETWEEN THE DIALOG ROWS LISTITEMS
                {
                    case 0:// LISTITEM 1
                    {
                        ShowPlayerDialog(playerid, LSDM, DIALOG_STYLE_MSGBOX, "LS carpark DM", "You have chosen LS carpark DM, do you want to start the death match?", "Yes", "No");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid, LVDM, DIALOG_STYLE_MSGBOX, "LV warehouse DM", "You have chosen LV warehouse DM, do you want to start the death match?", "Yes", "No");
                    }
                    case 2:
                    {
                        ShowPlayerDialog(playerid, SFDM, DIALOG_STYLE_MSGBOX, "SF tennis courts DM", "You have chosen SF tennis courts DM, do you want to start the death match?", "Yes", "No");
                    }
                }
            }
        }
        case LSDM: // ANOTHER DIALOGID THAT IS CALLED
        {
            if(response)
            {
                new string[240];
                format(string, sizeof(string), "has started LS carpark deathmatch, type /dm to join!");
                SendClientMessageToAll(-1, string);
                SetPlayerPos(playerid, 2798.2031,-1465.9199,24.1875);
                GivePlayerWeapon(playerid, 28, 999999);
                SetPlayerHealth(playerid, 100);
            }
        }
        case LVDM:
        {
            if(response)
            {
                //CODE HERE
            }
        }
        case SFDM:
        {
            if(response)
            {
                //CODE HERE
            }
        }
    }
    return 1;
}
You don't need if(response) at the beginning and the switch statement is used for 'switching' so you use it as switch(parameter) you did it wrong as doing switch(parameter == Deathmatch)

Also you need to read tutorials to learn how to use these.
Reply
#7

Ah, thank you!
Reply
#8

Sorry, need some more help on something else, i have been trying to make it stop having mutiple death matches on at the same time so i've made it so if there is a death match on, you can't make one, but i keep getting this error:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == DeathMatch)
    {
    if(Deathmatchon == true) return SendClientMessage(playerid, -1, "There is already a death match on!");
    ShowPlayerDialog(playerid, Deathmatch, DIALOG_STYLE_LIST, "DeathMatch list", "LS carpark DM\nLV warehouse DM\nSF tennis courts" , "Yes", "No"); // Add more if you want!
    }
    return 1;
}
Error:
Code:
C:\Users\BLACK\Desktop\Test\filterscripts\DeathMatch.pwn(133) : error 033: array must be indexed (variable "Deathmatchon")
This is what i've got defined at the top:

Quote:

new Deathmatchon[MAX_PLAYERS];

I don't know if it was meant to be MAX_PLAYERS or not, would be great if someone could help me, thank you
Reply
#9

You need to declare a Pickup.

like:
pickupdeathmatch = CreatePickup(...

and also add new pickupdeathmatch;

Then in that callback you check if the player picked up that pickup with the id.

Code:
if(pickupid == pickupdeathmatch)
{
//CODE
}
Reply
#10

I already have that, I needed to block them if there was another death match on, so there isn't multiple dms at a time
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)