This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Grenade throwing animation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 01:09   Grenade throwing animation
Reply With Quote #1

Is there anyway to trigger a grenade throwing animation? For example, in a plugin I'm testing, I'd like it to act exactly as if I was throwing a grenade when I press whatever button is bound to "throw".
SubFive is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-31-2005 , 01:19  
Reply With Quote #2

This is what I did:
Code:
public client_PreThink( id ) {   // check some vars first and whatnot..   set_animation(id, 2); } public set_animation( id, seq ) {   entity_set_int(id, EV_INT_weaponanim, seq);   message_begin(MSG_ONE, SVC_WEAPONANIM, {0,0,0}, id);   write_byte(seq);   write_byte(entity_get_int(id, EV_INT_body));   message_end(); }
In this case the sequence # for the grenade throwing animation is 2.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 01:20  
Reply With Quote #3

Looks good, thanks!
SubFive is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 02:08  
Reply With Quote #4

Tested it out, and it didnt go quite as planned. Maybe it was because of how I made the script to test it out. I gave myself enough money and the animation looked very weird with guns out, although that might be expected as its not a nade, and thats the animation I'm trying to do. So I gave my self a nade and then enough money to trigger it. Looked funky, I dont think that was how it was suppose to work. Any ideas?

Code:
#include <amxmodx> #include <cstrike> #include <engine> public client_PreThink(id) {     new money = cs_get_user_money(id);     if(money > 5000)     {         set_animation(id, 2);     } } public set_animation( id, seq ) {     entity_set_int(id, EV_INT_weaponanim, seq);     message_begin(MSG_ONE, SVC_WEAPONANIM, {0,0,0}, id);     write_byte(seq);     write_byte(entity_get_int(id, EV_INT_body));     message_end(); }
SubFive is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-31-2005 , 02:20  
Reply With Quote #5

Hmm.. Check if they have a nade out first and holding the attack button:
Code:
public client_PreThink(id) {     new money = cs_get_user_money(id);     new clip, ammo, weapid = get_user_weapon(id, clip, ammo);     new button = get_user_button(id);     if((weapid == 4 || weapid == 9 || weapid == 25) && button&IN_ATTACK && money > 5000)     {         set_animation(id, 2);     } }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 02:40  
Reply With Quote #6

The thing is, I want this animation to be able to happen (correctly ) regardless of what the user is currently holding, wether it be a gun, nade, or shield, etc.
SubFive is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-31-2005 , 02:44  
Reply With Quote #7

Then you will have to set the model to the grenade one for all weaps
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 02:49  
Reply With Quote #8

So basically that means its not doable? A little tired, sorry if I dont understand everything at first. What I think you just told me is that basically the animation wont work unless a grenade is at hand, so in that case, could I quickly switch the users weapon from whatever it is to any grenade the user has in his inventory, do the animation, and then switch back to the gun?
SubFive is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-31-2005 , 03:06  
Reply With Quote #9

Code:
if(user_has_weapon(id, CSW_HEGRENADE)) {   engclient_cmd(id, "weapon_hegrenade");   // set animation   set_task(1.5, "revert_back", id); // change 1.5 to the length of the animation }
Code:
public revert_back( id ) {   client_cmd(id, "lastinv"); // or w/e is bound to the 'q' key .. }
Not 100% sure it'll work but w/e, I'm tired
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
SubFive
Senior Member
Join Date: Dec 2005
Location: USA
Old 12-31-2005 , 03:14  
Reply With Quote #10

Quote:
Originally Posted by v3x
Code:
engclient_cmd(id, "weapon_hegrenade");
Wouldn't this actually make the person throw the grenade, instead of just doing the animation?
SubFive 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 19:15.


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