Jump height
#1

------
Reply
#2

Here's my code, you can change the Z value in SetPlayerVelocity to make it better or worst.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (!IsPlayerInAnyVehicle(playerid))
    {
        if (newkeys & KEY_JUMP)
        {
            new
                Float: fVehX,
                Float: fVehY,
                Float: fVehZ
                ;

            GetPlayerVelocity(playerid, fVehX, fVehY, fVehZ);
            if (fVehZ == 0.0)
            {
                SetPlayerVelocity(playerid, fVehX, fVehY, 0.5);
            }
        }
    }

    return 1;
}
Reply
#3

------
Reply
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
im not using it for a car but i made one but i failed gives me errors

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ( PRESSED ( KEY_JUMP ) )
    {
        new Float:X1 , Float;Y1 , Float:Z1 ;
        GetPlayerVelocity ( playerid, Float:X1, Float:Y1, Float:Z1 );
        SetPlayerVelocity (playerid, Float:X1, Float:Y1, Float:Z1, 0.5 );
    }
    return 1;
}
FIXED
My code isn't for cars.
Reply
#5

Why isnt this working i just went to test it
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(gTeam[playerid] != TEAM_HUNTER)
    {
        if ( PRESSED ( KEY_JUMP ) )
        {
            new Float:X1 , Float:Y1 , Float:Z1 ;
            GetPlayerVelocity ( playerid, Float:X1, Float:Y1, Float:Z1 );
            SetPlayerVelocity ( playerid, X1, Y1, 0.5 );
        }
    }
    return 1;
}
Reply
#6

how about
pawn Код:
SetPlayerVelocity ( playerid, X1, Y1, Z1+0.5 );
Reply
#7

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
how about
pawn Код:
SetPlayerVelocity ( playerid, X1, Y1, Z1+0.5 );
gives me 4 errors

Код:
C:\Users\GM\Desktop\SA-MP\gamemodes\hvsz.pwn(141) : error 029: invalid expression, assumed zero
C:\Users\GM\Desktop\SA-MP\gamemodes\hvsz.pwn(141) : warning 215: expression has no effect
C:\Users\GM\Desktop\SA-MP\gamemodes\hvsz.pwn(141) : error 001: expected token: ";", but found ")"
C:\Users\GM\Desktop\SA-MP\gamemodes\hvsz.pwn(141) : error 029: invalid expression, assumed zero
C:\Users\GM\Desktop\SA-MP\gamemodes\hvsz.pwn(141) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(gTeam[playerid] != TEAM_HUNTER)
    {
        if ( PRESSED ( KEY_JUMP ) )
        {
            new Float:X1 , Float:Y1 , Float:Z1 ;
            GetPlayerVelocity ( playerid, X1, Y1, Z1 );
            SetPlayerVelocity ( playerid, X1, Y1, Z1 + 0.5 );
        }
    }
    return 1;
}
Try that.
Reply
#9

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(gTeam[playerid] != TEAM_HUNTER)
    {
        if ( PRESSED ( KEY_JUMP ) )
        {
            new Float:X1 , Float:Y1 , Float:Z1 ;
            GetPlayerVelocity ( playerid, X1, Y1, Z1 );
            SetPlayerVelocity ( playerid, X1, Y1, Z1 + 0.5 );
        }
    }
    return 1;
}
Try that.
Fixed with errors but why isnt it jumping the player higher ;(
Reply
#10

pawn Код:
if(gTeam[playerid] != TEAM_HUNTER)
Add some debugging information to make sure you have this correct.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)