Problem with SetPlayerVelocity
#1

Is it just me, or does SetPlayerVelocity not work to well?

I'm trying to make it push me really high up. But no matter how large I make the Z value, the character just isn't getting much height from it. Anybody else noticed this?

Btw, I'm only going up about the height of 3 CJ's.
Reply
#2

Code?
Reply
#3

You do know that it's only in effect when they're moving?
Reply
#4

Quote:
Originally Posted by [HiC
TheKiller ]
Code?
SetPlayerVelocity(playerid,0,0,10000000);

That will barley make the player jump high at all. I've used that in OnPlayerEnterCheckpoint.


Quote:
Originally Posted by Calon
You do know that it's only in effect when they're moving?
Ehh, never noticed that. Or maybe I just don't understand what you are trying to say.


Reply
#5

It are Floats, Try this code for instance

Код:
if (!strcmp("/jump", cmdtext))
  {
	SetPlayerVelocity(playerid,0.0,0.0,10.0); //Forces the player to jump
	return 1;
  }
Hope it will work

PS: You had it something like 100000000, make it in the code 10000000.0
.0 is needed I think.
Reply
#6

Also see https://sampwiki.blast.hk/wiki/SetPlayerVelocity ^^
Reply
#7

Quote:
Originally Posted by waza75
It are Floats, Try this code for instance

Код:
if (!strcmp("/jump", cmdtext))
  {
	SetPlayerVelocity(playerid,0.0,0.0,10.0); //Forces the player to jump
	return 1;
  }
Hope it will work


PS: You had it something like 100000000, make it in the code 10000000.0
.0 is needed I think.
Putting it on 100000000 wont make it work at all it doesn't need to be that high, try 0.6.
SetPlayerVelocity also does not work if you are stood on the ground, you need to be airborne however you can if your in a car.

Heres what i use to do a 10ft jump up in a car
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE))
    {
    new Float:x, Float:y, Float:z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
    }
    return 1;
}
Reply
#8

Nice, Learned something from this too. Thanks ^^
Reply
#9

Quote:
Originally Posted by Seif_
No, SetPlayerVelocity works regardless if you're moving or not.
Are you sure? I thought it worked like SetVehicleVelocity.
Reply
#10

Quote:
Originally Posted by Seif_
No, SetPlayerVelocity works regardless if you're moving or not.
This will not work unless your player is off the ground. Try it.
pawn Код:
if (!strcmp("/jump", cmdtext))
  {
    SetPlayerVelocity(playerid,0.0,0.0,0.2); //Forces the player to jump
    return 1;
  }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)