IsTrailerAttached
#1

Well I know about the IsTrailerAttached function. But where do I put this if I want it to make it so when a truck attaches to a trailer it does an action. There isn't a vehiclestatechange or something like that.. Let me know. Thanks.
Reply
#2

Make your own then bro.

pawn Код:
#include <a_samp>
#include <foreach>
new VehicleUpdateTimer;
new Attached[MAX_VEHICLES];
public OnFilterScriptInit()
{
      VehicleUpdateTimer = SetTimer("OnVehicleUpdate", 1000, true);
      return 1;
}

public OnFilterScriptExit() return KillTimer(VehicleUpdateTimer);

forward OnTrailerAttach(i, trailerid);
forward OnTrailerDetach(i, trailerid);
forward VehicleUpdateTimer();
public VehicleUpdateTimer() {
        foreach(new i: Vehicle) {
             if(IsTrailerAttachedToVehicle(i) && !Attached_[i])) {
                Attached[i] = GetVehicleTrailer(i);
                CallLocalFunction("OnTrailerAttach", "dd", i, GetVehicleTrailer(i));
            }
            else if(!IsTrailerAttachedToVehicle(i) && Attached_[i])) {
                CallLocalFunction("OnTrailerDetach", "dd", i, Attached[i]);
                Attached[i] = 0;
            }
       }
       return 1;
}
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Make your own then bro.

pawn Код:
#include <a_samp>
#include <foreach>
new VehicleUpdateTimer;
new Attached[MAX_VEHICLES];
public OnFilterScriptInit()
{
      VehicleUpdateTimer = SetTimer("OnVehicleUpdate", 1000, true);
      return 1;
}

public OnFilterScriptExit() return KillTimer(VehicleUpdateTimer);

forward OnTrailerAttach(i, trailerid);
forward OnTrailerDetach(i, trailerid);
forward VehicleUpdateTimer();
public VehicleUpdateTimer() {
        foreach(new i: Vehicle) {
             if(IsTrailerAttachedToVehicle(i) && !Attached_[i])) {
                Attached[i] = GetVehicleTrailer(i);
                CallLocalFunction("OnTrailerAttach", "dd", i, GetVehicleTrailer(i));
            }
            else if(!IsTrailerAttachedToVehicle(i) && Attached_[i])) {
                CallLocalFunction("OnTrailerDetach", "dd", i, Attached[i]);
                Attached[i] = 0;
            }
       }
       return 1;
}
I'm not that experienced yet so yeaa xD I'm looking for a tut or something like that.
Thanks thou.
Reply
#4

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)