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

Client throws a grenade > call function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 12-25-2006 , 23:20   Client throws a grenade > call function
Reply With Quote #1

Read the title!

I'm scripting for a Half-Life (1) mod youv'e never heard of (Half-Life 2: Jakin' Bacon Source).
In that mod you can use normal Half-Life grenades.
I want to play a sound everytime a player throws a grenade (by executing the "spk" command in that players console).
So I want to call a function when a player releases a grenade.
Is there a way to do this?
Please help me.
bloodypizza is offline
Send a message via MSN to bloodypizza
The Specialist
BANNED
Join Date: Nov 2006
Old 12-25-2006 , 23:27   Re: Client throws a grenade > call function
Reply With Quote #2

Use a current weapon event like this
Code:
register_event("CurWeapon","fucntion_called","be","1=1","2=4");

It says that the weapon has to be a he grenade(4). The first paramter is the event , the 2nd is the funtion that your hooking to, whatever fucntion youll be calling your code in , then the 3rd paramter is the weapon is active , then the conditions
The Specialist is offline
Send a message via AIM to The Specialist
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-26-2006 , 00:30   Re: Client throws a grenade > call function
Reply With Quote #3

grenade_throw
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-26-2006 , 00:58   Re: Client throws a grenade > call function
Reply With Quote #4

Yes If you wanna use CSX you can use that .
The Specialist is offline
Send a message via AIM to The Specialist
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-26-2006 , 01:53   Re: Client throws a grenade > call function
Reply With Quote #5

Quote:
Originally Posted by The Specialist View Post
Yes If you wanna use CSX you can use that .
actually the way you did can't catch a grenade throw event, it only catch a player switch his weapon to a hegrenade.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-26-2006 , 16:57   Re: Client throws a grenade > call function
Reply With Quote #6

The grenade_throw forwards are only for Counter-Strike and Day of Defeat.

I'd hook FM_SetModel, look for the world grenade model, and then check its owner (make sure it even has one, if not it must not be a thrown grenade).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-26-2006 , 23:48   Re: Client throws a grenade > call function
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
The grenade_throw forwards are only for Counter-Strike and Day of Defeat.

I'd hook FM_SetModel, look for the world grenade model, and then check its owner (make sure it even has one, if not it must not be a thrown grenade).
Except the problem with this is that the entire plugin can be thrown off by a server with model changing plugins. And model changning pugins are on almost every server out there . So its not a very good way to do it .
The Specialist is offline
Send a message via AIM to The Specialist
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-27-2006 , 01:47   Re: Client throws a grenade > call function
Reply With Quote #8

Simply instruct the server operators to place this plugin higher on the list than model changing plugins. Since almost every single model changing plugin changes world models with a FM_SetModel hook, this one will be called first.

If you don't want to do it by model, still hook FM_SetModel, but check classname.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-27-2006 , 01:55   Re: Client throws a grenade > call function
Reply With Quote #9

Quote:
Originally Posted by XxAvalanchexX View Post
Simply instruct the server operators to place this plugin higher on the list than model changing plugins. Since almost every single model changing plugin changes world models with a FM_SetModel hook, this one will be called first.

If you don't want to do it by model, still hook FM_SetModel, but check classname.
What model would you specify for the FM_SetModel if you didnt know what the model would be . And if the model is wrong in the paramaters will the function still be called ?
The Specialist is offline
Send a message via AIM to The Specialist
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-27-2006 , 01:57   Re: Client throws a grenade > call function
Reply With Quote #10

Why don't you know what the model will be?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 13:32.


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