Raised This Month: $51 Target: $400
 12% 

How to push player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gCode
Junior Member
Join Date: Mar 2011
Old 03-09-2011 , 15:01   How to push player?
Reply With Quote #1

How to push player?
gCode is offline
Samantha
SourceMod Donor
Join Date: Feb 2010
Location: Madagascar
Old 03-09-2011 , 15:12   Re: How to push player?
Reply With Quote #2

PHP Code:
decl Float:Push[3];
//Put the velocity in that ^.
TeleportEntityClientNULL_VECTORNULL_VECTORPush); 
__________________
"I give sopport and knolage in making extractions"
"MASTER(D) - dun0: are you mocing me?" -Master the grate

Plugins
Godmode Until Attack | No Block Team Filter
Extensions
Rcon Hooks
Samantha is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 03-09-2011 , 15:34   Re: How to push player?
Reply With Quote #3

Would that not just teleport them to the new location, or does it actually move them there at an adjustable rate?

I always just used SetEntDataVector( client, m_vecBaseVelocity, velocity, true );
__________________
zeroibis is offline
gCode
Junior Member
Join Date: Mar 2011
Old 03-09-2011 , 15:50   Re: How to push player?
Reply With Quote #4

Samantha, I'm using it... i want to create knockback on event hurt. but it freeze player in sky when he jump or he fall from sky.
gCode is offline
Samantha
SourceMod Donor
Join Date: Feb 2010
Location: Madagascar
Old 03-09-2011 , 15:54   Re: How to push player?
Reply With Quote #5

You would have to calculate the forces you wanna act on the client, X Y Z. What did u put in the push vectors?

zeroibis, that does work and it wouldn't teleport the client anywhere since we are passing NULL for vectors.
__________________
"I give sopport and knolage in making extractions"
"MASTER(D) - dun0: are you mocing me?" -Master the grate

Plugins
Godmode Until Attack | No Block Team Filter
Extensions
Rcon Hooks
Samantha is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 03-09-2011 , 22:44   Re: How to push player?
Reply With Quote #6

It goes
TeleportEntity(entity, positionvector, anglevector, velocityvector)

So passing null for the first two doesn't change client position, nor angle, just velocity.

Just a clarification for anybody that didn't understand.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
Samantha
SourceMod Donor
Join Date: Feb 2010
Location: Madagascar
Old 03-09-2011 , 23:07   Re: How to push player?
Reply With Quote #7

Quote:
Originally Posted by FlaminSarge View Post
It goes
Just a clarification for anybody that didn't understand.
Thank you for your fabulous clarification FlaminSarge
__________________
"I give sopport and knolage in making extractions"
"MASTER(D) - dun0: are you mocing me?" -Master the grate

Plugins
Godmode Until Attack | No Block Team Filter
Extensions
Rcon Hooks
Samantha is offline
Invader Amoto
Member
Join Date: May 2009
Old 03-12-2011 , 16:00   Re: How to push player?
Reply With Quote #8

If you want to get a "realistic" feeling push like the explosions in the game give, you should get the client's current velocity, then add the "push" velocity vector to it, and teleport him there. With the way that is suggested, it will feel more like being airblasted or hit with the fan, which basically stops all your momentum and just pushes you at the same speed regardless of what you're doing.

This should go in OnPluginStart() with playerVelOffset as a global variable.
PHP Code:
playerVelOffset FindSendPropOffs("CBasePlayer""m_vecVelocity[0]"); 
And then use this to get "client"'s current velocity
PHP Code:
new Float:currentVelocity[3];
GetEntDataVector(clientplayerVelOffsetcurrentVelocity); 
You can then add a vector to his current velocity, and do what was suggested earlier in the thread with TeleportEntity.
Invader Amoto 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 16:59.


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