Raised This Month: $ Target: $400
 0% 

Jump direction problem , going elsewhere =/


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dstopgunner
Senior Member
Join Date: Oct 2007
Old 04-02-2009 , 06:24   Jump direction problem , going elsewhere =/
Reply With Quote #1

Hello all please solve my problem.
Im trying to make pple jump bigger & longer jumps by pressing the normal jump key (spacebar). I need to to be Higher and longer , not just higher , not just longer alone , to the direction where the player is aiming (crosshair).

Serached and found people only making higherjumps or giving longjump module , I dont want longjump module =/

Using this code I jump higher and longer but not in the direction of where my crosshair is , pls point out to me my errors.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
 
public plugin_init()
{
register_plugin("Hugejump","1.0","DS_ToP_GunNeR")
register_forward(FM_PlayerPreThink,"FM_PreThink")
}
public 
FM_PreThink(id)
{
if((
pev(id,pev_button) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
{
if(!(
pev(id,pev_oldbuttons) & IN_JUMP))
{
new 
Floatvelocity[3]
new 
Floatorigin[3]
velocity_by_aim(id800origin)
 
velocity[0] += origin[0] + 1000
velocity
[1] += origin[1] + 1000
velocity
[2] += origin[2] + 500
entity_set_vector
(id,EV_VEC_velocity,velocity)
return 
PLUGIN_HANDLED

}
return 
PLUGIN_HANDLED

dstopgunner is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-02-2009 , 13:52   Re: Jump direction problem , going elsewhere =/
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
 
public plugin_init()
{
    
register_plugin("Hugejump","1.0","DS_ToP_GunNeR")
    
register_forward(FM_PlayerPreThink,"FM_PreThink")
}
public 
FM_PreThink(id)
{
    if((
pev(id,pev_button) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
    {
        if(!(
pev(id,pev_oldbuttons) & IN_JUMP))
        {
            new 
Floatvelocity[3]
            
velocity_by_aim(id800velocity)
            
set_pev(id,pev_velocity,velocity)
        } 
    }

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 04-02-2009 , 15:12   Re: Jump direction problem , going elsewhere =/
Reply With Quote #3

also, use fm_cmdstart instead of fm_prethink. using cmdstart will save a lot performance.
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
dstopgunner
Senior Member
Join Date: Oct 2007
Old 04-03-2009 , 04:49   Re: Jump direction problem , going elsewhere =/
Reply With Quote #4

Quote:
also, use fm_cmdstart instead of fm_prethink. using cmdstart will save a lot performance.
So you mean..
PHP Code:
#include <amxmodx> 
#include <fakemeta> 
  
public plugin_init() 

    
register_plugin("Hugejump","1.0","DS_ToP_GunNeR"
    
register_forward(FM_PlayerPreThink,"FM_Cmdstart"

public 
FM_Cmdstart(id

    if((
pev(id,pev_button) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND)) 
    { 
        if(!(
pev(id,pev_oldbuttons) & IN_JUMP)) 
        { 
            new 
Floatvelocity[3
            
velocity_by_aim(id800velocity
            
set_pev(id,pev_velocity,velocity
        }  
    } 

???
dstopgunner is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-03-2009 , 05:01   Re: Jump direction problem , going elsewhere =/
Reply With Quote #5

Like this.

PHP Code:
#include <amxmodx> 
#include <fakemeta> 
  
public plugin_init() 

    
register_plugin("Hugejump","1.0","DS_ToP_GunNeR"
    
register_forward(FM_CmdStart,"Forward_CmdStart"

public 
Forward_CmdStart(iduc_handleseed

    static 
ButtonoldButton;
    
Button get_uc(uc_handleUC_Buttons);
    
oldButton pev(idpev_oldbuttons);
    
    if(
Button IN_JUMP && !(oldButton IN_JUMP) && pev(id,pev_flags) & FL_ONGROUND
    {
        new 
Floatvelocity[3];
        
velocity_by_aim(id800velocity);
        
set_pev(id,pev_velocity,velocity);
    } 

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-03-2009 , 09:05   Re: Jump direction problem , going elsewhere =/
Reply With Quote #6

Quote:
Originally Posted by Dores View Post
PHP Code:
&& !(oldButton IN_JUMP
Why?
SnoW is offline
Send a message via MSN to SnoW
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 04-03-2009 , 10:40   Re: Jump direction problem , going elsewhere =/
Reply With Quote #7

first of all look at dores code to know how FM_CmdStart works (get_uc and not pev). you just changed your forwards name although you were still using FM_PlayerPreThink.

UC_Buttons & IN_JUMP or pev_button & IN_JUMP will be true for more than a single frame which means you will accelerate the player faster than you want him to be. for this you can easily use !( pev_oldbuttons & IN_JUMP ).

example:
1st frame - you jump - pev_button & IN_JUMP && !( pev_oldbuttons & IN_JUMP ) - you are in air
2nd frame - your in air and still pressing +jump - pev_button & IN_JUMP && pev_oldbuttons & IN_JUMP
3rd frame - you release jump - !( pev_button & IN_JUMP ) && pev_oldbuttons & IN_JUMP
4th frame - still in air - !( pev_button & IN_JUMP ) && !( pev_oldbuttons & IN_JUMP )
...
~70th frame - you land - !( pev_button & IN_JUMP ) && !( pev_oldbuttons & IN_JUMP )
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode