Raised This Month: $ Target: $400
 0% 

check grenade owner


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 01-08-2011 , 07:42   check grenade owner
Reply With Quote #1

Is it possible to get the grenade owner in FM_SetModel forward so it will set specific world model only if the owner is in specific team.
PHP Code:
public forward_model(entity,const model[])
{
    if(!
pev_valid(entity))
    {
        return 
FMRES_IGNORED;
    }
    
    if ( 
model] == 'm' && model] == 'w' && model] == '_' && model] == 'h')
    {
                
engfunc(EngFunc_SetModel,entity,model_nade_world);
                
fm_set_trail(entity,255,255,255,255);
                return 
FMRES_SUPERCEDE;
    }

SpeeDeeR is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 01-08-2011 , 07:47   Re: check grenade owner
Reply With Quote #2

pev_owner ?
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-08-2011 , 08:24   Re: check grenade owner
Reply With Quote #3

The entity's owner is not yet set in SetModel forward. You could set entity's nextthink to get_gametime() + 0.01 or use a single StartFrame and check the owner there.
__________________
hleV is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 01-08-2011 , 08:46   Re: check grenade owner
Reply With Quote #4

Can you show me the StarFrame way ?
SpeeDeeR is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-12-2011 , 07:11   Re: check grenade owner
Reply With Quote #5

Code:
#include <cstrike>   new Entity, Forward;   public forward_model(entity,const model[]) {     if(!pev_valid(entity))     {         return FMRES_IGNORED;     }         if ( model[ 0 ] == 'm' && model[ 7 ] == 'w' && model[ 8 ] == '_' && model[ 9 ] == 'h')     {         Entity = entity;         Forward = register_forward(FM_StartFrame, "StartFrame");     } }   public StartFrame() {     switch (cs_get_user_team(pev(Entity, pev_owner)))     {         case CS_TEAM_T: engfunc(EngFunc_SetModel,entity,model_nade_world);         case CS_TEAM_CT: engfunc(EngFunc_SetModel,entity,model_nade_world);     }       fm_set_trail(entity,255,255,255,255);     unregister_forward(FM_StartFrame, Forward); }
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2011 , 08:01   Re: check grenade owner
Reply With Quote #6

Quote:
Originally Posted by hleV View Post
The entity's owner is not yet set in SetModel forward. You could set entity's nextthink to get_gametime() + 0.01 or use a single StartFrame and check the owner there.
It's well set before SetModel on throw.
__________________

Last edited by Arkshine; 01-12-2011 at 08:16.
Arkshine is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 01-12-2011 , 12:26   Re: check grenade owner
Reply With Quote #7

Yeap, that worked hleV, thanks.
SpeeDeeR is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2011 , 12:41   Re: check grenade owner
Reply With Quote #8

pev_owner is enough if you need to get the owner when you throw a grenade.
__________________
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-12-2011 , 12:50   Re: check grenade owner
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
It's well set before SetModel on throw.
Oh. I guess it's not like in ESF for "aura" entity.
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-12-2011 , 13:44   Re: check grenade owner
Reply With Quote #10

Yes, to be more precise, SetModel with "models/w_hegrenade.mdl" is called :
  • when you pickup a grenade, it spawns a weapon_hegrenade entity ; owner is not set yet.
  • when you throw a grenade, it spawns a grenade entity ; owner is well set before.
__________________
Arkshine 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 02:13.


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