Stock IsTruckerVehicle wont work.
#1

Here is the code.

Код:
enum jobInfo
{
	jCars[9],
	jTrailers[9]
}
new JobInfo[MAX_JOBS][jobInfo];
Код:
	JobInfo[JOB_TRUCKER][jCars][0] = CreateVehicle(498,-499.70001221,-472.20001221,25.60000038,179.99993896,1,3,0); // Truck 1
	JobInfo[JOB_TRUCKER][jCars][1] = CreateVehicle(498,-494.70001221,-472.29998779,25.60000038,179.99450684,1,3,0); // Truck 2
	JobInfo[JOB_TRUCKER][jCars][2] = CreateVehicle(498,-489.70001221,-472.39999390,25.60000038,179.99450684,1,3,0); // Truck 3
	JobInfo[JOB_TRUCKER][jCars][3] = CreateVehicle(498,-484.79998779,-472.29998779,25.60000038,179.99450684,1,3,0); // Truck 4
	JobInfo[JOB_TRUCKER][jCars][4] = CreateVehicle(498,-479.29998779,-472.70001221,25.60000038,179.99450684,1,3,0); // Truck 5
	JobInfo[JOB_TRUCKER][jCars][5] = CreateVehicle(498,-474.50000000,-472.70001221,25.60000038,179.99450684,1,3,0); // Truck 6
	JobInfo[JOB_TRUCKER][jCars][6] = CreateVehicle(498,-469.50000000,-472.29998779,25.60000038,179.99450684,1,3,0); // Truck 7
	JobInfo[JOB_TRUCKER][jCars][7] = CreateVehicle(498,-504.20001221,-472.10000610,25.60000038,179.99450684,1,3,0); // Truck 8
	JobInfo[JOB_TRUCKER][jCars][8] = CreateVehicle(498,-509.00000000,-472.10000610,25.60000038,179.99450684,1,3,0); // Truck 9
Код:
stock IsTruckerVehicle(vehicleid)
{
	for(new i=0; i<10; i++)
	{
	    if(vehicleid == JobInfo[JOB_TRUCKER][jCars][i]) return 1;
	}
	return 0;
}
And here is the problem. This part doesnt work

Код:
	    if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
	    {
	    	new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
	    }
Rep for helping ! Really need this to work :/
Reply
#2

Where is the last code used in? An /engine command?
Reply
#3

When i get in a Cop car or any car that is restricted to faction or a family. player can drive it without problems.

here is the OnPlayerEnterVehicle code. Forgot to put it in , sorry ..

Код:
	if(!ispassenger)
	{
       if (g_bIsRobbiz[playerid])
       {
           DestroyObject(g_robbizBag[playerid]);
       }
       if(IsDMVCar(vehicleid))
		{
		    if(LicenseTest[playerid] == 0)
		    {
			    new Float:pos[3];
			    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
			    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		        SendClientMessage(playerid, COLOR_ORANGE, "You are not taking a drivers license test.");
		    }
		    else
		    {
		        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
		        SetPlayerCheckpoint(playerid,959.7175,-1403.0309,13.1974,5);
		        SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
		    }
		}
	    else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid) && !IsADOC(playerid) && !IsASAAF(playerid) && !IsSASD(playerid))
		{
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to a family.");
		}
	    else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSPD.");
	    }
	    else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the LSFMD.");
	    }
	    else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the News Agency.");
	    }
	    else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the FBI.");
	    }
	    else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the NG.");
	    }
     	else if(IsRETOVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 9)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to Rebel's Towing");
	    }
	    else if(IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 10)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to LS Taxi Co");
	    }
	    else if(IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
	    {
	    	new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Truckers.");
	    }
	    else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the GOV.");
	    }
	    else if(IsSAAFVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 11)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the SA Air Force.");
	    }
	    else if(IsDOCVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 13)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the Department Of Correct.");
	    }
	    else if(IsSASDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 8)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " You can't start the engine as it belongs to the San Andreas Sherrif Department.");
	    }
Reply
#4

Try this:

pawn Код:
if((IsTruckerVehicle(vehicleid) == 0) || (PlayerInfo[playerid][pJob] != JOB_TRUCKER))
This should check if the vehicle isn't a trucker vehicle OR the player isn't using the trucker class.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)