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

Solved Color stats


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maclarens
Senior Member
Join Date: Jul 2020
Location: Kz
Old 02-20-2023 , 08:06   Color stats
Reply With Quote #1

Pls help,i have a stats plugin for L4D2 and i try to add color depend from player points,but its not working..where im mistake?
Code:
public Action:Timer_SetColor(Handle:timer)
{
    for(new i = 1; i < MaxClients; i++)
    {
        if(IsClientInGame(i) && IsPlayerAlive(i))
        {
            if (ClientPoints[i] > 5000000)
                 SetEntityRenderColor(i, 0, 0, 0, 252);
            if (ClientPoints[i] > 1000000)
                SetEntityRenderColor(i, 255, 0, 0, 255);
            if (ClientPoints[i] > 500000)
                SetEntityRenderColor(i, 0, 0, 255, 255);
            if (ClientPoints[i] > 100000)
                SetEntityRenderColor(i, 255, 255, 0, 255);
            if (ClientPoints[i] > 50000)
                 SetEntityRenderColor(i, 0, 255, 255, 255);
            if (ClientPoints[i] > 10000)
                SetEntityRenderColor(i, 0, 255, 0, 255);
            if (ClientPoints[i] > 5000)
                 SetEntityRenderColor(i, 0, 128, 0, 255);
            if (ClientPoints[i] > 1000)
                SetEntityRenderColor(i, 128, 128, 0, 255);
            if (ClientPoints[i] > 500)
                SetEntityRenderColor(i, 128, 128, 128, 255);
        }
    }
    return Plugin_Handled;
}

Last edited by maclarens; 09-16-2023 at 14:09.
maclarens is offline
MegoltElek
Junior Member
Join Date: Dec 2020
Old 02-20-2023 , 08:37   Re: Color stats
Reply With Quote #2

You don't check if the player has smaller points, than 500, and if they have more than 500 you always set it to SetEntityRenderColor(i, 128, 128, 128, 255); no matter how many points they have.
try this:
PHP Code:
public Action:Timer_SetColor(Handle:timer)
{
    for(new 
1MaxClientsi++)
    {
        if(
IsClientInGame(i) && IsPlayerAlive(i))
        {
            if (
ClientPoints[i] > 5000000)
                 
SetEntityRenderColor(i000252);
            else if (
ClientPoints[i] > 1000000)
                
SetEntityRenderColor(i25500255);
            else if (
ClientPoints[i] > 500000)
                
SetEntityRenderColor(i00255255);
            else if (
ClientPoints[i] > 100000)
                
SetEntityRenderColor(i2552550255);
            else if (
ClientPoints[i] > 50000)
                 
SetEntityRenderColor(i0255255255);
            else if (
ClientPoints[i] > 10000)
                
SetEntityRenderColor(i02550255);
            else if (
ClientPoints[i] > 5000)
                 
SetEntityRenderColor(i01280255);
            else if (
ClientPoints[i] > 1000)
                
SetEntityRenderColor(i1281280255);
            else if (
ClientPoints[i] > 500)
                
SetEntityRenderColor(i128128128255);
            else  
SetEntityRenderColor(i255255255255);
        }
    }
    return 
Plugin_Handled;


Last edited by MegoltElek; 02-20-2023 at 08:39.
MegoltElek is offline
maclarens
Senior Member
Join Date: Jul 2020
Location: Kz
Old 02-20-2023 , 13:36   Re: Color stats
Reply With Quote #3

MegoltElek, its true!it worket!thank you very mutch..so simple :/ damn

Last edited by maclarens; 02-20-2023 at 13:36.
maclarens 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 12:07.


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