SA-MP Forums Archive
Jump height - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Jump height (/showthread.php?tid=193675)



Jump height - Kitten - 27.11.2010

------


Respuesta: Jump height - MrDeath537 - 27.11.2010

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



Re: Jump height - Kitten - 27.11.2010

------


Respuesta: Re: Jump height - MrDeath537 - 27.11.2010

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.


Re: Jump height - Kitten - 27.11.2010

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



Re: Jump height - The_Gangstas - 27.11.2010

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



Re: Jump height - Kitten - 27.11.2010

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.



Re: Jump height - [L3th4l] - 27.11.2010

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.


Re: Jump height - Kitten - 27.11.2010

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


Re: Jump height - iFriSki - 27.11.2010

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