Raised This Month: $27 Target: $400
 6% 

Client throws a grenade > call function


Post New Thread Reply   
 
Thread Tools Display Modes
The Specialist
BANNED
Join Date: Nov 2006
Old 12-27-2006 , 02:02   Re: Client throws a grenade > call function
Reply With Quote #11

Like what I just said , say we wanted to see a grenade , we assume the model is "w_hegrenade.mdl" , but then the user changed there server models to "w_new_henade.mdl" . Would that functions still get called ? And If not could you leave out the model parameter so it gets called for every single model that sets ?
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 , 02:33   Re: Client throws a grenade > call function
Reply With Quote #12

FM_SetModel is called whenever any entity is assigned any model, regardless of the entity or the model.

Code:
#define GRENADE_CLASS "grenade" #define GRENADE_MODEL "models/w_grenade.mdl" public plugin_init() {      register_forward(FM_SetModel,"fw_setmodel"); } public fw_setmodel(ent,model[]) {      static owner;      owner = pev(ent,pev_owner);      // no owner, DEFINITELY not a grenade we want      if(!is_user_connected(owner))           return FMRES_IGNORED;      // method 1:      // check model. make sure this is near top of      // plugins list, to catch before model changers.      if(equali(model,GRENADE_MODEL))      {           // owner threw grenade      }      // method 2:      // check classname.      // doesn't matter where plugin is placed.      static classname[32];      pev(ent,pev_classname,classname,31);      if(equali(classname,GRENADE_CLASS))      {           // owner threw 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-27-2006 , 02:36   Re: Client throws a grenade > call function
Reply With Quote #13

Alright that makes sence
The Specialist is offline
Send a message via AIM to The Specialist
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 12-27-2006 , 16:53   Re: Client throws a grenade > call function
Reply With Quote #14

THX alot, +karma to both of you (you that came with the up with the whole "register_forward(FM_SetModel,"fw_setmodel")" idea, and that penguin guy for trying to help).

Last edited by bloodypizza; 12-27-2006 at 17:02.
bloodypizza is offline
Send a message via MSN to bloodypizza
The Specialist
BANNED
Join Date: Nov 2006
Old 12-27-2006 , 21:36   Re: Client throws a grenade > call function
Reply With Quote #15

Th e Penguin guy LOL thats funny . Its the picture from a Linux Program called "Jal Bait".
The Specialist is offline
Send a message via AIM to The Specialist
Reply


Thread Tools
Display Modes

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 23:12.


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