Raised This Month: $ Target: $400
 0% 

Decrease jump height


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Afrow UK
Junior Member
Join Date: Feb 2007
Old 03-04-2007 , 14:55   Decrease jump height
Reply With Quote #1

Hey guys, I was wondering if you could show me how to decrease the jumping height?

This is the code I've created so far:
Code:
public fwd_playerprethink(id)
{
  if (pev(id, pev_button) & IN_JUMP
  && !(pev(id, pev_oldbuttons) & IN_JUMP)
  && pev(id, pev_flags) & FL_ONGROUND )
  {
    client_print(id, print_center, "boo!")
  }
  return FMRES_IGNORED
}
I'm not quite sure what to do next. I've tried using EV_VEC_velocity with a negative value but that doesn't seem to work...


Stu
Afrow UK is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-04-2007 , 15:05   Re: Decrease jump height
Reply With Quote #2

change their personal gravity, set_user_gravity()
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
amxx4life
BANNED
Join Date: Mar 2007
Old 03-04-2007 , 18:05   Re: Decrease jump height
Reply With Quote #3

thanks this will help1
amxx4life is offline
Afrow UK
Junior Member
Join Date: Feb 2007
Old 03-05-2007 , 08:41   Re: Decrease jump height
Reply With Quote #4

That worked well. Just had to make sure I reset the gravity after 0.1 seconds though (otherwise players will crater).

Now, how can I detect if a player is running?
get_user_maxspeed returns 0 for running and walking, and IN_RUN doesn't seem to work.

Cheers

Stu
Afrow UK is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-05-2007 , 18:07   Re: Decrease jump height
Reply With Quote #5

I think that IN_RUN is when you press shift. ( I can't start my cs to test it. )

I belive this will work for run.
Code:
public fw_PlayerPreThink(id) {     new Float:fVel[3]     pev(id, pev_velocity, fVel)     if ( floatabs(fVel[0]) + floatabs(fVel[2]) > run_speed ) {         // running     } }
This will probably be a safe way to catch jump
Code:
new bool:g_jump[33]; public fw_PlayerPreThink(id) {         if ( pev(id, pev_button) & IN_JUMP && ! ( pev(id, pev_oldbuttons) & IN_JUMP ) && pev(id, pev_flags) & FL_ONGROUND )         g_jump[id] = true;         if ( g_jump[id] ) {         new Float:fVel[3];         pev(id, pev_velocity, fVel);                 if ( fVel[2] <= 0 ) {             g_jump[id] = false;             set_user_gravity(id, 1.0);         }         else             set_user_gravity(id, 1.5);     } }

Last edited by [ --<-@ ] Black Rose; 03-05-2007 at 18:09.
[ --<-@ ] Black Rose is offline
Afrow UK
Junior Member
Join Date: Feb 2007
Old 03-06-2007 , 12:39   Re: Decrease jump height
Reply With Quote #6

Thanks for the help. I've found a problem now. Although setting the gravity to high prevents the player from jumping, they still leave the ground and then make a noise when they hit the ground again. People will abuse this.

Is there any way to block the jump completely?

Stu
Afrow UK is offline
Afrow UK
Junior Member
Join Date: Feb 2007
Old 03-06-2007 , 13:01   Re: Decrease jump height
Reply With Quote #7

This is the code I have that is meant to block jumping:
Code:
public fwd_playerprethink(id)
{
  if (pev(id, pev_button) & IN_JUMP
  && !(pev(id, pev_oldbuttons) & IN_JUMP)
  && pev(id, pev_flags) & FL_ONGROUND)
  {
    client_print(id, print_center, "hello")
    set_pev(id, pev_button, pev(id, pev_button) & ~IN_JUMP)
  }
}
Any ideas why it does nothing (even though the hello message appears)?

Stu
Afrow UK is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 03-06-2007 , 13:18   Re: Decrease jump height
Reply With Quote #8

that works only if player is in jump and on ground :/
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Afrow UK
Junior Member
Join Date: Feb 2007
Old 03-06-2007 , 14:29   Re: Decrease jump height
Reply With Quote #9

Yeh I removed "pev(id, pev_flags) & FL_ONGROUND)" from the if but it's still the same. I found a topic on this forum which says that this isn't possible. Not sure exactly why but anyway.

I next tried blocking the drop sounds so that the player fell silently, but that wasn't possible either. The sounds being emitted do not call FM_EmitSound (or FM_EmitAmbientSound). Not quite sure what to try next...

Stu
Afrow UK is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-07-2007 , 01:47   Re: Decrease jump height
Reply With Quote #10

This should probably work.
PreThink sucks.
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin("", "", "")     register_forward(FM_CmdStart,"fwd_CmdStart") } public fwd_CmdStart(id, uc_handle, seed) {         if ( ! is_user_alive(id) )         return FMRES_IGNORED         new buttons = get_uc(uc_handle, UC_Buttons)         if ( buttons & IN_JUMP ) {         buttons &= ~IN_JUMP         set_uc(uc_handle, UC_Buttons, buttons)     }     return FMRES_IGNORED }

Last edited by [ --<-@ ] Black Rose; 03-07-2007 at 01:49.
[ --<-@ ] Black Rose is offline
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 08:41.


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