SetPlayerVelocity - Not High Enough
#1

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?
Reply
#2

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

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?
Reply
#4

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
Reply
#5

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.
Reply
#6

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

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.
Reply
#8

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...
Reply
#9

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.
Reply
#10

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?
Reply
#11

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)