10.04.2016, 11:37
Heya
I am trying to edit my pilot job and when I tried restricting vehicle entry to pilots only
It simply allows everyone + If you are actually a pilot and taking a flight, Nothing appears
I tried debugging it to printf the vehicle id when IsPilotVehicle is called :
Nothing pops up in console: IsPilotVehicle doesnt work
Code:
OnPlayerEnterVehicle
CMD:Startflight
stock IsPilotVehicle
CreateVehicle:
I am trying to edit my pilot job and when I tried restricting vehicle entry to pilots only
It simply allows everyone + If you are actually a pilot and taking a flight, Nothing appears
I tried debugging it to printf the vehicle id when IsPilotVehicle is called :
Nothing pops up in console: IsPilotVehicle doesnt work
Code:
OnPlayerEnterVehicle
PHP код:
else if(IsPilotVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_PILOT && PlayerInfo[playerid][pVIPJob] != JOB_PILOT)
{
printf("TEST = %i.",vehicleid);
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 cannot start the engine as it belongs to the Los Santos Airline Company.");
return 1;
}
else if(IsPilotVehicle(vehicleid) && PlayerInfo[playerid][pJob] == JOB_PILOT || PlayerInfo[playerid][pVIPJob] == JOB_PILOT)
{
if(FlightStarted[playerid] == 1)
{
new
airport = random(2),
destination[24],
string[128],
Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
FlightPosition[playerid][0] = x;
FlightPosition[playerid][1] = y;
FlightPosition[playerid][2] = z;
switch (airport)
{
case 0:
{
SetPlayerCheckpoint(playerid, -1462.8226, 30.5481, 14.1484, 15.0);
destination = "San Fierro Airport";
}
case 1:
{
SetPlayerCheckpoint(playerid, 1477.2936, 1664.1234, 10.8125, 15.0);
destination = "Las Venturas Airport";
}
}
CP[playerid] = 2425;
format(string, sizeof(string), "* %s enters the plane and starts it up.", RPN(playerid));
SendClientMessage(playerid, COLOR_PURPLE, string);
SendClientMessage(playerid, COLOR_PURPLE, "* 20 minutes later, the passengers board the plane.");
format(string, sizeof(string), "Your destination is %s. Land the plane into the checkpoint on the runway.", destination);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
else return SendClientMessage(playerid, COLOR_GREY, "You have to start the flight first (/startflight).");
}
}
PHP код:
CMD:startflight(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pJob] != JOB_PILOT && PlayerInfo[playerid][pVIPJob] != JOB_PILOT) return SendClientMessage(playerid, COLOR_GREY, "You are not a pilot.");
{
if (IsPlayerInRangeOfPoint(playerid, 20.0, 1891.9252, -2328.7129, 13.5469))
{
if(PackTime[playerid] > 0)
{
format(string, sizeof(string), "You need to wait %d more seconds before starting a new flight.", PackTime[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
PackTime[playerid] = 180;
SetTimerEx("PackTimer", 1000, false, "i", playerid);
if (FlightStarted[playerid] == 0)
{
if (FlightCooldown[playerid] > 0) return format(string, sizeof(string), "You still have %d seconds left before you can do another flight.", FlightCooldown[playerid]), SendClientMessage(playerid, COLOR_GREY, string);
FlightStarted[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You're about to start a flight, enter a plane.");
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, " You already started a flight.");
}
else return SendClientMessage(playerid, COLOR_GREY, " You are not at the flight center.");
}
}
PHP код:
stock IsPilotVehicle(vehicleid)
{
for(new i=0; i<1; i++)
{
if(vehicleid == Plane[i]) return 1;
printf("Plane Vehicle ID = %i.",vehicleid);
}
return 0;
}
PHP код:
Plane[0] = AddStaticVehicle(592,1922.0416,-2258.0427,14.7435,182.1580,1,1);
Plane[1] = AddStaticVehicle(592,1873.4792,-2285.5344,14.7054,269.9822,1,1);