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

FM_AddToFullPack optimize.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-19-2012 , 05:44   FM_AddToFullPack optimize.
Reply With Quote #1

Hello , i will explain.

I'm working in a little plugin (if i finish i will post in submissions ).

The code make this.
  • If the player is CT and he's looking at the terrorist with the boolean in true, the T have red glow
  • if the player is T and he's looking at the CT with the boolean in true , the CT have blue glow.

Code:
new const cGlowColors[][] = {     { 255 , 000 , 000 }, // T team     { 000 , 000 , 255 }  // CT TEAM }; public func_AddToFullPack(es, e, ent, host, hostflags, player, pSet) {          if( !player || !pev_valid( ent ) ||  !get_orig_retval( ) )         return FMRES_IGNORED;         if( bPlayerDueling[ host ] && bPlayerDueling[ ent ] )     {         set_es( es , ES_RenderFx, kRenderFxGlowShell );         switch( cs_get_user_team( host ) )         {             case CS_TEAM_CT:set_es( es , ES_RenderColor, cGlowColors[ 1 ] );             case CS_TEAM_T :set_es( es , ES_RenderColor, cGlowColors[ 0 ] );         }         switch( cs_get_user_team( ent ) )         {             case CS_TEAM_CT:set_es( es , ES_RenderColor, cGlowColors[ 1 ] );             case CS_TEAM_T :set_es( es , ES_RenderColor, cGlowColors[ 0 ] );         }         set_es( es , ES_RenderAmt, 100 );     }     return FMRES_IGNORED; }

The question is , is can be optimizable ?, bcoz this is called a lot of times if i'm not wrong.

Thanks ^^
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 01-19-2012 at 05:45.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 01-19-2012 , 06:35   Re: FM_AddToFullPack optimize.
Reply With Quote #2

Not sure but I think you could use the StatusValue event.
Erox902 is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-19-2012 , 06:37   Re: FM_AddToFullPack optimize.
Reply With Quote #3

Code:
For the Flag 1 the Value is TeamRelation, for 2 is PlayerID, for 3 is Health. For TeamRelation, 1 is Teammate player, 2 is Non-Teammate player, 3 is Hostage
__________________
You can do anything you set your mind to, man.

Devil259 is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-19-2012 , 07:10   Re: FM_AddToFullPack optimize.
Reply With Quote #4

I think we didn't understand.

I'm working in a duel system. we have 2 players , ex : Jose and Translucent.

Jose is dueling with translucent.

If jose is in CT/TT and he's looking translucent (he is opossite team), translucent will get red or blue glow , but only JOSE can look that glow.

same case with translucent.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-19-2012 , 08:06   Re: FM_AddToFullPack optimize.
Reply With Quote #5

PHP Code:
cs_get_user_teament 
When the player spawn, get his team. And so you can avoid to call this native in AddToFullPack.
__________________
micapat is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-19-2012 , 08:55   Re: FM_AddToFullPack optimize.
Reply With Quote #6

Ok , and i make the switch no ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-19-2012 , 09:05   Re: FM_AddToFullPack optimize.
Reply With Quote #7

switch( g_playerTeam[ host ] )
__________________
micapat is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-19-2012 , 09:25   Re: FM_AddToFullPack optimize.
Reply With Quote #8

yeye , thanks.
If any have another idea , we're welcome .
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Old 01-19-2012, 09:40
lucas_7_94
This message has been deleted by lucas_7_94. Reason: proxy.
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 15:43.


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