CMD:loadplane(playerid, params[]) {
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == CrateIslandVehicles[2] || vehicleid == CrateIslandVehicles[3] ||vehicleid == CrateIslandVehicles[4] || GetVehicleModel(vehicleid) == 530)
{
if(CrateVehicleLoad[vehicleid][vForkLoaded])
{
new PlaneFound, FreeSlot;
PlaneFound = INVALID_VEHICLE_ID;
FreeSlot = -1;
new Float:vx, Float:vy, Float:vz;
for(new i = 0; i < sizeof(CrateIslandVehicles); i++)
{
GetPosBehindVehicle(CrateIslandVehicles[i], vx, vy, vz, -8);
if(IsPlayerInRangeOfPoint(playerid, 6, vx, vy, vz))
{
if(GetVehicleModel(CrateIslandVehicles[i]) == 592)
{
PlaneFound = CrateIslandVehicles[i];
break;
}
}
}
if(PlaneFound != INVALID_VEHICLE_ID)
{
for(new i = 0; i < 6; i++)
{
if(CrateVehicleLoad[PlaneFound][vCrateID][i] == -1)
{
FreeSlot = i;
break;
}
}
}
if(PlaneFound == INVALID_VEHICLE_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not near a plane!");
DestroyDynamicObject(CrateVehicleLoad[vehicleid][vForkObject]);
CrateVehicleLoad[vehicleid][vForkLoaded] = 0;
CrateVehicleLoad[vehicleid][vForkObject] = INVALID_OBJECT_ID;
CrateVehicleLoad[PlaneFound][vCrateID][FreeSlot] = CrateVehicleLoad[vehicleid][vCrateID][0];
CrateInfo[CrateVehicleLoad[PlaneFound][vCrateID][FreeSlot]][InVehicle] = PlaneFound;
CrateVehicleLoad[vehicleid][vCrateID][0] = -1;
SendClientMessageEx(playerid, COLOR_GRAD2, "You loaded a crate onto the plane!");
}
else
{
return SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a crate loaded!");
}
}
else
{
return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not in a forklift!");
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 6, vx, vy, vz)) |
if(IsPlayerInRangeOfPoint(playerid, 6, [PUT NUMBERS], [PUT NUMBERS], [PUT NUMBERS])) |