Its simple
first of all define your trailer variables.
PHP код:
new trailer[12];//You can increase or decrease the amount of variable.
then go OnGameModInt and create trailer vehicles
PHP код:
//Normal Trailers
trailer[0] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[1] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[2] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[3] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[4] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[5] = AddStaticVehicle(435, Float:x, Float:y, Float:z, Float:angle, -1, -1);
//Fuel Trailers
trailer[6] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[7] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[8] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[9] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[10] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
trailer[11] = AddStaticVehicle(584, Float:x, Float:y, Float:z, Float:angle, -1, -1);
Now create 2 stocks to detect the Trailer is fuel one or normal
PHP код:
stock NormalTrailer(vehicleid)
{
if(GetVehicleTrailer(vehicleid) == trailer[0] || GetVehicleTrailer(vehicleid) == trailer[1] || GetVehicleTrailer(vehicleid) == trailer[2]) return 1;
if(GetVehicleTrailer(vehicleid) == trailer[3] || GetVehicleTrailer(vehicleid) == trailer[4] || GetVehicleTrailer(vehicleid) == trailer[5]) return 1;
return 0;
}
stock FuelTrailer(vehicleid)
{
if(GetVehicleTrailer(vehicleid) == trailer[6] || GetVehicleTrailer(vehicleid) == trailer[7] ||GetVehicleTrailer(vehicleid) == trailer[8] ||GetVehicleTrailer(vehicleid) == trailer[9]) return 1;
if(GetVehicleTrailer(vehicleid) == trailer[10] || GetVehicleTrailer(vehicleid) == trailer[11]) return 1;
return 0;
}
After This goto your function of truck mission
PHP код:
stock T_NewJob(playerid)
{
new MisRand = random(sizeof(MisLocations));
new vID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
{
if(IsTrailerAttachedToVehicle(vID))
{
if(NormalTrailer(vID))//Its Normal Trailer
{
//Your code for Normal Trailer
}
else if(FuelTrailer(vID))
{
//Your code for Fuel Trailer
}
}
else
{
SendClientMessage(playerid, -1, "You need a trailer!");
}
}
else
{
SendClientMessage(playerid, -1, "You must be in a Truck to perform this!");
}
return 1;
}