SA-MP Forums Archive
[HELP]ERROR - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]ERROR (/showthread.php?tid=274951)



[HELP]ERROR - TheBluec0de - 07.08.2011

I can say that there wrong here?


Код:
: error 030: compound statement not closed at the end of file (started at line 152)
Код:
//---------------------------------------test

// Teleport System By Nick_Zanna
#include <a_samp>
//Colori
#define COLORE_NERO 0x2C2727AA
#define COLORE_VERDE 0x33AA33AA
#define COLORE_ROSA 0xFF66FFAA
#define COLORE_BLU 0x0000BBAA
#define COLORE_BIANCO 0xFFFFFFAA
#define COLORE_GIALLOCHIARO 0x99FF9900
#define COLORE_GRIGIO 0xAFAFAFAA
#define COLORE_VERDE 0x33AA33AA
#define COLORE_ROSSO 0xAA3333AA
#define COLORE_GIALLO 0xFFFF00AA
#define COLORE_ARANCIONE 0xFF9900AA
#define COLORE_VIOLA 0x990099AA
#define COLORE_MARRONE 0x663300AA
#define COLORE_BLUCHIARO 0x33CCFFAA
#define COLORE_ROSSOSCURO 0x660000AA
#define COLORE_BLUSCURO 0x000066AA

//Dialog
#define DIALOGID 1009

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Teleport System By Nick_Zanna (DON'T REMOVE CREDITS!)");
	print(" Start Filterscripts");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	print("\n--------------------------------------");
	print(" Teleport System By Nick_Zanna (DON'T REMOVE CREDITS!)");
	print(" Stop FilterScript");
	print("--------------------------------------\n");
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/provatele", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Teleport System", "Los Santos\nSan Fierro\nLas Venturas", "Ok", "Esci");
		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    //============================DIALOGO TELETRASPORTI
   	if(dialogid == DIALOGID)
	{
		if(response)
		{
   			if(listitem == 0) // TELE LS
			{
				ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Teles Los Santos", "1. Groove Street\n2. Police Station\n3. El Corona\n4. WillowField\n5. Skate Park\n6. Glen Park\n7. Winewood\n8. Verdant Bluffs\n9. Aeroporto LS", "Ok", "Esci");
			}
   			/*if(listitem == 1) // TELE SF
			{
				ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, " ", " ", "Ok", "Cancella");
			}
   			if(listitem == 2) //TELE LV
			{
				ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, " ", " ", "Ok", "Cancella");
	    }*/
	    }
  		return 1;
	}
	if(dialogid == DIALOGID+1) //TELES LOS SANTOS
	{
		if(response)
		{
		if(listitem == 0) //GROVE STREET
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 2507.4324,-1679.7229,13.5469);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 2507.4324,-1679.7229,13.5469);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 1) //police station
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1510.8280,-1671.2766,14.0469);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1510.8280,-1671.2766,14.0469);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 2) //el corona
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1812.9939,-1886.6304,13.4141);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1812.9939,-1886.6304,13.4141);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 3) //willowfied
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 2451.9905,-2020.5287,13.5469);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 2451.9905,-2020.5287,13.5469);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 4) //willowfied
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1965.3345,-1448.1998,13.4840);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1965.3345,-1448.1998,13.4840);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 5) //glen park
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1900.3505,-1171.6853,24.2914);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1900.3505,-1171.6853,24.2914);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 6) //winewood
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1415.2092,-845.7033,47.6591);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1415.2092,-845.7033,47.6591);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 7) //verdant buffs
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1126.0853,-2036.4387,69.8839);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1126.0853,-2036.4387,69.8839);
	    SetPlayerFacingAngle(playerid, 0);
        }
		if(listitem == 8) //aereoporto ls
		{
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1788.3025,-2423.0300,13.5547);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
        }
        else
        {
        SetPlayerInterior(playerid,0);
	    SetPlayerPos(playerid, 1788.3025,-2423.0300,13.5547);
	    SetPlayerFacingAngle(playerid, 0);
        }
    }
		return 1;
	}
		return 1;
	}



Re: [HELP]ERROR - JaTochNietDan - 07.08.2011

If you had been indenting your code properly you would've noticed that you were missing a bracket under almost every if statement in this snippet of code, here is the fixed version:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    //============================DIALOGO TELETRASPORTI
    if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0) // TELE LS
            {
                ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Teles Los Santos", "1. Groove Street\n2. Police Station\n3. El Corona\n4. WillowField\n5. Skate Park\n6. Glen Park\n7. Winewood\n8. Verdant Bluffs\n9. Aeroporto LS", "Ok", "Esci");
            }
            /*if(listitem == 1) // TELE SF
            {
                ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, " ", " ", "Ok", "Cancella");
            }
            if(listitem == 2) //TELE LV
            {
                ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, " ", " ", "Ok", "Cancella");
        }*/

        }
        return 1;
    }
    if(dialogid == DIALOGID+1) //TELES LOS SANTOS
    {
        if(response)
        {
            if(listitem == 0) //GROVE STREET
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2507.4324,-1679.7229,13.5469);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 2507.4324,-1679.7229,13.5469);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 1) //police station
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1510.8280,-1671.2766,14.0469);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1510.8280,-1671.2766,14.0469);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 2) //el corona
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1812.9939,-1886.6304,13.4141);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1812.9939,-1886.6304,13.4141);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 3) //willowfied
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2451.9905,-2020.5287,13.5469);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 2451.9905,-2020.5287,13.5469);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 4) //willowfied
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1965.3345,-1448.1998,13.4840);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1965.3345,-1448.1998,13.4840);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 5) //glen park
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1900.3505,-1171.6853,24.2914);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1900.3505,-1171.6853,24.2914);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 6) //winewood
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1415.2092,-845.7033,47.6591);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1415.2092,-845.7033,47.6591);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 7) //verdant buffs
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1126.0853,-2036.4387,69.8839);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1126.0853,-2036.4387,69.8839);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
            if(listitem == 8) //aereoporto ls
            {
                if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
                    SetVehiclePos(GetPlayerVehicleID(playerid), 1788.3025,-2423.0300,13.5547);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                }
                else
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid, 1788.3025,-2423.0300,13.5547);
                    SetPlayerFacingAngle(playerid, 0);
                }
            }
        }
        return 1;
    }
    return 1;
}
In future I suggest you indent your code. Also I suggest you use a switch statement for checking the listitem instead of a lot of if statements, especially when you don't even use else if statements!


Re: [HELP]ERROR - TheBluec0de - 07.08.2011

Give me an example with switch, please


Re: [HELP]ERROR - JaTochNietDan - 07.08.2011

For example:

pawn Код:
switch(listitem)
{
    case 1:
    {
        // Do your code
    }
    case 2:
    {
        // Do your code
    }
}
It is much cleaner and more effecient.


Re: [HELP]ERROR - TheBluec0de - 07.08.2011

thanks