AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Gravity on demand (https://forums.alliedmods.net/showthread.php?t=28738)

SuperDuper 05-21-2006 15:59

Gravity on demand
 
I am trying to make a plugin so that if you are falling from a high ledge, you can use this command and have gravity go lower for you. But when ever i press it in the air, nothing happens. when im on the ground, i hop a little

Code:

#include <amxmodx>
 #include <amxmisc>
 #include <engine>


public plugin_init(){
                register_plugin ("parachute", "1.0", "SuperDuper");
                register_clcmd("parachute","parachute")
                }

public parachute(id){
        if(get_entity_flags(id) & FL_ONGROUND) {
                new Float: velocity[3]
                entity_get_vector(id,EV_VEC_velocity,velocity)
                velocity[2] = 200.0
                entity_set_vector(id,EV_VEC_velocity,velocity)
                return PLUGIN_HANDLED
        }
        return PLUGIN_HANDLED
}

is velocity the same thing as gravity? :arrow: :arrow: :arrow:

Hawk552 05-21-2006 16:06

Try this:

Code:
#include <amxmodx>  #include <amxmisc>  #include <engine> public plugin_init(){       register_plugin ("parachute", "1.0", "SuperDuper");       register_clcmd("parachute","parachute") } public parachute(id){    if(!(get_entity_flags(id) & FL_ONGROUND)) {       new Float: velocity[3]       entity_get_vector(id,EV_VEC_velocity,velocity)       velocity[2] = 0.0       entity_set_float(id,EV_FL_gravity,0.1)       entity_set_vector(id,EV_VEC_velocity,velocity)       return PLUGIN_HANDLED    }    return PLUGIN_HANDLED }

SuperDuper 05-21-2006 16:12

that worked, except when i press it the gravity stays like that, its toggling it, is there a way to make it so you must hold down the button? or must it be toggled on and off?

Hawk552 05-21-2006 16:17

Try this. Please be aware that I don't know the default value of gravity. I tried 800.0, but it's probably either that or 1.0. Try both if 800.0 doesn't work.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> public plugin_init(){     register_plugin ("parachute", "1.0", "SuperDuper");     register_clcmd("+parachute","parachute")     register_clcmd("-parachute","parachute") } public parachute(id) {     new szArg[2]     read_argv(0,szArg,1)         if(szArg[0] == '+')     {           if(!(get_entity_flags(id) & FL_ONGROUND))         {             new Float: velocity[3]             entity_get_vector(id,EV_VEC_velocity,velocity)             velocity[2] = 0.0             entity_set_float(id,EV_FL_gravity,0.1)             entity_set_vector(id,EV_VEC_velocity,velocity)             return PLUGIN_HANDLED         }     }     else if(szArg[0] == '-')         entity_set_float(id,EV_FL_gravity,800.0)             return PLUGIN_HANDLED }

SuperDuper 05-21-2006 16:25

Lol, Now it is acting like brakes, i bound +parachute to uparrow and -parachute to downarrow, so when i hold down arrow i stop moving, but not in the air

Hawk552 05-21-2006 16:28

That's not how it works. Bind a key to +parachute and -parachute will automatically be executed.

SuperDuper 05-21-2006 16:30

i tried again, i didnt fall any slower, i tried holding it and i tried pressing it.

Hawk552 05-21-2006 16:34

Try this:

Code:
#include <amxmodx> #include <amxmisc> #include <engine> public plugin_init() {     register_plugin ("parachute", "1.0", "SuperDuper");     register_clcmd("+parachute","parachute")     register_clcmd("-parachute","parachute") } public parachute(id) {     new szArg[2]     read_argv(0,szArg,1)         if(szArg[0] == '+')     {             if(!(get_entity_flags(id) & FL_ONGROUND))         {             entity_set_float(id,EV_FL_gravity,0.1)             entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})             return PLUGIN_HANDLED         }     }     else         entity_set_float(id,EV_FL_gravity,800.0)         return PLUGIN_HANDLED }

SuperDuper 05-21-2006 16:40

everything is perfect, except after i use it, the gravity stays. I cant jump anymore :?

Hawk552 05-21-2006 16:41

Quote:

Originally Posted by SuperDuper
everything is perfect, except after i use it, the gravity stays. I cant jump anymore :?

I said in my previous posts to muck around with the 800.0 ... try 1.0


All times are GMT -4. The time now is 16:24.

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