Limit to Z in SetPlayerVelocity?
#1

Well, I'm trying to make the player jump on top of a building by using:
Код:
SetPlayerVelocity(playerid,0.0,-0.1,100);
but he only jumps like 3-4 ft high. Any ideas?
Reply
#2

https://sampwiki.blast.hk/wiki/SetPlayerVelocity
pawn Код:
if (!strcmp("/jump", cmdtext))
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z)
    SetPlayerVelocity(playerid,x,y,(z+5)); //Forces the player to jump
    return 1;
    }
that you wanted?
Reply
#3

Quote:
Originally Posted by mineralo
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/SetPlayerVelocity
pawn Код:
if (!strcmp("/jump", cmdtext))
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z)
    SetPlayerVelocity(playerid,x,y,(z+5)); //Forces the player to jump
    return 1;
    }
that you wanted?
Not at all. This will boost me with the speed of light probably. You don't know how SetPlayerVelocity works, do you?

Edit: Tested it, and yep, it crashed my client.
Reply
#4

pawn Код:
//...
new Float:pVel[3]; //Our variable to store the current player velocity
GetPlayerVelocity(playerid, pVel[0], pVel[1], pVel[2]); //This function gets our velocity
SetPlayerVelocity(playerid, pVel[0], pVel[1], pVel[2]*5); //This function sets the players velocity. I've tried to set 5x velocity for Z.
//...
Reply
#5

Quote:
Originally Posted by BigETI
Посмотреть сообщение
pawn Код:
//...
new Float:pVel[3]; //Our variable to store the current player velocity
GetPlayerVelocity(playerid, pVel[0], pVel[1], pVel[2]); //This function gets our velocity
SetPlayerVelocity(playerid, pVel[0], pVel[1], pVel[2]*5); //This function sets the players velocity. I've tried to set 5x velocity for Z.
//...
No. Why would I even need my velocity to be saved into a variable? I want the player simply to go up like 100 ft high, no matter of their velocity.
Reply
#6

then try this
pawn Код:
if (!strcmp("/jump", cmdtext))
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z)
    SetPlayerPos(playerid,x,y,(z+5)); //Forces the player to jump
    return 1;
    }
Reply
#7

Quote:
Originally Posted by mineralo
Посмотреть сообщение
then try this
pawn Код:
if (!strcmp("/jump", cmdtext))
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z)
    SetPlayerPos(playerid,x,y,(z+5)); //Forces the player to jump
    return 1;
    }
Yea, and that takes out all the realism. I wouldn't create this thread if I wanted the player to simply teleport, would I ?
Reply
#8

Quote:
Originally Posted by king_hual
Посмотреть сообщение
Yea, and that takes out all the realism. I wouldn't create this thread if I wanted the player to simply teleport, would I ?
Have you considered testing it?
Reply
#9

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Have you considered testing it?
Not at all since I want the player to actually move to the top of the building, not just teleport there, you know what I mean?
Reply
#10

Quote:
Originally Posted by king_hual
Посмотреть сообщение
Not at all since I want the player to actually move to the top of the building, not just teleport there, you know what I mean?
Their code looks perfectly fine, it won't teleport you anywhere lol, just moves you up though you might need a animation to accomplish this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)