Raised This Month: $ Target: $400
 0% 

[ Request ] Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-03-2012 , 04:15   [ Request ] Ham_TakeDamage
Reply With Quote #1

Hi !

Just one problem with this :

Code:
public Fw_HamTakeDamage( victim , inflictor , attacker , Float: damage , damage_bits ) {     if( !g_bLast_activate )         return HAM_IGNORED;         else if( g_bLast_activate     && cs_get_user_team( inflictor ) == CS_TEAM_CT     || inflictor == attacker     && cs_get_user_team( victim ) == CS_TEAM_T     && attacker != g_tempid     || inflictor != g_tempid )     {         client_print( 0 , print_chat , "WARNING" );         return HAM_SUPERCEDE;     }             else if( g_bLast_activate     && cs_get_user_team( inflictor ) == CS_TEAM_CT     || inflictor == attacker     && cs_get_user_team( victim ) == CS_TEAM_T     && attacker == g_tempid     || inflictor == g_tempid )     {         client_print( 0 , print_chat , "OKAY" );         return HAM_IGNORED;     }     return HAM_IGNORED; }

Only "WARNING" is good.
Hum, just when the player is Ct and he want to kill a Ct in duel but he can kill the terro...
__________________
Pawn ? Useless
Aooka is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-03-2012 , 08:56   Re: [ Request ] Ham_TakeDamage
Reply With Quote #2

What exactly are you trying to do?
__________________
<VeCo> is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-03-2012 , 17:10   Re: [ Request ] Ham_TakeDamage
Reply With Quote #3

So,
They are two player in duel.
The Ct is : g_tempid and the terro is id
Only the two player in duel can kill them
And other can't kill this two people.
__________________
Pawn ? Useless
Aooka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-03-2012 , 17:12   Re: [ Request ] Ham_TakeDamage
Reply With Quote #4

You are mixing || and && that make result random (not so random).
Put expressions between () so you are sure of the result.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-04-2012 , 10:05   Re: [ Request ] Ham_TakeDamage
Reply With Quote #5

Like that :
|| ( inflictor == attacker )
__________________
Pawn ? Useless
Aooka is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-04-2012 , 13:31   Re: [ Request ] Ham_TakeDamage
Reply With Quote #6

Quote:
Originally Posted by Aooka View Post
Like that :
|| ( inflictor == attacker )
No.

Like this, for example:

PHP Code:
new var = 5var2 12var3 2;

if( var == 
|| ( var2 && var3 ) ) 
__________________

Last edited by Neeeeeeeeeel.-; 07-04-2012 at 13:32.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-04-2012 , 13:47   Re: [ Request ] Ham_TakeDamage
Reply With Quote #7

Following rules apply when you don't put parenthese :
( See http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf )
Code:
• Operator precedence 

The table beneath groups operators with equal precedence, starting with the 
operator group with the highest precedence at the top of the table. 

If the expression evaluation order is not explicitly established by parentheses, 
it is determined by the association rules.        For example:     a*b/c is equivalent 
with (a*b)/cbecause of the left-to-right association, and a=b=c is equivalent 
with a=(b=c). 

----------------------------------------------------------------------------
  ()                 function  call                                                   left-to-right 
  []                 array  index  (cell) 
  {}                 array  index  (character) 
----------------------------------------------------------------------------
  !                  logical  not                                                     right-to-left 
  ~                  one’s  complement 
  -                  two’s  complement  (unary  minus) 
   ++                increment 
   --                decrement 
  :                  tag  override 
  defined            symbol  definition  status 
  sizeof             symbol  size  in  “elements” 
  state              automaton/state  condition 
  tagof              unique  number  for  the tag 
----------------------------------------------------------------------------
  *                  multiplication                                                   left-to-right 
  /                  division 
  %                  remainder 
----------------------------------------------------------------------------
  +                  addition                                                         left-to-right 
  -                  subtraction 
----------------------------------------------------------------------------
  >>                 arithmetic  shift  right                                         left-to-right 
  >>>                logical  shift  right 
  <<                 shift  left 
----------------------------------------------------------------------------
  &                  bitwise  and                                                     left-to-right 
----------------------------------------------------------------------------
  ^                  bitwise  exclusive  or                                           left-to-right 
----------------------------------------------------------------------------
  |                  bitwise  or                                                      left-to-right 
----------------------------------------------------------------------------
  <                  smaller  than                                                    left-to-right 
  <=                 smaller  than  or  equal  to 
  >                  greater  than 
  >=                 greater  than  or  equal  to 
----------------------------------------------------------------------------
  ==                 equality                                                         left-to-right 
  !=                 inequality 
----------------------------------------------------------------------------
  &&                 logical  and                                                     left-to-right 
----------------------------------------------------------------------------
  ||                 logical  or                                                      left-to-right 
----------------------------------------------------------------------------
  ?    :             conditional                                                      right-to-left 
----------------------------------------------------------------------------
  =                  assignment                                                       right-to-left 
  *= /= %= += -= >>= >>>= <<= &= ^= |= 
----------------------------------------------------------------------------
  ,                  comma                                                            left-to-right
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-04-2012 at 13:47.
ConnorMcLeod 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 15:01.


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