AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Quick Jump (https://forums.alliedmods.net/showthread.php?t=49234)

spider853 12-30-2006 04:31

Quick Jump
 
I Want To Make A Function That Make The Player Jump Higher But Not Slowly Like Gravity....
Can Somebody Helpme?

XxAvalanchexX 12-30-2006 15:04

Re: Quick Jump
 
Hook when a player jumps. You could do it like so:

Code:
public fw_playerprethink(id) // FM_PlayerPreThink hook {     if((pev(id,pev_button) & IN_JUMP) && !(pev(id,pev_oldbuttons) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))     {         // PLAYER JUMPED     } }

Make sure you hook FM_PlayerPreThink to that function (or, if using engine, make that function client_PreThink). It checks if they just pressed the jump button, and if they are on the ground. These are pretty much the conditions for a jump.

Then, you will want to grab their current velocity, change it's Z value (dimenson "2") to whatever you want (-1000?), and then set their velocity to that new value.

spider853 12-30-2006 18:08

Re: Quick Jump
 
But If I Change The Z Value They Can Stuck In The Ground... :(

If I Can Get The Vector ... And If Its Up Then Put The Gravity in - Else + and Make The Player Immune To Ground Hit

XxAvalanchexX 12-30-2006 18:52

Re: Quick Jump
 
Don't change their origin, only their velocity.

Code:
new Float:velocity[3]; pev(id,pev_velcoity,velocity); velocity[2] = -1000.0; set_pev(id,pev_velocity,velocity);

This should make them shoot upwards, still obeying the laws of HL physics (they'll stop if they hit something, and will eventually fall back down).

VEN 12-31-2006 01:07

Re: Quick Jump
 
And why negative Z-velocity value? :-/

XxAvalanchexX 12-31-2006 01:19

Re: Quick Jump
 
Because I forgot which way was up.

VEN 12-31-2006 03:27

Re: Quick Jump
 
I see, up is positive for Z-velocity.

spider853 12-31-2006 08:08

Re: Quick Jump
 
OK SO I Need FakeMeta And Engine?

spider853 12-31-2006 08:27

Re: Quick Jump
 
I MADE'it... WE Made'it.. It Jump...
Now i know how to make the bunnyjump :)
velocity[0]*=1.2
velocity[1]*=1.2

but now i need to Make The Player Immune To Ground Hit

:)

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fakemeta> //#include <fakemeta_util> #include <engine>   #define PLUGIN "Spider" #define VERSION "1.0" #define AUTHOR "JumpMod"   public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)  register_forward(FM_PlayerPreThink,"pref",0)  // Add your code here... } public pref(id) {  if((pev(id,pev_button) & IN_JUMP) && !(pev(id,pev_oldbuttons) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))     {         new Float:velocity[3];  pev(id,pev_velocity,velocity);  velocity[0]*=1.5  velocity[1]*=1.5  velocity[2] = 500.0;    set_pev(id,pev_velocity,velocity);     } }

VEN 12-31-2006 09:37

Re: Quick Jump
 
For example:
Code:
#include <amxmodx> #include <fakemeta> #define MAX_PLAYERS 32 new bool:g_in_the_air[MAX_PLAYERS + 1] public plugin_init() {     register_forward(FM_PlayerPostThink, "forward_player_postthink") } public forward_player_postthink(id) {     if (!is_user_alive(id))         return FMRES_IGNORED     if (!(pev(id, pev_flags) & FL_ONGROUND))         g_in_the_air[id] = true     else if (g_in_the_air[id]) {         set_pev(id, pev_watertype, CONTENTS_WATER)         g_in_the_air[id] = false     }     return FMRES_IGNORED }


All times are GMT -4. The time now is 22:23.

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