How to lift cars with the tow truck ? - 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: How to lift cars with the tow truck ? (
/showthread.php?tid=173505)
How to lift cars with the tow truck ? -
Bumper - 02.09.2010
I saw in a server once where you can lift cars with the tow truck , any idea how to do that ?
Re: How to lift cars with the tow truck ? -
DiddyBop - 02.09.2010
AttachTrailerToVehicle Function with some OnKeyStateChange action. And viola. Working towtruck.
On my server we have towtruck like singleplayer
Re: How to lift cars with the tow truck ? -
Bumper - 02.09.2010
Can you give an example of how it should look ?
Re: How to lift cars with the tow truck ? -
Voldemort - 02.09.2010
OnPlayerKeystatechange
if(newkeys & KEY_FIRE)
{
if(GetPlayerVehicleID(playerid) == Your tow truck id)
{
AttachTraielrToVehicle(...
}
}
also you will need to check which is closest car
Re: How to lift cars with the tow truck ? -
Bumper - 02.09.2010
I'm not really used to work with this callback so is this right ?
pawn Код:
if(newkeys & KEY_FIRE)
{
if(GetPlayerVehicleID(playerid) == 525)
{
AttachTrailerToVehicle(5, 1);
}
}
Re: How to lift cars with the tow truck ? -
DiddyBop - 02.09.2010
Quote:
Originally Posted by Bumper
I'm not really used to work with this callback so is this right ?
pawn Код:
if(newkeys & KEY_FIRE) { if(GetPlayerVehicleID(playerid) == 525) { AttachTraielrToVehicle(5, 1); } }
|
AttachTraielrToVehicle(5, 1); Is not spelled correctly.
Re: How to lift cars with the tow truck ? -
Bumper - 02.09.2010
yeah..fixed it but what I ment was it correctly ?
Re: How to lift cars with the tow truck ? -
[XST]O_x - 02.09.2010
Try this:
http://pastebin.com/yN4xtaBt
It first detects if the player is in a towing truck,then gets the closest vehicle to the player,then checks if the closest vehicle is in distance of less than 10 meters,and then tows the car.
Re: How to lift cars with the tow truck ? -
Bumper - 02.09.2010
thanks just tested it and worked purfectly