Raised This Month: $ Target: $400
 0% 

Variable Friendly Fire


Post New Thread Reply   
 
Thread Tools Display Modes
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-29-2009 , 09:05   Re: Variable Friendly Fire
Reply With Quote #21

PHP Code:
clampiVar1g_iMaxPlayers ) != ( <= iVar <= g_iMaxPlayers 
Example:

PHP Code:
new iVar 100;
new 
bool:bResultiResult;

// g_iMaxPlayers = 32

bResult = ( <= iVar <= g_iMaxPlayers );
iResult clampiVar1g_iMaxPlayers );

// bResult = false
// iResult = 32 (aka true, check would be incorrect) 
__________________
In Flames we trust!
Nextra is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-29-2009 , 14:10   Re: Variable Friendly Fire
Reply With Quote #22

To be completly honest with you guys.... I dont under stand why the hell to add in the whole mp_friendly fire...

If it is set to 0 take damage for teammates is set to 0


reguardless it still is just as efficient... and its been running great i have it on all 6 of my servers. no errors.
Doc-Holiday is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-29-2009 , 14:13   Re: Variable Friendly Fire
Reply With Quote #23

PHP Code:
if(    is_user_connectedattacker // in fact this check is safer than on check player range !!
    
&&    cs_get_user_team(attacker) == cs_get_user_team(victim)
    &&    
get_pcvar_num(friendlyFire)    ) 
mp_friendlyfire should be the very first check. It will make it more efficient because you shouldn't do anything in the function when it's set to 0. Although it's a trivial improvement.

edit: read below

Last edited by Jon; 10-29-2009 at 14:22.
Jon is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-29-2009 , 14:17   Re: Variable Friendly Fire
Reply With Quote #24

Considering that most damage are normally done to enemy, i don't think the first check should be ff cvar.
Anyway the forward won't be called so often.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-29-2009 , 19:25   Re: Variable Friendly Fire
Reply With Quote #25

Quote:
Originally Posted by ConnorMcLeod View Post
Considering that most damage are normally done to enemy, i don't think the first check should be ff cvar.
Anyway the forward won't be called so often.

Not to mention if it was turned off its still going to fire the event...

When ff is off and shooting your teamate it wont show anything as in they didnt take damage

I ran a server print with ff off and shot my teammates and didnt show a thing... i went to shoot bad guys and bam it showed... so with ff off it dosent even fire team attacks just the other guys so there for it goes anyways...

It only checks if valid and same team... once not same team it stops...

If i dont check valid first can mess stuff up.. so once it checks teams it should be fine.
Doc-Holiday is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-30-2009 , 12:05   Re: Variable Friendly Fire
Reply With Quote #26

Sense

That made none.
Jon is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-30-2009 , 14:17   Re: Variable Friendly Fire
Reply With Quote #27

Quote:
Originally Posted by Jon View Post
Sense

That made none.

With friendly fire off.... You shooting a teammate dosent register ham_takedamage

Shooting your enemy will fire and on the second check it comes back negitive and stops.

There fore checking friendly fire var first is not going to make a difference efficiency wise.
Doc-Holiday is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-31-2009 , 07:44   Re: Variable Friendly Fire
Reply With Quote #28

Quote:
Originally Posted by NcB_Sav View Post
With friendly fire off.... You shooting a teammate dosent register ham_takedamage
That's wrong, test it. That's exactly why I told you to check it.
Jon is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-31-2009 , 16:24   Re: Variable Friendly Fire
Reply With Quote #29

Quote:
Originally Posted by Jon View Post
That's wrong, test it. That's exactly why I told you to check it.

o well the checks in there so yea
Doc-Holiday is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 11-04-2009 , 13:31   Re: Variable Friendly Fire
Reply With Quote #30

Quote:
Originally Posted by Nextra View Post
PHP Code:
clampiVar1g_iMaxPlayers ) != ( <= iVar <= g_iMaxPlayers 
Example:

PHP Code:
new iVar 100;
new 
bool:bResultiResult;
 
// g_iMaxPlayers = 32
 
bResult = ( <= iVar <= g_iMaxPlayers );
iResult clampiVar1g_iMaxPlayers );
 
// bResult = false
// iResult = 32 (aka true, check would be incorrect) 
I did not say I was going to assign that to the variable... that was just the condition...
Code:
new cvar = 5;
 
/* is... */
cvar = clamp(1, 3);
 
/* slower than... */
 
if(cvar > 3)
   cvar = 3
 
if(cvar < 0)
   cvar = 0
 
/* or... */
 
cvar = (cvar > 3 ? 3 : (cvar < 0 ? 0 : cvar))
 
/* ??? */
But still, I don't know what I had in mind with that condition (X < Y < Z)... so anyway :} this is what I meant.
__________________
Hunter-Digital 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 07:21.


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