SA-MP Forums Archive
Attach - 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: Attach (/showthread.php?tid=70509)



Attach - wordas - 25.03.2009

how can i make that if the truck pickups a trailer it does a funcion?

Ps: sry can't talk good in english


Re: Attach - Sdhoirm - 25.03.2009

This is what iґm using, works very well in my script atleast.


On top:
pawn Код:
forward TrailerAttaching(playerid);
new TrailerTimer;

a simple public
pawn Код:
public TrailerAttaching(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
      if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
      {
      SendClientMessage(playerid,COLOR_WHITE,"A trailer has been attached to your vehicle!");
      KillTimer(TrailerTimer);
      }
    }


}
OnPlayerStateChange()
pawn Код:
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
TrailerTimer = SetTimer("TrailerAttaching",1000,true);
}

If you are using a /detach command you may start the timer again when detached


Re: Attach - Rks25 - 25.03.2009

Also post this, else you will get errors:
IsTrailerAttachedToVehicle(GetPlayerVehicleID(play erid))


Re: Attach - wordas - 25.03.2009

thanks