05.06.2017, 15:31
Ah.. Maybe try use these 2 stock(s), would be much better.
Your final code should be this and should be working. (Haven't tested it but looks fine for me.)
PHP код:
stock IsAPoliceVehicle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 598, 599, 523: return 1; // You can add more vehicles id if u add more cop vehicles.
}
return 0;
}
PHP код:
stock IsAParademicVehicle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 416: return 1; // same applies here.
}
return 0;
}
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsAPoliceVehicle(vehicleid))
{
if(PlayerInfo[playerid][pFaction] != 1)
{
ClearAnimations(playerid);
GameTextForPlayer(playerid, "~r~Nu esti autorizat sa conduci aceasta masina!", 1000, 3);
}
else return InCopCar[playerid] = 1;
}
else return InCopCar[playerid] = 0;
else if(IsAParademicVehicle(vehicleid))
{
if(PlayerInfo[playerid][pFaction] != 2)
{
ClearAnimations(playerid);
GameTextForPlayer(playerid, "~r~Nu esti autorizat sa conduci aceasta masina!", 1000, 3);
}
else return InParamedicCar[playerid] = 1;
}
else return InParamedicCar[playerid] = 0;
return 1;
}