20.01.2015, 04:27
So I create a system to /tow, however the problem is it isn't attaching the vehicle to the trailer. Here is the code.
The prints call, and everything works perfectly except the attachtrailertovehicle.
So when I /tow the first time, it says "calledtow", and when I /tow again it says "calleduntow" which is really weird seeming that its most likely a problem with the function AttachTrailerToVehicle
Help REP+
pawn Код:
command(tow, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Vehicle = GetPlayerVehicleID(playerid);
if(GetVehicleModel(Vehicle) == 525)
{
new VehicleToTow = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, VehicleToTow, 9.0))
{
print("calledbeforetow");
if(Player[playerid][TowingVehicle] == -1)
{
if(IsAPlane(VehicleToTow) || IsABike(VehicleToTow) || IsATrain(VehicleToTow) || IsAHelicopter(VehicleToTow))) return SendClientMessage(playerid, WHITE, "You can not tow this type of vehicle.");
AttachTrailerToVehicle(VehicleToTow, GetPlayerVehicleID(playerid));
Player[playerid][TowingVehicle] = VehicleToTow;
print("calledtow");
}
else
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
Player[playerid][TowingVehicle] = -1;
print("calleduntow");
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not near a vehicle!");
return 1;
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not in a tow truck!");
return 1;
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not in a tow truck!");
return 1;
}
}
return 1;
}
So when I /tow the first time, it says "calledtow", and when I /tow again it says "calleduntow" which is really weird seeming that its most likely a problem with the function AttachTrailerToVehicle
Help REP+