SA-MP Forums Archive
Disconnect trailer? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disconnect trailer? (/showthread.php?tid=73165)



Disconnect trailer? - Cabby - 13.04.2009

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


Re: Disconnect trailer? - robanswe - 13.04.2009

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;
}



Re: Disconnect trailer? - DiDok - 13.04.2009

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


Re: Disconnect trailer? - Cabby - 13.04.2009

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


Re: Disconnect trailer? - Dol - 13.04.2009

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


Re: Disconnect trailer? - DiDok - 13.04.2009

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