Raised This Month: $ Target: $400
 0% 

set_pev ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-19-2007 , 14:50   set_pev ?
Reply With Quote #1

I have this code for a new entity that i am touching that will give you low gravity for 4 seconds and execute jump.

My way of thinking is that this would work..but it seems not to.

Here is what I have ...

Code:
public fwdTouch(ent, id) {     (...)     else if(equali(szClassname, "lowgrav"))     {         set_pev(id,pev_gravity,200);         client_cmd(id, "+jump");         set_task(4.0,"normal_grav");         return PLUGIN_HANDLED_MAIN;     } return PLUGIN_HANDLED_MAIN; }

Code:
public normal_grav(id) {     set_pev(id,pev_gravity,800);     client_cmd(id, "-jump"); }

The problems I am having are when you touch entity it gives you low gravity, but i think it starts out around 200 then goes to 0 or a neg value...cuz you never come down. Then on new round you can't jump...which i think is because your gravity is still set too low.

Anyone...lol ?
bwgrubbs1 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-19-2007 , 15:24   Re: set_pev ?
Reply With Quote #2

First off, pev_gravity needs a float.

Second, I could be wrong, but I think pev_gravity is based on a 1.0 scale. (1.0 being normal grav)

And why not just use fun?
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`
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-19-2007 , 20:42   Re: set_pev ?
Reply With Quote #3

Well, thank you for all your input, and ...

Quote:
Originally Posted by Emp` View Post
And why not just use fun?
i just like using the pev's i think its funner and i dont wanna include fun also...

Quote:
Originally Posted by Greenberet View Post
you dont send the client id through set_task
What do you mean by this ?

Quote:
Originally Posted by Emp` View Post
I could be wrong, but I think pev_gravity is based on a 1.0 scale.
I will try this out...THANKS
bwgrubbs1 is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 06-19-2007 , 15:25   Re: set_pev ?
Reply With Quote #4

you dont send the client id through set_task
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Zenith77
Veteran Member
Join Date: Aug 2005
Old 06-19-2007 , 17:10   Re: set_pev ?
Reply With Quote #5

As Emp` pointed out, pev_gravity from what I've seen is just a scale based on sv_gravity. For example, if the server gravity were to be 800 and an entity/player's pev_gravity would be 1 they would act according to the server's gravity value of 800. However, if you had pev_gravity set to 0.5 that would be half of the server gravity or 2 for double.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-20-2007 , 03:22   Re: set_pev ?
Reply With Quote #6

just use an if(!(pev(id, pev_flags) & FL_ONGROUND)) with a bool in a prethink that goes to a function that then turns off the bool and has a 4 sec set task to your grav with the bool resetting once on ground.
kmal2t is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-20-2007 , 11:16   Re: set_pev ?
Reply With Quote #7

Quote:
Originally Posted by kmal2t View Post
just use an if(!(pev(id, pev_flags) & FL_ONGROUND)) with a bool in a prethink that goes to a function that then turns off the bool and has a 4 sec set task to your grav with the bool resetting once on ground.
Could you explain this to me a bit more...if I semi-understand you...I should change the way that i have this coded to...

Code:
new bool:haslowgrav[33]; public client_PreThink(id) {     if(haslowgrav[id])     {           if(FL_ONGROUND);           set_pev(id,pev_gravity,1.0);     }     return PLUGIN_CONTINUE; } public fwdTouch(ent, id) {     static szClassname[33];     pev(ent, pev_classname, szClassname, 32);     (...)     else if(equali(szClassname, "lowgrav"))     {         set_pev(id,pev_gravity,0.20);         client_cmd(id, "+jump");         haslowgrav[id] = true;         return PLUGIN_HANDLED_MAIN;     }     return PLUGIN_HANDLED_MAIN; }

What about something like this...or should i use Post think ?
bwgrubbs1 is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 06-20-2007 , 04:28   Re: set_pev ?
Reply With Quote #8

Code:
set_task(4.0,"normal_grav")

you dont give the client id to set_task, so you wont get it in normal_grav when you call it.

Code:
new CORE[1]; CORE[0] = id; set_task(4.0,"normal_grav",_, CORE, 1 );

and then you have to read the id in the normal_grav function
Code:
public normal_grav(CORE[]) {      new id = CORE[0];      set_pev(id,pev_gravity,800);      client_cmd(id, "-jump"); }
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-20-2007 , 11:06   Re: set_pev ?
Reply With Quote #9

Hum...i have a question! I have those functions :

Code:
public func_call(id)
{
 new parm[1]
 parm[0] = id
 
 set_task(1.0,"_health",_, parm, 1, "b")
}
 
public _health(parm[])
{
 new id = parm[0]
 
 if(!pev_valid(id))
  return 1;
 
 static health = pev(id,pev_health)
 
 if(health >= 100)
  remove_task(id)
 
 set_pev(id,pev_health, health + 2)
}
When health is > or = should remove the task,but is not removed!How i remove task in this case?
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 06-20-2007 , 14:26   Re: set_pev ?
Reply With Quote #10

Quote:
Originally Posted by Alka View Post
How i remove task in this case?
Code:
set_task(0.1, "my_func", 43770) remove_task(43770)
"ID" in this case refers to what you specified when you created the task.

Last edited by Lee; 06-20-2007 at 16:34.
Lee 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 21:32.


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