Raised This Month: $ Target: $400
 0% 

Lay active player down


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-21-2007 , 12:38   Lay active player down
Reply With Quote #1

Is there a way to get a player who is alive to lay on the ground without having to create a new model? Like the dead model, but when they are alive. I am creating a plugin that acts like Kagome's sit command on Inuyasha. If I can't do it without using extra models, how can I pull the player into the ground so they can't move?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 03-21-2007 , 20:31   Re: Lay active player down
Reply With Quote #2

To "bury" a player so that they are stuck in the ground and cannot move:

Code:
public bury_player( id ) {     // Set client to be "not solid" so he is able to be placed below ground     set_pev( id, pev_solid, SOLID_NOT );     // Get Client's current origin     new Float:myorigin[3];     pev( id, pev_origin, myorigin );     // Decrease Z axis by 30 so client is in the ground a bit     myorigin[2] -= 30.0;     // Set client's origin to the adjusted variable, "myorigin"     set_pev( id, origin, myorigin ); }

Now, to make it visually look like the client is laying down, you're going to have to change his appearance.

You can:

A. Find another model that looks like a player laying down
B. Find a sequence in the player model file that looks like what you want

I'm assuming you'll want the sequence option, so in order to do that:

Code:
new is_laying[33]; public plugin_init() {     register_forward( FM_AddToFullPack, "hook_AddToFullPack_post", 1 ); } public hook_AddToFullPack_post( es_handle, e, id, host, hostflags, player, pSet ) {     // Test if the player should be "dead" using a global variable, persay     // Also make sure "player" is 1, to ensure it's a player entity (will keep lag down)     if( !player || !is_laying[id] ) return FMRES_IGNORED;     // Set Player's Sequence to the Death Animation     // (change SEQUENCE_ANIM)     set_es( es_handle, ES_Sequence, SEQUENCE_ANIM );     // Set the Frame to the desired look (view the model's animation to get this)     // (change FRAME_NUM)     set_es( es_handle, ES_Frame, FRAME_NUM );     // Set the FrameRate to 0 so it doesn't "jitter"     set_es( es_handle, ES_FrameRate, Float:0.0 ); }

Reply here if you've got more questions on it. If you alter the animation, you'll probably want to change the Z offset in the above function to a lower value than 30, so it still looks like the player is above ground to the other players.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-21-2007 , 22:48   Re: Lay active player down
Reply With Quote #3

Okay, if I want to use the last frame of the death1 animation, what would I replace SEQUENCE_ANIM and FRAME_NUM with?

Also, I get a warning saying that hook_AddToFullPack_post needs to return something, what should I return?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 03-22-2007 , 03:42   Re: Lay active player down
Reply With Quote #4

FMRES_HANDLED or FMRES_IGNORED
VEN is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 03-22-2007 , 18:26   Re: Lay active player down
Reply With Quote #5

Correct. Forgot that line.

And for the sequence, you could open the model in a model viewer, but I have found the best way to find the right frame is to mess with it yourself.

Create a pcvar and alter it in-game, and use that to control the sequence.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-27-2007 , 16:18   Re: Lay active player down
Reply With Quote #6

Okay, I got the laying down thing to work now. Thanks for that. Now, I need to figure out how to prevent someone from moving while they are laying down.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 03-27-2007 , 18:26   Re: Lay active player down
Reply With Quote #7

The first "code block" I posted does that. It makes them "not solid" then puts them under ground. That should prevent them from moving.

It's been a few months since I've done that, so maybe you have to set him back to solid after you put him underground...but I think that should be enough..

Did you try the first code block?
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-03-2007 , 13:41   Re: Lay active player down
Reply With Quote #8

Thanks, that worked. This isn't a big deal, but it would be nice if it was possible. Could I maybe prevent the target from looking around when they are laying down? Again, not a big deal, just something that would be interesting if possible
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 01:21.


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