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

Need HUD Scorer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RAW_192
Senior Member
Join Date: Feb 2017
Old 02-13-2017 , 02:10   Need HUD Scorer
Reply With Quote #1

Need HUD scoreboard for CTF server

Can someone modify this ?

PHP Code:
#include < amxmodx > 

#pragma semicolon 1 

#define UPDATE_INTERVAL         1.0 

enum _iRGB 

    
r
    
g
    

}; 

new const 
gCvarColorNames[ ][ ] = 

    
"white"
    
"red"
    
"blue"
    
"green"
    
"yellow" 
}; 

new 
Trie:gCvarNameToIndex

new const 
gColorValues[ ][ iRGB ] = 

    { 
255255255 }, 
    { 
2551010 }, 
    { 
1010255 }, 
    { 
1025510 }, 
    { 
25525510 
}; 

new 
gCountCTScore 0
new 
gCountTScore 0

new 
gHudSync
new 
gCvarColorHud

new 
gColorIdiRGB ]; 

public 
plugin_init( ) 

    
register_plugin"Score Counter""1.0.1""tuty" ); 
    
    
register_event"SendAudio""Hook_Terr_Win""a""2&%!MRAD_terwin" ); 
    
register_event"SendAudio""Hook_CT_Win""a""2&%!MRAD_ctwin" ); 
    
register_event"TextMsg""Hook_Restart""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" );
    
    
gCvarColorHud register_cvar"amx_hudscorecolor""white" ); 
    
    
gCvarNameToIndex TrieCreate( ); 

    for( new 
0sizeof gCvarColorNamesi++ ) 
    { 
        
TrieSetCellgCvarNameToIndexgCvarColorNames], ); 
    } 

    
set_taskUPDATE_INTERVAL"UpdateScore"___"b" ); 

    
gHudSync CreateHudSyncObj( ); 


public 
plugin_cfg( ) 

    
UTIL_InitColor( ); 


public 
Hook_Terr_Win( ) 

    
gCountTScore++; 


public 
Hook_CT_Win( ) 

    
gCountCTScore++; 


public 
Hook_Restart( )
{
    
gCountCTScore 0;
    
gCountTScore 0;
}

public 
plugin_end( ) 

    
TrieDestroygCvarNameToIndex ); 


public 
UpdateScore( ) 

    
set_hudmessagegColorId], gColorId], gColorId], -1.00.0306.0UPDATE_INTERVAL 0.1 ); 
    
ShowSyncHudMsg0gHudSync"[CT] Vs. [T]^n%d - %d"gCountCTScoregCountTScore ); 


UTIL_InitColor( ) 

    new 
szColor20 ], i
    
get_pcvar_stringgCvarColorHudszColorcharsmaxszColor ) ); 
    
    
strtolowerszColor ); 
    
    if( 
TrieGetCellgCvarNameToIndexszColor) ) 
    { 
        
gColorId] = gColorValues][ ]; 
        
gColorId] = gColorValues][ ]; 
        
gColorId] = gColorValues][ ]; 
    } 

RAW_192 is offline
AdamK
Member
Join Date: Jul 2016
Location: Washington, D.C.
Old 02-13-2017 , 05:46   Re: Need HUD Scorer
Reply With Quote #2

@RAW_192:

I have this one for jCTF, you can try it, in-case it works, no idea,

PHP Code:
#include <amxmodx>
#include <jctf>
#include <dhudmessage>

#define PLUGIN "Hud Score"
#define VERSION "0.1"
#define AUTHOR "unknown"

new scorett
new scorect

new SND_BLUE_WIN[] = "ctf/blue_wins.wav"
new SND_RED_WIN[] = "ctf/red_wins.wav"
new SND_TEAMS_TIED[] = "ctf/teams_tied.wav"

enum
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TextMsg","game_c","a","2&#Game_C")
    
set_task(1.0,"score_round",_,_,_,"b")
    
set_task(0.9"check"___"b")
    
scorett 0
    scorect 
0
}
public 
PlaySound(sound[])
{
    
client_cmd(0"spk ^"%s^""sound)
}
public 
plugin_precache()
{
    
precache_sound(SND_BLUE_WIN)
    
precache_sound(SND_RED_WIN)
    
precache_sound(SND_TEAMS_TIED)
}
public 
game_c()
{
    
set_task(3.0"reset_score")
}
public 
reset_score()
{
    
scorett 0
    scorect 
0
}
public 
jctf_flag(evidtm)
{
    if(
ev == FLAG_CAPTURED)
    {
        switch(
tm)
        {
            case 
TEAM_REDscorect++
            case 
TEAM_BLUEscorett++
        }
    }
    return
}
public 
score_round()
{
    
set_dhudmessage(255255255, -1.00.000.01.0+0.01)
    
show_dhudmessage(0"Blue Team || Red Team^n%i             %i"scorectscorett)
}
public 
check()
{
    new 
string[10]
    
get_cvar_string("amx_timeleft"string10)
    
    if(
equal(string"00:00"))
    {
        
remove_task(_)
        if(
scorect == scorett)
            
PlaySound(SND_TEAMS_TIED)
        else if(
scorect>scorett)
            
PlaySound(SND_BLUE_WIN)
        else if(
scorect<scorett)
            
PlaySound(SND_RED_WIN)
    }

__________________
| Adam |
AdamK is offline
RAW_192
Senior Member
Join Date: Feb 2017
Old 02-13-2017 , 06:32   Re: Need HUD Scorer
Reply With Quote #3

Quote:
Originally Posted by AdamK View Post
@RAW_192:

I have this one for jCTF, you can try it, in-case it works, no idea,

PHP Code:
#include <amxmodx>
#include <jctf>
#include <dhudmessage>

#define PLUGIN "Hud Score"
#define VERSION "0.1"
#define AUTHOR "unknown"

new scorett
new scorect

new SND_BLUE_WIN[] = "ctf/blue_wins.wav"
new SND_RED_WIN[] = "ctf/red_wins.wav"
new SND_TEAMS_TIED[] = "ctf/teams_tied.wav"

enum
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TextMsg","game_c","a","2&#Game_C")
    
set_task(1.0,"score_round",_,_,_,"b")
    
set_task(0.9"check"___"b")
    
scorett 0
    scorect 
0
}
public 
PlaySound(sound[])
{
    
client_cmd(0"spk ^"%s^""sound)
}
public 
plugin_precache()
{
    
precache_sound(SND_BLUE_WIN)
    
precache_sound(SND_RED_WIN)
    
precache_sound(SND_TEAMS_TIED)
}
public 
game_c()
{
    
set_task(3.0"reset_score")
}
public 
reset_score()
{
    
scorett 0
    scorect 
0
}
public 
jctf_flag(evidtm)
{
    if(
ev == FLAG_CAPTURED)
    {
        switch(
tm)
        {
            case 
TEAM_REDscorect++
            case 
TEAM_BLUEscorett++
        }
    }
    return
}
public 
score_round()
{
    
set_dhudmessage(255255255, -1.00.000.01.0+0.01)
    
show_dhudmessage(0"Blue Team || Red Team^n%i             %i"scorectscorett)
}
public 
check()
{
    new 
string[10]
    
get_cvar_string("amx_timeleft"string10)
    
    if(
equal(string"00:00"))
    {
        
remove_task(_)
        if(
scorect == scorett)
            
PlaySound(SND_TEAMS_TIED)
        else if(
scorect>scorett)
            
PlaySound(SND_BLUE_WIN)
        else if(
scorect<scorett)
            
PlaySound(SND_RED_WIN)
    }


Worked Great Thanks alot .

Although im not able to compile it so im using HUD instead of Dhud..

Can you compile and give me the plugin if possible?
RAW_192 is offline
kristi
Senior Member
Join Date: Nov 2016
Old 02-13-2017 , 06:56   Re: Need HUD Scorer
Reply With Quote #4

compile this

PHP Code:
#include <amxmodx> 
#include <jctf> 
#include <dhudmessage> 

#define PLUGIN "Hud Score" 
#define VERSION "0.1" 
#define AUTHOR "unknown" 

new scorett 
new scorect 

new SND_BLUE_WIN[] = "ctf/blue_wins.wav" 
new SND_RED_WIN[] = "ctf/red_wins.wav" 
new SND_TEAMS_TIED[] = "ctf/teams_tied.wav" 

enum 

    
TEAM_NONE 0
    
TEAM_RED
    
TEAM_BLUE
    
TEAM_SPEC 


public 
plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_event("TextMsg","game_c","a","2&#Game_C"
    
set_task(1.0,"score_round",_,_,_,"b"
    
set_task(0.9"check"___"b"
    
scorett 
    scorect 


public 
PlaySound(sound[]) 

    
client_cmd(0"spk ^"%s^""sound

public 
plugin_precache() 

    
precache_sound(SND_BLUE_WIN
    
precache_sound(SND_RED_WIN
    
precache_sound(SND_TEAMS_TIED

public 
game_c() 

    
set_task(3.0"reset_score"

public 
reset_score() 

    
scorett 
    scorect 


public 
jctf_flag(evidtm

    if(
ev == FLAG_CAPTURED
    { 
        switch(
tm
        { 
            case 
TEAM_REDscorect++ 
            case 
TEAM_BLUEscorett++ 
        } 
    } 
    return 

public 
score_round() 

    
set_dhudmessage(255255255, -1.00.000.01.0+0.01
    
show_dhudmessage(0"Blue Team || Red Team^n%i             %i"scorectscorett

public 
check() 

    new 
string[10
    
get_cvar_string("amx_timeleft"string10
     
    if(
equal(string"00:00")) 
    { 
        
remove_task(_
        if(
scorect == scorett
            
PlaySound(SND_TEAMS_TIED
        else if(
scorect>scorett
            
PlaySound(SND_BLUE_WIN
        else if(
scorect<scorett
            
PlaySound(SND_RED_WIN
    } 
}  

stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;

stock set_dhudmessagered 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 6.0Float:holdtime 3.0Float:fadeintime 0.1Float:fadeouttime 1.5bool:reliable false )
{
    
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
    #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

    
__dhud_color       pack_colorclamp_bytered ), clamp_bytegreen ), clamp_byteblue ) );
    
__dhud_x           _:x;
    
__dhud_y           _:y;
    
__dhud_effect      effects;
    
__dhud_fxtime      _:fxtime;
    
__dhud_holdtime    _:holdtime;
    
__dhud_fadeintime  _:fadeintime;
    
__dhud_fadeouttime _:fadeouttime;
    
__dhud_reliable    _:reliable;

    return 
1;
}

stock show_dhudmessageindex, const message[], any:... )
{
    new 
buffer128 ];
    new 
numArguments numargs();

    if( 
numArguments == )
    {
        
send_dhudMessageindexmessage );
    }
    else if( 
index || numArguments == )
    {
        
vformatbuffercharsmaxbuffer ), message);
        
send_dhudMessageindexbuffer );
    }
    else
    {
        new 
playersList32 ], numPlayers;
        
get_playersplayersListnumPlayers"ch" );

        if( !
numPlayers )
        {
            return 
0;
        }

        new Array:
handleArrayML ArrayCreate();

        for( new 
2jnumArgumentsi++ )
        {
            if( 
getarg) == LANG_PLAYER )
            {
                while( ( 
buffer] = getarg1j++ ) ) ) {}
                
0;

                if( 
GetLangTransKeybuffer ) != TransKey_Bad )
                {
                    
ArrayPushCellhandleArrayMLi++ );
                }
            }
        }

        new 
size ArraySizehandleArrayML );

        if( !
size )
        {
            
vformatbuffercharsmaxbuffer ), message);
            
send_dhudMessageindexbuffer );
        }
        else
        {
            for( new 
0jnumPlayersi++ )
            {
                
index playersList];

                for( 
0sizej++ )
                {
                    
setargArrayGetCellhandleArrayML), 0index );
                }

                
vformatbuffercharsmaxbuffer ), message);
                
send_dhudMessageindexbuffer );
            }
        }

        
ArrayDestroyhandleArrayML );
    }

    return 
1;
}

stock send_dhudMessage( const index, const message[] )
{
    
message_begin__dhud_reliable ? ( index MSG_ONE MSG_ALL ) : ( index MSG_ONE_UNRELIABLE MSG_BROADCAST ), SVC_DIRECTOR_index );
    {
        
write_bytestrlenmessage ) + 31 );
        
write_byteDRC_CMD_MESSAGE );
        
write_byte__dhud_effect );
        
write_long__dhud_color );
        
write_long__dhud_x );
        
write_long__dhud_y );
        
write_long__dhud_fadeintime );
        
write_long__dhud_fadeouttime );
        
write_long__dhud_holdtime );
        
write_long__dhud_fxtime );
        
write_stringmessage );
    }
    
message_end();

kristi is offline
Send a message via Skype™ to kristi
RAW_192
Senior Member
Join Date: Feb 2017
Old 02-13-2017 , 06:59   Re: Need HUD Scorer
Reply With Quote #5

Quote:
Originally Posted by kristi View Post
compile this

PHP Code:
#include <amxmodx> 
#include <jctf> 
#include <dhudmessage> 

#define PLUGIN "Hud Score" 
#define VERSION "0.1" 
#define AUTHOR "unknown" 

new scorett 
new scorect 

new SND_BLUE_WIN[] = "ctf/blue_wins.wav" 
new SND_RED_WIN[] = "ctf/red_wins.wav" 
new SND_TEAMS_TIED[] = "ctf/teams_tied.wav" 

enum 

    
TEAM_NONE 0
    
TEAM_RED
    
TEAM_BLUE
    
TEAM_SPEC 


public 
plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_event("TextMsg","game_c","a","2&#Game_C"
    
set_task(1.0,"score_round",_,_,_,"b"
    
set_task(0.9"check"___"b"
    
scorett 
    scorect 


public 
PlaySound(sound[]) 

    
client_cmd(0"spk ^"%s^""sound

public 
plugin_precache() 

    
precache_sound(SND_BLUE_WIN
    
precache_sound(SND_RED_WIN
    
precache_sound(SND_TEAMS_TIED

public 
game_c() 

    
set_task(3.0"reset_score"

public 
reset_score() 

    
scorett 
    scorect 


public 
jctf_flag(evidtm

    if(
ev == FLAG_CAPTURED
    { 
        switch(
tm
        { 
            case 
TEAM_REDscorect++ 
            case 
TEAM_BLUEscorett++ 
        } 
    } 
    return 

public 
score_round() 

    
set_dhudmessage(255255255, -1.00.000.01.0+0.01
    
show_dhudmessage(0"Blue Team || Red Team^n%i             %i"scorectscorett

public 
check() 

    new 
string[10
    
get_cvar_string("amx_timeleft"string10
     
    if(
equal(string"00:00")) 
    { 
        
remove_task(_
        if(
scorect == scorett
            
PlaySound(SND_TEAMS_TIED
        else if(
scorect>scorett
            
PlaySound(SND_BLUE_WIN
        else if(
scorect<scorett
            
PlaySound(SND_RED_WIN
    } 
}  

stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;

stock set_dhudmessagered 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 6.0Float:holdtime 3.0Float:fadeintime 0.1Float:fadeouttime 1.5bool:reliable false )
{
    
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
    #define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

    
__dhud_color       pack_colorclamp_bytered ), clamp_bytegreen ), clamp_byteblue ) );
    
__dhud_x           _:x;
    
__dhud_y           _:y;
    
__dhud_effect      effects;
    
__dhud_fxtime      _:fxtime;
    
__dhud_holdtime    _:holdtime;
    
__dhud_fadeintime  _:fadeintime;
    
__dhud_fadeouttime _:fadeouttime;
    
__dhud_reliable    _:reliable;

    return 
1;
}

stock show_dhudmessageindex, const message[], any:... )
{
    new 
buffer128 ];
    new 
numArguments numargs();

    if( 
numArguments == )
    {
        
send_dhudMessageindexmessage );
    }
    else if( 
index || numArguments == )
    {
        
vformatbuffercharsmaxbuffer ), message);
        
send_dhudMessageindexbuffer );
    }
    else
    {
        new 
playersList32 ], numPlayers;
        
get_playersplayersListnumPlayers"ch" );

        if( !
numPlayers )
        {
            return 
0;
        }

        new Array:
handleArrayML ArrayCreate();

        for( new 
2jnumArgumentsi++ )
        {
            if( 
getarg) == LANG_PLAYER )
            {
                while( ( 
buffer] = getarg1j++ ) ) ) {}
                
0;

                if( 
GetLangTransKeybuffer ) != TransKey_Bad )
                {
                    
ArrayPushCellhandleArrayMLi++ );
                }
            }
        }

        new 
size ArraySizehandleArrayML );

        if( !
size )
        {
            
vformatbuffercharsmaxbuffer ), message);
            
send_dhudMessageindexbuffer );
        }
        else
        {
            for( new 
0jnumPlayersi++ )
            {
                
index playersList];

                for( 
0sizej++ )
                {
                    
setargArrayGetCellhandleArrayML), 0index );
                }

                
vformatbuffercharsmaxbuffer ), message);
                
send_dhudMessageindexbuffer );
            }
        }

        
ArrayDestroyhandleArrayML );
    }

    return 
1;
}

stock send_dhudMessage( const index, const message[] )
{
    
message_begin__dhud_reliable ? ( index MSG_ONE MSG_ALL ) : ( index MSG_ONE_UNRELIABLE MSG_BROADCAST ), SVC_DIRECTOR_index );
    {
        
write_bytestrlenmessage ) + 31 );
        
write_byteDRC_CMD_MESSAGE );
        
write_byte__dhud_effect );
        
write_long__dhud_color );
        
write_long__dhud_x );
        
write_long__dhud_y );
        
write_long__dhud_fadeintime );
        
write_long__dhud_fadeouttime );
        
write_long__dhud_holdtime );
        
write_long__dhud_fxtime );
        
write_stringmessage );
    }
    
message_end();


Not able too , idk why Can you please compile it and attach it ?
RAW_192 is offline
kristi
Senior Member
Join Date: Nov 2016
Old 02-13-2017 , 07:02   Re: Need HUD Scorer
Reply With Quote #6

Ok.

Last edited by kristi; 03-23-2017 at 14:35.
kristi is offline
Send a message via Skype™ to kristi
RAW_192
Senior Member
Join Date: Feb 2017
Old 02-13-2017 , 07:09   Re: Need HUD Scorer
Reply With Quote #7

Quote:
Originally Posted by kristi View Post
Ok.
There's some issue with it , it just stops after 7th round
Its starts fading and disappears after round 8
Can you solve it?

Make the max rounds 11

Last edited by RAW_192; 02-13-2017 at 07:12.
RAW_192 is offline
RAW_192
Senior Member
Join Date: Feb 2017
Old 02-13-2017 , 07:30   Re: Need HUD Scorer
Reply With Quote #8

The plugins are adding one extra point for assist flag captures..

Can someone solve this out?
RAW_192 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 18:01.


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