Need Help with Dialog
#1

Need to fix brackets
Код:
if(dialogid == 9999)
{
	if(response)
	{
	switch(listitem)
	{
		case 0:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1073); //Shadow
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Shadow Tires");
		}
		case 1:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1074); //Mega
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Mega Tires");
		}
		case 2:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1053); //Rimshine
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Rimshine Tires");
		}
		case 3:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1076); //Wires
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Wires Tires");
		}
		case 4:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1077); //Classic
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Classic Tires");
		}
		case 5:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1078); //Twist
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Twist Tires");
		}
		case 6:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1079); //Cutter
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Cutter Tires");
		}
		case 7:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1080); //Switch
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Switch Tires");
		}
		case 8:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1081); //Grove
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Grove Tires");
		}
		case 9:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1082); //Import
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Import Tires");
		}
		case 10:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1083); //Dollar
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Dollar Tires");
		}
		case 11:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1084); //Trance
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Trance Tires");
		}
		case 12:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1085); //Atomic
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Atomic Tires");
		}
		case 13:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1096); //Ahab
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Ahab Tires");
		}
		case 14:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1097); //Virtual
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Virtual Tires");
		}
		case 15:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1098); //Access
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Access Tires");
		}
		case 16:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1025); //Offroad
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Offroad Tires");
			return 1;
		}
	}
Can u fix the brackets please
Reply
#2

Quote:
Originally Posted by San1
Посмотреть сообщение
Need to fix brackets
Код:
if(dialogid == 9999)
{
	if(response)
	{
	switch(listitem)
	{
		case 0:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1073); //Shadow
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Shadow Tires");
		}
		case 1:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1074); //Mega
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Mega Tires");
		}
		case 2:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1053); //Rimshine
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Rimshine Tires");
		}
		case 3:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1076); //Wires
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Wires Tires");
		}
		case 4:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1077); //Classic
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Classic Tires");
		}
		case 5:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1078); //Twist
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Twist Tires");
		}
		case 6:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1079); //Cutter
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Cutter Tires");
		}
		case 7:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1080); //Switch
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Switch Tires");
		}
		case 8:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1081); //Grove
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Grove Tires");
		}
		case 9:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1082); //Import
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Import Tires");
		}
		case 10:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1083); //Dollar
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Dollar Tires");
		}
		case 11:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1084); //Trance
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Trance Tires");
		}
		case 12:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1085); //Atomic
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Atomic Tires");
		}
		case 13:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1096); //Ahab
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Ahab Tires");
		}
		case 14:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1097); //Virtual
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Virtual Tires");
		}
		case 15:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1098); //Access
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Access Tires");
		}
		case 16:
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid),1025); //Offroad
			SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Offroad Tires");
			return 1;
		}
	}
Can u fix the brackets please
What is the error?
Reply
#3

What would be the point? If I fix the identation for you, what will you learn? It's simple really. After every open brace { you indent all the code in that block with 1 tab. After every closing brace } you go back, 1 tab.
Reply
#4

pawn Код:
if(dialogid == 199)
{
    if(response)
    {
    switch(listitem)
    {
        case 0:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1073); //Shadow
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Shadow Tires");
        }
        case 1:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1074); //Mega
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Mega Tires");
        }
        case 2:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1053); //Rimshine
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Rimshine Tires");
        }
        case 3:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1076); //Wires
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Wires Tires");
        }
        case 4:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1077); //Classic
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Classic Tires");
        }
        case 5:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1078); //Twist
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Twist Tires");
        }
        case 6:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1079); //Cutter
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Cutter Tires");
        }
        case 7:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1080); //Switch
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Switch Tires");
        }
        case 8:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1081); //Grove
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Grove Tires");
        }
        case 9:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1082); //Import
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Import Tires");
        }
        case 10:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1083); //Dollar
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Dollar Tires");
        }
        case 11:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1084); //Trance
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Trance Tires");
        }
        case 12:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1085); //Atomic
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Atomic Tires");
        }
        case 13:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1096); //Ahab
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Ahab Tires");
        }
        case 14:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1097); //Virtual
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Virtual Tires");
        }
        case 15:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1098); //Access
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Access Tires");
        }
        case 16:
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid),1025); //Offroad
            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Offroad Tires");
            return 1;
        }
    }
}
If you use dialog id above 32767 it will not work as 32767 is the max dialog id.
This was the problem, there were 3 {'s in the starting but there were only 2 }'s so it took me about 3 seconds to realize there was another } absent, please try and solve your problems by yourself sometimes too.
Good luck.
Reply
#5

I fix some of it but it comes up with a error still imma attempt more times
Reply
#6

Its not working and i got this

Код:
        if(dialogid == 199)
	{
    	        if(response)
		{
		switch(listitem)
    		{
	        case 0:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1073); //Shadow
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Shadow Tires");
	        }
	        case 1:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1074); //Mega
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Mega Tires");
	        }
	        case 2:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1053); //Rimshine
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Rimshine Tires");
	        }
	        case 3:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1076); //Wires
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Wires Tires");
	        }
	        case 4:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1077); //Classic
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Classic Tires");
	        }
	        case 5:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1078); //Twist
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Twist Tires");
	        }
	        case 6:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1079); //Cutter
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Cutter Tires");
	        }
	        case 7:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1080); //Switch
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Switch Tires");
	        }
	        case 8:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1081); //Grove
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Grove Tires");
	        }
	        case 9:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1082); //Import
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Import Tires");
	        }
	        case 10:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1083); //Dollar
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Dollar Tires");
	        }
	        case 11:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1084); //Trance
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Trance Tires");
	        }
	        case 12:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1085); //Atomic
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Atomic Tires");
	        }
	        case 13:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1096); //Ahab
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Ahab Tires");
	        }
	        case 14:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1097); //Virtual
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Virtual Tires");
	        }
	        case 15:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1098); //Access
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Access Tires");
	        }
	        case 16:
	        {
	            AddVehicleComponent(GetPlayerVehicleID(playerid),1025); //Offroad
	            SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Offroad Tires");
	            return 1;
	        }
	    }
 	}
Reply
#7

I've re-written the whole code for you and now i'm pretty sure it works.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 199) {
        if(response) {
            switch(listitem) {
            case 0:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1073),
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Shadow Tires");
            case 1:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1074), //Mega
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Mega Tires");

            case 2:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1053), //Rimshine
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Rimshine Tires");

            case 3:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1076), //Wires
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Wires Tires");

            case 4:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1077), //Classic
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Classic Tires");

            case 5:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1078), //Twist
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Twist Tires");

            case 6:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1079), //Cutter
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Cutter Tires");
               
            case 7:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1080), //Switch
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Switch Tires");

            case 8:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1081), //Grove
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Grove Tires");

            case 9:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1082), //Import
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Import Tires");

            case 10:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1083), //Dollar
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Dollar Tires");

            case 11:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1084), //Trance
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Trance Tires");

            case 12:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1085), //Atomic
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Atomic Tires");

            case 13:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1096), //Ahab
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Ahab Tires");

            case 14:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1097), //Virtual
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Virtual Tires");

            case 15:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1098), //Access
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Access Tires");

            case 16:
                AddVehicleComponent(GetPlayerVehicleID(playerid),1025), //Offroad
                SendClientMessage(playerid, COLOR_ORANGE, "You have got changed your tires to Offroad Tires");
        }
    }
}
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)