28.04.2013, 10:28
How can i make when the player is on the car and pressing some key the Car become a Airplane with out to stop the speed ?
Get the velocity, position, and rotation of the player's car, destroy it, spawn a plane at the coordinates and rotation you have destroyed your car, put player inside the plane, and set its velocity you have got earlier from your destroyed car.
|
if(newkeys & KEY_YES) { if(IsPlayerInAnyVehicle(playerid)) { new Float:Speed[3],Float:Pos[4],id; id = GetPlayerVehicleID(playerid); GetVehicleVelocity(id,Speed[0],Speed[1],Speed[2]); GetVehiclePos(id,Pos[0],Pos[1],Pos[2]); GetVehicleZAngle(id,Pos[3]); SetVehiclePos(id,Pos[0]+(40*floatcos(90+Pos[3],degrees)),Pos[1]+(40*floatsin(90+Pos[3],degrees)),Pos[2]); SetVehicleZAngle(id,Pos[3]); SetVehicleVelocity(id,Speed[0],Speed[1],Speed[2]); PlayerPlaySound(playerid, 6003, 0.0, 0.0, 0.0); CreateVehicle(520, Float:x , Float:y , Float:z + 1,90.0,-1, -1, -1);
new my_vehicle = GetPlayerVehicleID(playerid), Float:v_dat[7];
GetVehiclePos(my_vehicle, v_dat[0], v_dat[1], v_dat[2]);
GetVehicleZAngle(my_vehicle, v_dat[3]);
GetVehicleVelocity(my_vehicle, v_dat[4], v_dat[5], v_dat[6]);
DestroyVehicle(my_vehicle);
PutPlayerInVehicle(playerid, my_vehicle = CreateVehicle(519, v_dat[0], v_dat[1], v_dat[2], v_dat[3], 1, 1, 0), 0);
SetVehicleVelocity(my_vehicle, v_dat[4], v_dat[5], v_dat[6]);
Create the plane before you set its position, rotation, and velocity.
Edit: If you spawn a "Hydra" ID 520, it will kill the set velocity, because it always spawn in hover mode. Anyway pawn Код:
|