SA-MP Forums Archive
Limit to Z in SetPlayerVelocity? - 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: Limit to Z in SetPlayerVelocity? (/showthread.php?tid=311162)



Limit to Z in SetPlayerVelocity? - KingHual - 15.01.2012

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?


Re: Limit to Z in SetPlayerVelocity? - mineralo - 15.01.2012

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?


Re: Limit to Z in SetPlayerVelocity? - KingHual - 15.01.2012

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.


AW: Limit to Z in SetPlayerVelocity? - BigETI - 15.01.2012

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.
//...



Re: AW: Limit to Z in SetPlayerVelocity? - KingHual - 15.01.2012

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.


Re: Limit to Z in SetPlayerVelocity? - mineralo - 15.01.2012

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;
    }



Re: Limit to Z in SetPlayerVelocity? - KingHual - 15.01.2012

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 ?


Re: Limit to Z in SetPlayerVelocity? - Lorenc_ - 15.01.2012

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?


Re: Limit to Z in SetPlayerVelocity? - KingHual - 15.01.2012

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?


Re: Limit to Z in SetPlayerVelocity? - Lorenc_ - 15.01.2012

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.