19.07.2013, 16:23
Hey, I got a little problem over here, I created this cmd that loads the forklift cargo on the truck. The only problem is once I use the cmd the object or the cargo doesn't get attached on the truck but on the back of the forklift
.
Here are the codes.

Here are the codes.
pawn Код:
CMD:loadtruck(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new truckid = GetClosestCar(playerid);
new Float:X,Float:Y,Float:Z;
GetVehiclePos(truckid, X,Y,Z);
if(IsAForklift(vehicleid))
{
if(ForkliftLoaded[vehicleid] == 0) return SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}There is no cargo on this forklift.");
if(!IsATruck(truckid) && IsPlayerInRangeOfPoint(playerid, 10, X,Y,Z))
{
if(TruckLoaded[truckid] == 0)
{
DestroyObject(ForkliftObject[vehicleid][vObject]);
TruckObject[truckid][vObject] = CreateObject(964, 0, 0.9, -0.12, 0, 0, 0);
AttachObjectToVehicle(TruckObject[truckid][vObject], truckid, 0.000000, -3.890041, 0.120000, 0.000000, 0.000000, 0.000000);
TruckLoaded[truckid] = 1;
ForkliftLoaded[vehicleid] = 0;
}
else return SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}This truck can't carry more cargo.");
}
else return SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}You aren't near any cargo truck.");
}
else return SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}You must be a driver of a forklift to load a forklift.");
return 1;
}