Disconnect trailer?
#1

This won't workhttp://pastebin.com/m6444682c, it should disconnect the trailer. But the only that happens is "Your trailer has been disconnected" at least some part work
Reply
#2

DetachTrailerFromVehicle(515, 514, 403);? why not DetachTrailerFromVehicle(514, 403); DetachTrailerFromVehicle(515, 403); I dosent know but 403 is the trailer id of so this works...
Код:
   if (strcmp("/distrailer", cmdtext, true, 10) == 0)
  {
  DetachTrailerFromVehicle(514, 403);
  DetachTrailerFromVehicle(515, 403);
  SendClientMessage(playerid, 0xE60000FF, "Your trailer has been disconnected.");
  return 1;
  }
  return 0;
}
Reply
#3

First you need to attach trailer to vehicle... Proper, error-free function:
pawn Код:
if (strcmp("/detach", cmdtext, true) == 0)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new VehicleID = GetPlayerVehicleID(playerid);
        if (IsTrailerAttachedToVehicle(VehicleID))
        {
            AttachTrailerToVehicle(GetVehicleTrailer(VehicleID), VehicleID);
            DetachTrailerFromVehicle(VehicleID);
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREY, "ERROR: No trailers attached!");
        return 1;
    }
    SendClientMessage(playerid, COLOR_GREY, "ERROR: You're not in a vehicle!");
    return 1;
}
It's from my gamemode, modify it (but why do you put exact trailer and vehicle id's in it?) and it should work
Reply
#4

First at all!! Thanks i'm very happy for that! and second, when i compile it shows an error with COLOR_GREY?
Reply
#5

Add #define COLOR_GREY [your color grey here] to the top of your script.
Reply
#6

Oh well, I forgot about that
pawn Код:
#define COLOR_GREY 0xAFAFAFAA
- on the top
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)