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

Best player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JoneM
Junior Member
Join Date: May 2023
Old 08-31-2023 , 04:52   Best player
Reply With Quote #1

Hi, maybe impossible to add ACC (Accuracy) in best player round stats? Thanks for help
Attached Files
File Type: sma Get Plugin or Get Source (best.sma - 54 views - 2.4 KB)
JoneM is offline
Tote
Senior Member
Join Date: Jul 2023
Old 08-31-2023 , 10:18   Re: Best player
Reply With Quote #2

g_iKills[id] = 0
g_iHS[id] = 0
g_fDmg[id] = 0.0

float( float(g_iKills[id]) / float(g_iHs[id]) * 100.0) maybe something like this
Tote is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 08-31-2023 , 11:46   Re: Best player
Reply With Quote #3

StatsX formula

PHP Code:
Float:accuracy(izStats[8])
{
    if (!
izStats[STATS_SHOTS])
        return (
0.0)
    
    return (
100.0 float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS]))

__________________
mlibre is offline
JoneM
Junior Member
Join Date: May 2023
Old 08-31-2023 , 14:29   Re: Best player
Reply With Quote #4

Quote:
Originally Posted by mlibre View Post
StatsX formula

PHP Code:
Float:accuracy(izStats[8])
{
    if (!
izStats[STATS_SHOTS])
        return (
0.0)
    
    return (
100.0 float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS]))

I know that, but i dont know how to added correctly
JoneM is offline
Tote
Senior Member
Join Date: Jul 2023
Old 09-01-2023 , 05:08   Re: Best player
Reply With Quote #5

maybe something like this
PHP Code:
public OnRoundEnd()
{
    new 
id get_best_player()
    
    if(
id == -1)
        return
        
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName)) 

    new 
Float:acc;
    
acc = (float(g_iKills[id]) / float(g_iHS[id]) * 100.0)
    
set_hudmessage(.holdtime 5.0)
    
show_hudmessage(0"The best player of the round is %s with %i kills (%i HS | %.1f Damage) | ACC: %.2f"szNameg_iKills[id], g_iHS[id], g_fDmg[id], acc)
    
    
arrayset(g_iKills0sizeof(g_iKills))
    
arrayset(g_iHS0sizeof(g_iHS))
    
    for(new 
isizeof(g_fDmg); i++)
        
g_fDmg[i] = 0.0


Last edited by Tote; 09-01-2023 at 05:08.
Tote is offline
JoneM
Junior Member
Join Date: May 2023
Old 09-02-2023 , 10:43   Re: Best player
Reply With Quote #6

Quote:
Originally Posted by Tote View Post
maybe something like this
PHP Code:
public OnRoundEnd()
{
    new 
id get_best_player()
    
    if(
id == -1)
        return
        
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName)) 

    new 
Float:acc;
    
acc = (float(g_iKills[id]) / float(g_iHS[id]) * 100.0)
    
set_hudmessage(.holdtime 5.0)
    
show_hudmessage(0"The best player of the round is %s with %i kills (%i HS | %.1f Damage) | ACC: %.2f"szNameg_iKills[id], g_iHS[id], g_fDmg[id], acc)
    
    
arrayset(g_iKills0sizeof(g_iKills))
    
arrayset(g_iHS0sizeof(g_iHS))
    
    for(new 
isizeof(g_fDmg); i++)
        
g_fDmg[i] = 0.0


works, but always display 200.0%, maybe need something else?
JoneM is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 09-13-2023 , 15:07   Re: Best player
Reply With Quote #7

Quote:
Originally Posted by JoneM View Post
works, but always display 200.0%, maybe need something else?
Code:
    new Float:acc;
    if (g_iHits[id] > 0) {
        acc = (float(g_iKills[id]) / float(g_iHits[id])) * 100.0;
    } else {
        acc = 0.0; // Avoid division by zero error if there are no hits.
    }
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
JoneM
Junior Member
Join Date: May 2023
Old 10-24-2023 , 02:11   Re: Best player
Reply With Quote #8

Quote:
Originally Posted by Fuck For Fun View Post
Code:
    new Float:acc;
    if (g_iHits[id] > 0) {
        acc = (float(g_iKills[id]) / float(g_iHits[id])) * 100.0;
    } else {
        acc = 0.0; // Avoid division by zero error if there are no hits.
    }

if no HS player did, also 00.0ACC, maybe need by hits or shots, but need normall formula, maybe can someone configurate? thanks
JoneM 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 17:41.


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