PDA

View Full Version : SetPlayerVelocity - Not High Enough

SupperRobin6394
04/05/2016, 11:40 AM
Hey,

I want a player to be shot into the air while he uses a Command, not by a TP but with SetPlayerVelocity.
No matter if I set the Z to 10 or 100000, it'll always be the same high he gets boosted to.

Any help on this one?

kaisersouse
04/05/2016, 11:45 AM
Personally I always get their current velocity and multiply it by like 1.5,2.0 etc

SupperRobin6394
04/05/2016, 11:49 AM
Personally I always get their current velocity and multiply it by like 1.5,2.0 etc

All directions or just Z?

Micko123
04/05/2016, 04:47 PM
Z is only for up. So if you want to make player go only up you will leave x, y on same coords, but you will add number on z
This might be usefull

https://wiki.sa-mp.com/wiki/SetPlayerVelocity

SupperRobin6394
04/05/2016, 05:50 PM
Z is only for up. So if you want to make player go only up you will leave x, y on same coords, but you will add number on z
This might be usefull

https://wiki.sa-mp.com/wiki/SetPlayerVelocity

I'm having the X and Y as the Floats now, but it's going to normal speed/altitude no matter how much I make the Z.

Ritzy2K
04/05/2016, 06:09 PM
This might be of little help.

iggy1
04/05/2016, 06:35 PM
There will most likely be an internal limit for maximum velocity, so if you set it higher it will have no effect. So your probably going to want to set the velocity multiple times.

SupperRobin6394
04/05/2016, 07:38 PM
There will most likely be an internal limit for maximum velocity, so if you set it higher it will have no effect. So your probably going to want to set the velocity multiple times.

Tried this, same effect...

iggy1
04/05/2016, 07:46 PM
Sorry, by multiple times, i mean like inside an update function/timer. Check if velocity has fallen - if so increase it. When desired height is reached, kill the timer/stop updating.

SupperRobin6394
04/05/2016, 07:59 PM
Sorry, by multiple times, i mean like inside an update function/timer. Check if velocity has fallen - if so increase it. When desired height is reached, kill the timer/stop updating.

How many milliseconds do you suggest?

Micko123
05/05/2016, 07:01 AM
I made this command tested it, and it is working. When player presses "Y" it will lunch him in the air. Maybe this can help you

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_YES)
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.5);
return 1;
}
}
return 1;
}

it goes like this

SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);

If you wwant only in air just remove that 0.5 and set like 5. It will be really high.
Hope this helped you :)