AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hs ratio help (https://forums.alliedmods.net/showthread.php?t=196699)

avril-lavigne 09-24-2012 13:09

Hs ratio help
 
PHP Code:

public client_damage(attackervictimdamagewpnindexhitplace)
{
    if ( 
attacker == victim || get_user_frags(attacker) < 10 ) return
    
    if ( 
hitplace == HIT_HEAD )
    {
        
gHeadShots[attacker]++
        
        
client_print(attackerprint_chat"[DEBUG] You now have %d headshots!"gHeadShots[attacker])
        
        
check_ratio(attacker)
        
    }

}


check_ratio(id) {     
      new 
Float:ratio 0.9 float(get_user_frags(id))
      
client_print(id,3,"Ratio hs/kill is %i"/*floatround */    ratio)
      if(
gHeadShots(id) > ratio
              
punish(id)

       
     }


in debug I always see ratio is 123654234 huge number

what I need - check Hs per kill . if over 90% ban

Liverwiz 09-24-2012 13:13

Re: Hs ratio help
 
You've never rushed with a TMP before, have you?

avril-lavigne 09-24-2012 13:15

Re: Hs ratio help
 
I can make exception for knife / tmp / Uzi /. etc in curweapon
I dont care. I just need working code
and my request = another ratio
shots per kill . it really helps in HLstats. when I see users with 3-4 bullets per EVERY kill = its aimbot 100% . ( count bullets / get user frags if less than xxx bullets per frag = ban. and make exception for awp its not a problem )

Liverwiz 09-24-2012 13:22

Re: Hs ratio help
 
You'll need to count shots fired. CurWeapon is run every time someone fires a regular weapon (knifes are an exception)

Unless there's a pdata offset that contains shots fired....

avril-lavigne 09-25-2012 05:39

Re: Hs ratio help
 
ok so what about code above? if I use floatround it makes 0.9 > to 1.0 so it doesnt work
If u dont use floatround it doesnt work at all. and shows me random big numbers
"Ratio hs/kill is %i" here

claudiuhks 09-25-2012 07:50

Re: Hs ratio help
 
PHP Code:

new Float0.123456;

server_print"%d"floatround) );
server_print"%i"floatround) );
server_print"%f");
server_print"%.2f"); // Output: 0.12
server_print"%f"float) ); 

%i is for integer values, not for floats!
floatround - transforms float to integer


All times are GMT -4. The time now is 08:10.

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