SA-MP Forums Archive
Errors constant expression & loose identation - 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)
+--- Thread: Errors constant expression & loose identation (/showthread.php?tid=418079)



Errors constant expression & loose identation - kryptonice - 23.02.2013

Hi all,

Could anyone maybe help me fixing this 2 errors

(on line 8 ) : warning 217: loose indentation

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	{
	// If the player picks up the Buy_License pickup at the driving school in Doherty
	if (pickupid == Pickup_License)
	// Ask the player which license he wants to buy
	ShowPlayerDialog(playerid, DialogBuyLicenses, DIALOG_STYLE_LIST, TXT_DialogLicenseTitle, TXT_DialogLicenseList, TXT_DialogButtonBuy, TXT_DialogButtonCancel); // Let the player buy a license
		{
		    //SFPD
		    if(pickupid == SFPD)
		    {
            ShowPlayerDialog(playerid, DIALOG_SFPD, DIALOG_STYLE_MSGBOX, "SFPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
		    }
			//LSPD
		    if(pickupid == LSPD)
	        {
            ShowPlayerDialog(playerid, DIALOG_LSPD, DIALOG_STYLE_MSGBOX, "LSPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
	        }
			//LVPD
		    if(pickupid == LVPD)
	        {
            ShowPlayerDialog(playerid, DIALOG_LVPD, DIALOG_STYLE_MSGBOX, "LVPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
	        }
        }
 	}
 	return 1;
}
(on line 5 ) : warning 206: redundant test: constant expression is non-zero

Код:
case ClassBusDriver:
				{
					// Check if the player is the driver of a vehicle
					if (GetPlayerVehicleSeat(playerid) == 0)
						if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleCoach, VehicleBus) // Check if the player is inside a valid busdriver vehicle
							if (APlayerData[playerid][BusLicense] == 1) // Check if the player has acquired a busdriver license
								ShowPlayerDialog(playerid, DialogBusJobMethod, DIALOG_STYLE_LIST, "Select method:", "Choose your own busroute\r\nAuto assigned busroute", "Select", "Cancel");
							else
								BusDriver_StartJob(playerid, random(sizeof(ABusRoutes))); // Start a random job
						else
			                SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
					else
		                SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
				}
Much thanks in advance!


Re: Errors constant expression & loose identation - DaRk_RaiN - 23.02.2013

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    {
    // If the player picks up the Buy_License pickup at the driving school in Doherty
    if (pickupid == Pickup_License)
    // Ask the player which license he wants to buy
    ShowPlayerDialog(playerid, DialogBuyLicenses, DIALOG_STYLE_LIST, TXT_DialogLicenseTitle, TXT_DialogLicenseList, TXT_DialogButtonBuy, TXT_DialogButtonCancel); // Let the player buy a license
    {
    //SFPD
    if(pickupid == SFPD)
    {
    ShowPlayerDialog(playerid, DIALOG_SFPD, DIALOG_STYLE_MSGBOX, "SFPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
    }
                //LSPD
    if(pickupid == LSPD)
    {
    ShowPlayerDialog(playerid, DIALOG_LSPD, DIALOG_STYLE_MSGBOX, "LSPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
    }
                //LVPD
    if(pickupid == LVPD)
    {
    ShowPlayerDialog(playerid, DIALOG_LVPD, DIALOG_STYLE_MSGBOX, "LVPD","Are you sure you want to reset wanted level and pay $5.000 for it?", "Accept", "Cancel");
    }
    }
    }
    return 1;
}
On the second error, which line gives you that error?(comment beside it.)


Re: Errors constant expression & loose identation - mastermax7777 - 23.02.2013

GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleCoach || GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleBus


Re: Errors constant expression & loose identation - kryptonice - 23.02.2013

Thanks both, issues fixed!