Speedboost
#1

Please, PLEASE read this topic carefully, because it's not as simple as it sounds.

At the moment on my server the speedboost multiplies the vehicles x and y velocity by 2. What I would like to happen is the vehicle be boosted in the direction it is facing (tilting up/down, not angle.). I have seen this on other servers but can't remember the names. I'm not sure if it's something to do with maths or what, but if you think you know please help. Thanks.

EXAMPLE:

I'm facing the sky, at a 45 degree tilt, and when I press speedboost I want to boost toward the sky, not along the x/y axis.
Reply
#2

do you wanna jump with car ? Z
pawn Код:
SetPlayerVelocity(playerid, 0.0, 0.0, 1.0);
Reply
#3

then you need to also multiply the z velocity by 2 and it should work as long as you already have that upwards momentum, ales you need to get where the player is looking
Reply
#4

pawn Код:
stock AddVehicleSpeed(vid, Float:howmuch)
{
    static Float:T[3];
    GetVehicleVelocity(vid, T[0], T[1], T[2]);
    return SetVehicleVelocity(vid,T[0] * howmuch , T[1] * howmuch , T[2]);
}
pawn Код:
stock JumpVehicle(vid, Float:howmuch)
{
    static Float:T[3];
    GetVehicleVelocity(vid, T[0], T[1], T[2]);
    return SetVehicleVelocity(vid,T[0], T[1], T[2]*howmuch);
}
Reply
#5

I tried to explain as best as I could. I want to be able to have the 'cars can fly' cheat. If the vehicle is in the air, pointing to the sky, I need it to boost upwards depending on the angle.
Reply
#6

I do not have the time to program this for you so i wil give u the resources needed to do it yourself, using the camera front vector, and player position you should be able to devise a function that will allow the players to fly cars.
https://sampwiki.blast.hk/wiki/GetVehicleVelocity
https://sampwiki.blast.hk/wiki/GetVehiclePos
https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector
https://sampwiki.blast.hk/wiki/SetVehicleVelocity
and if you want it to be fancy with tilts and stuff you will need this link also
https://sampwiki.blast.hk/wiki/SetVehicleAngularVelocity
Good Luck!
Reply
#7

This isn't about scripting, it's about maths. Learn what you're talking about before trying to call me lazy please.
Reply
#8

i wasnt calling you lazy....
i was just saying that i havent seen anything like what your thinking about made before and those functions would pertain to what you want to do.
Reply
#9

I know what you are trying to say, You want the vehicle to boost in the direction to which its facing...
Reply
#10

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
I know what you are trying to say, You want the vehicle to boost in the direction to which its facing...

Wait while I make or find it. x)
i've almost got it done, just a prob with how often the keys are updated.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)