SA-MP Forums Archive
SetPlayerVelocity - Not High Enough - 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)
+--- Thread: SetPlayerVelocity - Not High Enough (/showthread.php?tid=606434)



SetPlayerVelocity - Not High Enough - SupperRobin6394 - 04.05.2016

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?


Re: SetPlayerVelocity - Not High Enough - kaisersouse - 04.05.2016

Personally I always get their current velocity and multiply it by like 1.5,2.0 etc


Re: SetPlayerVelocity - Not High Enough - SupperRobin6394 - 04.05.2016

Quote:
Originally Posted by kaisersouse
Посмотреть сообщение
Personally I always get their current velocity and multiply it by like 1.5,2.0 etc
All directions or just Z?


Re: SetPlayerVelocity - Not High Enough - Micko123 - 04.05.2016

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://sampwiki.blast.hk/wiki/SetPlayerVelocity


Re: SetPlayerVelocity - Not High Enough - SupperRobin6394 - 04.05.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
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://sampwiki.blast.hk/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.


Re: SetPlayerVelocity - Not High Enough - Ritzy2K - 04.05.2016

This might be of little help.
https://sampforum.blast.hk/showthread.php?tid=199628


Re: SetPlayerVelocity - Not High Enough - iggy1 - 04.05.2016

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.


Re: SetPlayerVelocity - Not High Enough - SupperRobin6394 - 04.05.2016

Quote:
Originally Posted by iggy1
Посмотреть сообщение
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...


Re: SetPlayerVelocity - Not High Enough - iggy1 - 04.05.2016

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.


Re: SetPlayerVelocity - Not High Enough - SupperRobin6394 - 04.05.2016

Quote:
Originally Posted by iggy1
Посмотреть сообщение
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?


Re: SetPlayerVelocity - Not High Enough - Micko123 - 05.05.2016

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