SA-MP Forums Archive
Replace a car without moving, change speed, change the angle - 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: Replace a car without moving, change speed, change the angle (/showthread.php?tid=276468)



Replace a car without moving, change speed, change the angle - Justinlol - 13.08.2011

i make checkpoint
When you climb on, it keeps the speed of your vehicle, your location, if your visual angle, and puts you in another car, and set the speed, angle, and all

But it's still not enough part,
Any idea how to do it?

(****** translate)


Re: Replace a car without moving, change speed, change the angle - [HiC]TheKiller - 14.08.2011

You could retreive all the values from the current car and apply them to the next.
pawn Код:
new VID = GetPlayerVehicleID(playerid), Float:Xpos[2], Float:Ypos[2], Float:Zpos[2], Float:Angle;
GetVehiclePos(VID, Xpos[0], Ypos[0], Zpos[0]);
GetVehicleVelocity(VID, Xpos[1], Ypos[1], Zpos[1]);
GetVehicleZAngle(VID, Angle);
DestroyVehicle(VID);
VID = CreateVehicle(/*ModelID*/, Xpos[0], Ypos[1], Zpos[2], Angle, 0, 0, 99999999999);
PutPlayerInVehicle(playerid, VID, 0);
SetVehicleVelocity(VID, Xpos[1], Ypos[1], Zpos[2]);



Re: Replace a car without moving, change speed, change the angle - Steven82 - 14.08.2011

I thinking keeping the speed of the vehicle would be hard if not impossible.


Re: Replace a car without moving, change speed, change the angle - Kar - 14.08.2011

pawn Код:
Float:angle, Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(firstvehicleid, vx, vy, vz);
GetVehicleZAngle(firstvehicleid, Angle);
//
PutPlayerInVehicle(playerid, secondvehicleid, 0);
SetVehicleVelocity(secondvehicleid, vx, vy, vz);
SetVehicleZAngle(secondvehicleid, Angle);



Re: Replace a car without moving, change speed, change the angle - linuxthefish - 14.08.2011

Just set the velocity and direction/position the same. Works fine for me.


Re: Replace a car without moving, change speed, change the angle - Justinlol - 14.08.2011

thanks but my is better