Raised This Month: $ Target: $400
 0% 

Gravity on demand


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SuperDuper
Member
Join Date: May 2006
Location: na
Old 05-21-2006 , 15:59   Gravity on demand
Reply With Quote #1

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?
__________________
[Team.Profit] Profit' <LDR>. Our server owns!

CS:CZ or DIE
SuperDuper is offline
Send a message via AIM to SuperDuper Send a message via MSN to SuperDuper Send a message via Yahoo to SuperDuper
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-21-2006 , 16:06  
Reply With Quote #2

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 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
SuperDuper
Member
Join Date: May 2006
Location: na
Old 05-21-2006 , 16:12  
Reply With Quote #3

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?
__________________
[Team.Profit] Profit' <LDR>. Our server owns!

CS:CZ or DIE
SuperDuper is offline
Send a message via AIM to SuperDuper Send a message via MSN to SuperDuper Send a message via Yahoo to SuperDuper
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-21-2006 , 16:17  
Reply With Quote #4

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 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
SuperDuper
Member
Join Date: May 2006
Location: na
Old 05-21-2006 , 16:25  
Reply With Quote #5

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
__________________
[Team.Profit] Profit' <LDR>. Our server owns!

CS:CZ or DIE
SuperDuper is offline
Send a message via AIM to SuperDuper Send a message via MSN to SuperDuper Send a message via Yahoo to SuperDuper
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-21-2006 , 16:28  
Reply With Quote #6

That's not how it works. Bind a key to +parachute and -parachute will automatically be executed.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
SuperDuper
Member
Join Date: May 2006
Location: na
Old 05-21-2006 , 16:30  
Reply With Quote #7

i tried again, i didnt fall any slower, i tried holding it and i tried pressing it.
__________________
[Team.Profit] Profit' <LDR>. Our server owns!

CS:CZ or DIE
SuperDuper is offline
Send a message via AIM to SuperDuper Send a message via MSN to SuperDuper Send a message via Yahoo to SuperDuper
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-21-2006 , 16:34  
Reply With Quote #8

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 }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
SuperDuper
Member
Join Date: May 2006
Location: na
Old 05-21-2006 , 16:40  
Reply With Quote #9

everything is perfect, except after i use it, the gravity stays. I cant jump anymore
__________________
[Team.Profit] Profit' <LDR>. Our server owns!

CS:CZ or DIE
SuperDuper is offline
Send a message via AIM to SuperDuper Send a message via MSN to SuperDuper Send a message via Yahoo to SuperDuper
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-21-2006 , 16:41  
Reply With Quote #10

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
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 16:24.


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