[Help] Flip
#1

This is the normal flip command that flips your car.

Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_HORN)
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID,Float:B;
VehicleID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VehicleID,B);
SetVehicleZAngle(VehicleID,B);
}
}
return 1;
}

Can anyone add a script that when, vehicle flip it stops moving at current angel. Coz sometimes when I use boost it takes me very fast somewhere and after i press H. It just flip and still moving fast.
Reply
#2

Simply use SetVehicleVelocity, for example:

pawn Код:
SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
The vehicle should then stop.
Reply
#3

Under SetVehicleZAngle, add this line:

SetVehicleVelocity(VehicleID,0,0,0);
Reply
#4

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Simply use SetVehicleVelocity, for example:

pawn Код:
SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
The vehicle should then stop.
it works but whenever i hit something and my vehicle rotates it just stop, but my car still rotating i mean rolling.. any solution how to Stop the car from rotating..
Reply
#5

Then add this, too:

SetVehicleAngularVelocity(VehicleID,0,0,0);
Reply
#6

Quote:
Originally Posted by Grand_Micha
Посмотреть сообщение
Under SetVehicleZAngle, add this line:

SetVehicleVelocity(VehicleID,0,0,0);
But after i hit something and my vehicle rotates after i press H it flips but still rotating(rolling)..
Reply
#7

Quote:
Originally Posted by kbalor
Посмотреть сообщение
But after i hit something and my vehicle rotates after i press H it flips but still rotating(rolling)..
Read his second reply, he suggests using SetVehicleAngularVelocity.
Reply
#8

Quote:
Originally Posted by Grand_Micha
Посмотреть сообщение
Then add this, too:

SetVehicleAngularVelocity(VehicleID,0,0,0);
well done! thanks can i have my last request for this day??

I need a fly script for vehicle again. Sometimes when my vehicle get stuck in a object or building. If I press Y for fly key. It moves a little bit but still stuck. How can my vehicle pass though fast so it may not take time to get unstuck on a spot?
Reply
#9

Код:
stock SetVehicleForwardVelocity(playerid,Float:Velocity, Float:Z1)
{
new Float:Getx1, Float:Gety1, Float:Getz1;
new Float:AngleZ1;
new Float:SpeedX1, Float:SpeedY1;
new Float:Mulx1, Float:Muly1;
new Vehicle = GetPlayerVehicleID(playerid);
GetVehicleVelocity(Vehicle, Getx1 ,Gety1 ,Getz1);
GetVehicleZAngle(Vehicle,AngleZ1);
SpeedX1 = floatsin(-AngleZ1, degrees);
SpeedY1 = floatcos(-AngleZ1, degrees);
Mulx1 = floatmul(Velocity, SpeedX1);
Muly1 = floatmul(Velocity, SpeedY1);
SetVehicleVelocity(Vehicle, floatadd(Mulx1,Getx1), floatadd(Muly1, Gety1), floatadd(Getz1, Z1));
return 1;
}
This is not really for flying, but it is a combination of jumping and boosting.
Reply
#10

Quote:
Originally Posted by Grand_Micha
Посмотреть сообщение
Код:
stock SetVehicleForwardVelocity(playerid,Float:Velocity, Float:Z1)
{
new Float:Getx1, Float:Gety1, Float:Getz1;
new Float:AngleZ1;
new Float:SpeedX1, Float:SpeedY1;
new Float:Mulx1, Float:Muly1;
new Vehicle = GetPlayerVehicleID(playerid);
GetVehicleVelocity(Vehicle, Getx1 ,Gety1 ,Getz1);
GetVehicleZAngle(Vehicle,AngleZ1);
SpeedX1 = floatsin(-AngleZ1, degrees);
SpeedY1 = floatcos(-AngleZ1, degrees);
Mulx1 = floatmul(Velocity, SpeedX1);
Muly1 = floatmul(Velocity, SpeedY1);
SetVehicleVelocity(Vehicle, floatadd(Mulx1,Getx1), floatadd(Muly1, Gety1), floatadd(Getz1, Z1));
return 1;
}
This is not really for flying, but it is a combination of jumping and boosting.
What the key to fly? or is there any?

P.S some server using fly script that can passed through wall. just like jump script..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)