Need help
#1

Hai
I got a problem with a roleplay script, I'm trying to add some faction vehicles to certain factions but what I found out is that members that AREN'T in the faction can still enter the faction vehicles, for some factions it works properly where people can't enter faction vehicles unless they're in the faction but for some factions it doesn't work.
I tried to fix it but couldn't make heads or tails of it as I'm not a proffesional scripter

Here's a piece of script for a faction where it doesn't work properly:

Код:
stock IsSASDVehicle(vehicleid)
{
	for(new i=0; i<14; i++)
	{
	    if(vehicleid == FacInfo[8][fCars][i]) return 1;
	}
	return 0;
}

	    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.");
	    }


    //SASD VEHICLES
	FacInfo[8][fCars][0] = CreateVehicle(487, 616.6454, -552.5580, 23.1314, 89.3633, 61, 1, 0); // vehicle 1
	FacInfo[8][fCars][1] = CreateVehicle(487, 611.0197, -566.1091, 26.2673, 94.3214, 61, 1, 0); // vehicle 2
	FacInfo[8][fCars][2] = CreateVehicle(487, 621.1907, -577.5084, 26.1663, 94.3214, 61, 1, 0); // vehicle 3
	FacInfo[8][fCars][3] = CreateVehicle(599, 622.6804, -610.4935, 17.2866, 271.9211, 61, 1, 0); // vehicle 4
	FacInfo[8][fCars][4] = CreateVehicle(597, 621.9399, -606.4910, 16.9210, 272.0000, 61, 1, 0); // vehicle 5
	FacInfo[8][fCars][5] = CreateVehicle(523, 610.4322, -596.3445, 16.7124, 273.0000, 61, 1, 0); // vehicle 6
	FacInfo[8][fCars][6] = CreateVehicle(523, 610.4474, -598.9629, 16.7124, 273.0000, 61, 1, 0); // vehicle 7
	FacInfo[8][fCars][7] = CreateVehicle(523, 614.2676, -596.0264, 16.7124, 273.0000, 61, 1, 0); // vehicle 8
	FacInfo[8][fCars][8] = CreateVehicle(523, 614.0536, -598.6510, 16.7124, 273.0000, 61, 1, 0); // vehicle 9
	FacInfo[8][fCars][9] = CreateVehicle(523, 610.5723, -600.7275, 16.7124, 273.0000, 61, 1, 0); // vehicle 10
	FacInfo[8][fCars][10] = CreateVehicle(523, 614.1028, -601.0486, 16.7124, 273.0000, 61, 1, 0); // vehicle 11
	FacInfo[8][fCars][11] = CreateVehicle(597,611.8312,-591.2856,16.9585,269.6648,61,1, 0); // vehicle 12
	FacInfo[8][fCars][12] = CreateVehicle(597,611.8873,-587.7719,16.9536,269.0114,61,1, 0); // vehicle 13
	FacInfo[8][fCars][13] = CreateVehicle(599,640.4861,-611.4233,16.3428,268.3296,61,1, 0); // vehicle 14
	FacInfo[8][fCars][14] = CreateVehicle(599,640.3156,-606.3570,16.3445,272.2988,61,1, 0); // vehicle 15
And a piece of script for the faction vehicles where it does work properly:

Код:
	    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.");
	    }

stock IsLSFMDVehicle(vehicleid)
{
	for(new i=0; i<20; i++)
	{
	    if(vehicleid == FacInfo[5][fCars][i]) return 1;
	}
	return 0;
}

	//LSFMD
    FacInfo[5][fCars][0] = CreateVehicle(416,1124.0000000,-1329.1999512,13.5000000,0.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][1] = CreateVehicle(416,1110.5999756,-1328.9000244,13.3999996,0.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][2] = CreateVehicle(416,1097.4000244,-1329.0999756,13.5000000,0.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][3] = CreateVehicle(416,1147.6999512,-1314.0999756,13.8000002,0.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][4] = CreateVehicle(416,1135.4000244,-1340.6999512,13.8999996,0.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][5] = CreateVehicle(416,1147.5999756,-1347.0000000,13.6999998,180.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][6] = CreateVehicle(487,1161.5999756,-1310.0999756,31.7999992,268.0000000,255,0,0); //Maverick
	FacInfo[5][fCars][7] = CreateVehicle(487,1162.0999756,-1296.8000488,31.7999992,270.0000000,255,0,0); //Maverick
	FacInfo[5][fCars][8] = CreateVehicle(487,1161.4000244,-1322.0999756,31.7999992,268.0000000,255,0,0); //Maverick
	FacInfo[5][fCars][9] = CreateVehicle(407,1217.6999512,-1332.8000488,13.8000002,90.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][10] = CreateVehicle(407,1218.0000000,-1341.5999756,13.8000002,90.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][11] = CreateVehicle(407,1218.0000000,-1350.0999756,13.6999998,90.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][12] = CreateVehicle(407,1246.6999512,-1332.5999756,13.8000002,270.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][13] = CreateVehicle(407,1246.8000488,-1341.0999756,13.8000002,270.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][14] = CreateVehicle(407,1247.0000000,-1349.9000244,13.8000002,270.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][15] = CreateVehicle(407,1232.3000488,-1315.8000488,14.3999996,90.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][16] = CreateVehicle(407,1231.3000488,-1360.6999512,14.5000000,270.0000000,255,0,0); //Firetruck
	FacInfo[5][fCars][17] = CreateVehicle(416,1178.0000000,-1338.6999512,13.8999996,270.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][18] = CreateVehicle(416,1178.0999756,-1308.5000000,13.8999996,272.0000000,255,0,0); //Ambulance
	FacInfo[5][fCars][19] = CreateVehicle(487,1231.4000244,-1334.1999512,27.5000000,90.0000000,255,0,0); //Maverick
	FacInfo[5][fCars][20] = CreateVehicle(487,1232.0000000,-1348.8000488,27.5000000,90.0000000,255,0,0); //Maverick
I'd appriciate it if anyone could help
Reply
#2

PHP код:
else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5
Where are you use this? In any command? If so you should send us the whole command so we can better check where is the mistake.
Reply
#3

Код:
       if(IsDMVCar(vehicleid))
		{
		    if(!LicenseTest[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 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 Co.");
	    }
	    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 Towing Co");
	    }
	    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 Military");
	    }
	    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.");
	    }

	}
	return 1;
}
Reply
#4

Having the same problem here.
Reply
#5

Anybody?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)