Raised This Month: $ Target: $400
 0% 

changing user velocity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-22-2007 , 14:13   changing user velocity
Reply With Quote #1

I am looking to change a users velocity if he touches a certain entity and it will boost him forward.

__-```-__
this is normal jump

__---````````````---__
this is boost jump after touch entity

Get the idea ?

I have this already maybe im stupid on my code.

Code:
public plugin_init() {     (...)     register_forward(FM_Touch, "fwdTouch", 0);     register_forward(FM_PlayerPreThink, "client_PreThink");     (...) } public client_PreThink(id) {     if(!is_user_alive(id))         return PLUGIN_CONTINUE;     new flags = pev(id, pev_flags);     if(hasboost[id])     {         if(flags & FL_ONGROUND)         {             set_pev(id,pev_velocity,{0.0, 0.0, 0.0});             hasboost[id] = false;             return PLUGIN_CONTINUE;         }     }     return PLUGIN_CONTINUE; } public fwdTouch(ent, id) {     (...)     new Float:velocity[] = {0.0, 128.0, 0.0};     (...)     else if(equali(szClassname, "booster"))     {         set_pev(id,pev_velocity,velocity);         hasboost[id] = true;         return PLUGIN_HANDLED_MAIN;     }     return PLUGIN_HANDLED_MAIN; }
bwgrubbs1 is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-22-2007 , 19:27   Re: changing user velocity
Reply With Quote #2

Wtf is that???

use pev_velocity , velocity_by_aim and set_pev
kmal2t is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-23-2007 , 02:16   Re: changing user velocity
Reply With Quote #3

what are you talking about ?
bwgrubbs1 is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-23-2007 , 02:46   Re: changing user velocity
Reply With Quote #4

post #2 doesnt know what fakemeta is, and I am not good enough to help you.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-23-2007 , 03:16   Re: changing user velocity
Reply With Quote #5

Now that I look at it...I think he does know what he's talking about...but he just kinda told me to use stuff like i was stupid.

Well in this case I am...because I looked up what he said

velocity_by_aim

but I dont know HOW to use this function. They give an example, but i am still unclear.

Quote:
Originally Posted by tsimscabinet at msn dot com
This native can easily be manually done with more alteration. This is an example of such:
new Float:vAngles[3] // plug in the view angles of the entity
new Float:vReturn[3] // to get out an origin fDistance away
new Float:fDistance = 400.0 // fDistance being the distance from the entity of your choice
entity_get_vector(id,EV_VEC_v_angles,vAngles)
vReturn[0] = floatcos( vAngles[1], degrees ) * fDistance
vReturn[1] = floatsin( vAngles[1], degrees ) * fDistance
vReturn[2] = floatsin( -vAngles[0], degrees ) * fDistance
bwgrubbs1 is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-23-2007 , 13:48   Re: changing user velocity
Reply With Quote #6

I didn't give a detailed explanation because I made the assumption you AREN'T stupid and could figure out what I meant. This should work for you fine. the *A* means you are going to have to figure out how to classify your entity since it probably wont be func_wall. You have cvars for how fast (speed), how high you want them (speed_height) and how long you want the boost to last (speed_time).
Code:
#include <amxmodx> #include <fakemeta> new bool:touchENT[33], bool:canSpeed[33]; new Float:veloc1[33][3],Float:veloc2[33][3]; public plugin_init() {     register_plugin("Boost", "1.0", "Skittles");     register_forward(FM_PlayerPreThink, "FM_pthink");     register_forward(FM_Touch, "FM_tch");     register_cvar("speed_height", "100.0");     register_cvar("speed", "1000");     register_cvar("speed_time", "1.0"); } public waiter(id) {     touchENT[id] = false;     canSpeed[id] = true;     set_task(get_cvar_float("speed_time"), "speedOFF", id); } public speedOFF(id) {     canSpeed[id] = false; } public FM_pthink(id) {     if(is_user_alive(id) && !is_user_bot(id)) {         if(touchENT[id]) {             waiter(id);         }         if(canSpeed[id]) {             client_cmd(id, "+jump;wait;-jump");             pev(id, pev_velocity, veloc1[id]);             velocity_by_aim(id, get_cvar_num("speed"), veloc2[id]);             veloc2[id][2] = get_cvar_float("speed_height");             set_pev(id, pev_velocity, veloc2[id])         }     } } public FM_tch(id, Touched) {     if(is_user_alive(id)) {         new class1[32];         pev(Touched, pev_classname, class1, 31);         if(equal(class1, "func_wall")) {    //*A*             touchENT[id] = true;         }     } }

If you want the height to just be normal jump height just remove the speed_height cvar in plugin_init and change
Code:
veloc2[id][2] = get_cvar_float("speed_height");
to
Code:
veloc2[id][2] = veloc1[id][2];

Last edited by kmal2t; 06-23-2007 at 13:54.
kmal2t is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 06-24-2007 , 04:27   Re: changing user velocity
Reply With Quote #7

no errors or anything...but does nothing.
bwgrubbs1 is offline
Old 06-24-2007, 06:11
kmal2t
This message has been deleted by sawce the snail. Reason: stop flaming.
kmal2t
BANNED
Join Date: Apr 2006
Old 06-24-2007 , 14:58   Re: changing user velocity
Reply With Quote #9

Wow I don't even remember posting last night, yet I got one (two?) posts deleted.. strange. Anyway, if it doesn't work its because you hhave to change func_wall to whatever your entitiy is.
kmal2t 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:33.


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