Raised This Month: $32 Target: $400
 8% 

[Dyn Native] ColorChat v0.3.2 (04 jul 2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-27-2011 , 22:27   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #111

No, it changes the TeamInfo only for iFool but shows it to everyone.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-28-2011 , 14:41   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #112

Oh, alright, thanks.
__________________
hleV is offline
zippel
Member
Join Date: Mar 2011
Location: RF
Old 05-23-2011 , 18:36   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #113

For example, how I can use this for wc3 plugin?
My poor experience wouldn't let me use it with war3...

Last edited by zippel; 05-23-2011 at 18:45.
zippel is offline
Send a message via ICQ to zippel Send a message via Skype™ to zippel
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-24-2011 , 02:01   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #114

Whatever the plugin you need to use it in, all information you need is in first post.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-24-2011 , 06:49   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #115

new problem

pic attached


PHP Code:

/*    +-----------------------------------------------+
    |    CHATCOLOR CREDIT @ ConnorMcLeod        |
    +-----------------------------------------------+    */
#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

enum _:Colors 
{
    
DontChange,
    
CH_Red,
    
Blue,
    
Grey

PHP Code:
register_dictionary_colored("catchmod.txt"
PHP Code:
stock const g_szTeamName[Colors][] = 
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}
stock client_print_color(idiColor=DontChange, const szMsg[], any:...)
{
    
// check if id is different from 0
    
if( id && !is_user_connected(id) )
    {
        return 
0;
    }

    if( 
iColor Grey )
    {
        
iColor DontChange;
    }

    new 
szMessage[192];
    if( 
iColor == DontChange )
    {
        
szMessage[0] = 0x04;
    }
    else
    {
        
szMessage[0] = 0x03;
    }

    new 
iParams numargs();
    
// Specific player code
    
if(id)
    {
        if( 
iParams == )
        {
            
copy(szMessage[1], charsmax(szMessage)-1szMsg);
        }
        else
        {
            
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);
        }

        if( 
iColor )
        {
            new 
szTeam[11]; // store current team so we can restore it
            
get_user_team(idszTeamcharsmax(szTeam));

            
// set id TeamInfo in consequence
            // so SayText msg gonna show the right color
            
Send_TeamInfo(ididg_szTeamName[iColor]);

            
// Send the message
            
Send_SayText(ididszMessage);

            
// restore TeamInfo
            
Send_TeamInfo(ididszTeam);
        }
        else
        {
            
Send_SayText(ididszMessage);
        }
    } 

    
// Send message to all players
    
else
    {
        
// Figure out if at least 1 player is connected
        // so we don't send useless message if not
        // and we gonna use that player as team reference (aka SayText message sender) for color change
        
new iPlayers[32], iNum;
        
get_players(iPlayersiNum"ch");
        if( !
iNum )
        {
            return 
0;
        }

        new 
iFool iPlayers[0];

        new 
iMlNumberij;
        new Array:
aStoreML ArrayCreate();
        if( 
iParams >= // ML can be used
        
{
            for(
j=4j<iParamsj++)
            {
                
// retrieve original param value and check if it's LANG_PLAYER value
                
if( getarg(j) == LANG_PLAYER )
                {
                    
i=0;
                    
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
                    
while( ( szMessage] = getarg1i++ ) ) ) {}
                    if( 
GetLangTransKey(szMessage) != TransKey_Bad )
                    {
                        
// Store that arg as LANG_PLAYER so we can alter it later
                        
ArrayPushCell(aStoreMLj++);

                        
// Update ML array saire so we'll know 1st if ML is used,
                        // 2nd how many args we have to alterate
                        
iMlNumber++;
                    }
                }
            }
        }

        
// If arraysize == 0, ML is not used
        // we can only send 1 MSG_BROADCAST message
        
if( !iMlNumber )
        {
            if( 
iParams == )
            {
                
copy(szMessage[1], charsmax(szMessage)-1szMsg);
            }
            else
            {
                
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);
            }

            if( 
iColor )
            {
                new 
szTeam[11];
                
get_user_team(iFoolszTeamcharsmax(szTeam));
                
Send_TeamInfo(0iFoolg_szTeamName[iColor]);
                
Send_SayText(0iFoolszMessage);
                
Send_TeamInfo(0iFoolszTeam);
            }
            else
            {
                
Send_SayText(0iFoolszMessage);
            }
        }

        
// ML is used, we need to loop through all players,
        // format text and send a MSG_ONE_UNRELIABLE SayText message
        
else
        {
            new 
szTeam[11], szFakeTeam[10];
            
            if( 
iColor )
            {
                
get_user_team(iFoolszTeamcharsmax(szTeam));
                
copy(szFakeTeamcharsmax(szFakeTeam), g_szTeamName[iColor]);
            }

            for( 
0iNumi++ )
            {
                
id iPlayers[i];

                for(
j=0j<iMlNumberj++)
                {
                    
// Set all LANG_PLAYER args to player index ( = id )
                    // so we can format the text for that specific player
                    
setarg(ArrayGetCell(aStoreMLj), _id);
                }

                
// format string for specific player
                
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);

                if( 
iColor )
                {
                    
Send_TeamInfo(idiFoolszFakeTeam);
                    
Send_SayText(idiFoolszMessage);
                    
Send_TeamInfo(idiFoolszTeam);
                }
                else
                {
                    
Send_SayText(idiFoolszMessage);
                }
            }
            
ArrayDestroy(aStoreML);
        }
    }
    return 
1;
}
stock Send_TeamInfo(iReceiveriPlayerIdszTeam[])
{
    static 
iTeamInfo 0;
    if( !
iTeamInfo )
    {
        
iTeamInfo get_user_msgid("TeamInfo");
    }
    
message_begin(iReceiver MSG_ONE_UNRELIABLE MSG_BROADCASTiTeamInfo, .player=iReceiver);
    
write_byte(iPlayerId);
    
write_string(szTeam);
    
message_end();
}
stock Send_SayText(iReceiveriPlayerIdszMessage[])
{
    static 
iSayText 0;
    if( !
iSayText )
    {
        
iSayText get_user_msgid("SayText");
    }
    
message_begin(iReceiver MSG_ONE_UNRELIABLE MSG_BROADCASTiSayText, .player=iReceiver);
    
write_byte(iPlayerId);
    
write_string(szMessage);
    
message_end();
}
stock register_dictionary_colored(const filename[])
{
    if( !
register_dictionary(filename) )
    {
        return 
0;
    }

    new 
szFileName[256];
    
get_localinfo("amxx_datadir"szFileNamecharsmax(szFileName));
    
format(szFileNamecharsmax(szFileName), "%s/lang/%s"szFileNamefilename);
    new 
fp fopen(szFileName"rt");
    if( !
fp )
    {
        
log_amx("Failed to open %s"szFileName);
        return 
0;
    }

    new 
szBuffer[512], szLang[3], szKey[64], szTranslation[256], TransKey:iKey;

    while( !
feof(fp) )
    {
        
fgets(fpszBuffercharsmax(szBuffer));
        
trim(szBuffer);

        if( 
szBuffer[0] == '[' )
        {
            
strtok(szBuffer[1], szLangcharsmax(szLang), szBuffer1']');
        }
        else if( 
szBuffer[0] )
        {
            
strbreak(szBufferszKeycharsmax(szKey), szTranslationcharsmax(szTranslation));
            
iKey GetLangTransKey(szKey);
            if( 
iKey != TransKey_Bad )
            {
                while( 
replace(szTranslationcharsmax(szTranslation), "!g""^4") ){}
                while( 
replace(szTranslationcharsmax(szTranslation), "!t""^3") ){}
                while( 
replace(szTranslationcharsmax(szTranslation), "!n""^1") ){}
                
AddTranslation(szLangiKeyszTranslation[2]);
            }
        }
        
    }
    
    
fclose(fp);
    return 
1;

ML file : ( only HUD MSGS )
PHP Code:
[en]
/*HUDS*/
HUD_SPEED_NOAG No AGs received.^nYour Maxspeed this round : %f^nYour Maxspeed for this map : %f^nBest Maxspeed was %f made by %s
HUD_SPEED_AGS 
Received AGs this round : %d AG^nYour Maxspeed this round : %f^nYour Maxspeed for this map : %f^nBest Maxspeed was %f made by %s
HUD_SPEED_SPEC 
Status Spectator^nCurrentspeed : %f^nBest Maxspeed was %f made by %s
FORMAT_FLEER_STATUS_USED 
You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - %d%+
FORMAT_FLEER_STATS_UNUSED You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - %d
FORMAT_FLEER_TURBO_OFF You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - OFF
FORMAT_CATCHER_STATUS 
You are now a CATCHER.^nYou have to CATCH^nTurbo: [|||||||||||||||] - %d%
FORMAT_CATCHER_TURBO_OFF You are now a CATCHER.^nYou have to CATCH^nTurbo: [|||||||||||||||] - OFF 
LOGS
Code:
L 05/24/2011 - 12:41:30: [AMXX] Displaying debug trace (plugin "to_upload.amxx")
L 05/24/2011 - 12:41:30: [AMXX] Run time error 25: parameter error 
L 05/24/2011 - 12:41:30: [AMXX]    [0] to_upload.sma::Player_Show_Stats (line 1880)
L 05/24/2011 - 12:41:30: [AMXX]    [1] to_upload.sma::Show_Stats (line 1842)
L 05/24/2011 - 12:41:33: String formatted incorrectly - parameter 6 (total 5)
with normal dictionary i have no errors.

format of hud :
PHP Code:
format(turbos,123,"%L",LANG_PLAYER,"FORMAT_CATCHER_STATUS"
Attached Thumbnails
Click image for larger version

Name:	chatcolor.JPG
Views:	287
Size:	43.5 KB
ID:	86562  
__________________

Last edited by One; 05-24-2011 at 06:52.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-24-2011 , 07:13   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #116

Well, I'm not sure if your report is valid, because you're showing alot of unrelated stuff.. like the error, it's not triggered because of that format line, since that format line's lang key only requests one extra param, but in the error it says 6.
__________________
Hunter-Digital is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-24-2011 , 08:15   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #117

line 1880=

PHP Code:
format(turbos,511,"%L",LANG_PLAYER,"FORMAT_CATCHER_STATUS"
line 1842 =
PHP Code:
Player_Show_Stats(id
FORMAT_CATCHER_STATUS =

PHP Code:
FORMAT_CATCHER_STATUS You are now a CATCHER.^nYou have to CATCH^nTurbo: [|||||||||||||||] - %d
fullcode of function :

Code:
public Player_Show_Stats(id) 
{
    if(!Catch_Enable)
    {
        return PLUGIN_HANDLED
    }
    new turbos[512]
    set_dhudmessage(0, 255, 0, 0.40, 0.70, 2, 2.0, 0.05, 0.1, 1.5)
    if(!user_is_catcher[id]) 
    {
        if(TURBO[id][1] >= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            if(TURBO[id][0] == 1)
            {
                turbo_used[id]++
                set_dhudmessage(255, 0, 0, 0.40, 0.70, 2, 2.0, 0.05, 0.1, 1.5)
                format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_STATUS_USED",TURBO[id][1])
            }
            else if(TURBO[id][1])
            {
                format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_STATS_UNUSED",TURBO[id][1])    
            }
        }
        else if(TURBO[id][1] <= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_TURBO_OFF")
        }
    }
    else if(user_is_catcher[id]) 
    {
        format(turbos,511,"%L",LANG_PLAYER,"FORMAT_CATCHER_STATUS")
    }
    show_dhudmessage(id, "%s",turbos)
    return PLUGIN_HANDLED
}
as i said, with register_dictionary is there no error and it works.

thats all. if you like i can post the fullcode too.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-24-2011 , 10:52   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #118

Oh actually I think the error says about the function's param number... and yeah, you have 5 and the lang key has an additional parameter there (Turbo: [|||||||||||||||] - %d%), the turbo status, so you need to add a int value to the format.

And I dunno why it works with normal register_dictionary(), maybe it didn't reach that code ?
I used that too, lang keys with params in them, and if I forget to add them after the language I get in-game errors, but I use the normal register_dictionary().
__________________

Last edited by Hunter-Digital; 05-24-2011 at 10:55.
Hunter-Digital is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-24-2011 , 12:11   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #119

Not related to the stock, register_dictionary_colored first sends default register_dictionary, and after than it only alters keys that contain !g !n and !t.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-24-2011 at 12:15.
ConnorMcLeod is offline
Old 05-24-2011, 13:07
One
This message has been deleted by One. Reason: .
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-24-2011 , 14:09   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #120

Quote:
Originally Posted by Hunter-Digital View Post
Oh actually I think the error says about the function's param number... and yeah, you have 5 and the lang key has an additional parameter there (Turbo: [|||||||||||||||] - %d%), the turbo status, so you need to add a int value to the format.

And I dunno why it works with normal register_dictionary(), maybe it didn't reach that code ?
I used that too, lang keys with params in them, and if I forget to add them after the language I get in-game errors, but I use the normal register_dictionary().
omg
1. i hope its the problem
2. i loose yesterday my code and i tried 2day to rewrite the code. thats why i have in old code no values.
for first its solved.i try to rewrite the code ( which i wrote yesterday ) and see if its the problem.

ty
EDIT :

its the same...
no error....



i have no idea whats the problem.

fullcode :

PHP Code:
/*    +---------------------------------------------------------------------------------------+
    |                AUTHOR COMMENTS                        |
    +---------------------------------------------------------------------------------------+

        - Linie 543:
        
        Ganzes System mit "CSTS_ARE_CATCHER" geändert
        Godmode geändert
        
        - Linie 310:
        
        get_user_team -> cs_get_user_team
        client_print(0,print_chat,"[ %s %s ] X Team won this round weg
        
        Im Init:
        
        ResetHUD weg
        
        Ganzer Code:
        
        Speed_settings(id) weg
        Prethink weg
        
        Neu:
        
        Win Sounds
        
        Check curweapon vs Ham :
        public Player_ResetMaxSpeed(id)
        {
            if(is_user_alive(id) //&& get_user_maxspeed(id) != 1.0) // check if player is freezed
            {
                set_user_maxspeed(id, float:XXX)
            }
        }
        #define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
        RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1)
        RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "BlockKnife");
        
        Line 640 :

        if(!is_user_alive(i))
        {
            ShowSyncHudMsg(i, SyncHud, "Speed : %f",speed)
        }
        // Check as Spec for real speed.
        
        line 616 ( render ) -> check for team to change the render.
        
        if( alive users <= 2)
        {
            block kill
        }
        
        if check in speed function.
        if(alive)
        ...
        else

*/
/*    +---------------------------------------------------------------------------------------+
    |                    TODO LIST                    |
    +---------------------------------------------------------------------------------------+


        REMOVE SMITYP TO GAMETYP ( TRAINING OR NORMAL ) BY NORMAL SEMITYP = 2
        Turbo mods
        Semiclip
        Traininmod
        Walljump
        Trail
        Keyspy
        Menu
        Welcome menu
        Trainingmod
        buyzone
        anticamp
        turbo für catcher 
        render change by speed ( test )
        entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 1.0) -> 1.0 or 0.1 ( FREQ ) <- must be checked.
        AG ANZAHL ändern
        if orpheu is running
        Fix Turbo MSG
...
*/
/*    +---------------------------------------------------------------------------------------+
    |                    DID LIST                    |
    +---------------------------------------------------------------------------------------+

        teamchange fix
        Touch
        Touched score -1
        godmode
        render cvars
        test the score
        catch teams
        spec speed
        überleben punkte
        Speedometer ( test ) ( spec )
        AG test
        turbo chilldown time CVAR

*/
/*    +---------------------------------------------------------------------------------------+
    |                    INCLUDED                    |
    +---------------------------------------------------------------------------------------+

        Speedometer by AciD

*/
/*    +---------------------------------------------------------------------------------------+
    |                    INCLUDES                    |
    +---------------------------------------------------------------------------------------+

        dhudmessage
        screenfade_util
        round_terminator
        ChatColor ConnorMcLeod

*/

/*    +---------------------------------------------------------------------------------------+
    |            CHECK THE COMMENTS FOR CREDITS                    |
    +---------------------------------------------------------------------------------------+
*/
/*    +---------------------------------------------------------------------------------------+
    |            Copyright of CATCHMOD GOLD EDITION  by ONE :            |
    |                                            |
    |                                            |
    |    Copyright © 2011, ONE                                |
    |                                            |
    |    CATCHMOD GOLD EDITION is free software;                        |
    |    you can redistribute it and/or modify it under the terms of the            |
    |    GNU General Public License as published by the Free Software Foundation.    |
    |                                            |
    |    This program is distributed in the hope that it will be useful,            |
    |    but WITHOUT ANY WARRANTY; without even the implied warranty of            |
    |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
    |    GNU General Public License for more details.                    |
    |                                            |
    |    You should have received a copy of the GNU General Public License        |
    |    along with CATCHMOD GOLD EDITION; if not, write to the                |
    |    Free Software Foundation, Inc., 59 Temple Place - Suite 330,            |
    |    Boston, MA 02111-1307, USA.                            |
    |                                            |
    +---------------------------------------------------------------------------------------+
*/
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#include <screenfade_util>
#include <dhudmessage>
#include <round_terminator>
#include <cvar_util>
#include <sqlx> 


#define PLUGIN "Catchmod Gold Edition"
#define VERSION "1.0.19"
#define AUTHOR "Dr.One"
#define FREQ 0.1
#define IsPlayer(%1)     (1 <= %1 <= E_MaxPlayers)
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
#define MAX_PLAYERS             32 + 1
#define m_pPlayer 41
#define XO_WEAPON 4
#define DISTANCE 120
#define LIVE_TASK_ID 6341
/*#define QUERY_CREATE_TABLE "CREATE TABLE IF NOT EXISTS `catch_live` ( \
         `authid` VARCHAR( 32 ) NOT NULL, \
         `rank` INT( 6 ) NOT NULL, \
         `name` VARCHAR( 32 ) NOT NULL, \
         `AGs` INT( 6 ) NOT NULL, \
         `maxspeed` INT( 12 ) NOT NULL, \
    `map` VARCHAR( 32 ) NOT NULL, \
    `catched` INT( 6 ) NOT NULL, \
    `catchs` INT( 6 ) NOT NULL, \
    `fps` INT( 6 ) NOT NULL, \
    `survives` INT( 6 ) NOT NULL, \
    `flagged` INT( 6 ) NOT NULL, \
    `live_map` VARCHAR( 32 ) NOT NULL, \
    `live_speed` INT( 6 ) NOT NULL, \);"*/

#define QUERY_CREATE_TABLE "CREATE TABLE IF NOT EXISTS `catch_live` ( \
         
`authidVARCHAR32 NOT NULL, \
         `
nameVARCHAR32 NOT NULL, \
         `
ScoreINTNOT NULL, \
         `
DeathsINTNOT NULL, \
    `
PingINT32 NOT NULL, \
    `
speedINT12 NOT NULL, \
    `
MaxspeedINT12 NOT NULL, \
    `
fpsINTNOT NULL, \
    `
teamINTNOT NULL, \
    `
agINTNOT NULL, \
    `
mapVARCHAR32 NOT NULL);"
    
/*    +-----------------------------------------------+
    |    CHATCOLOR CREDIT @ ConnorMcLeod        |
    +-----------------------------------------------+    */
#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

/*    +-----------------------+
    |    MAIN HANDELS    |
    +-----------------------+    */
new round_counter = 1
new CSTS_ARE_CATCHER
new user_is_catcher[33]
new TURBO[33][2]
new E_MaxPlayers
new chilldown[33]
new SyncHud
new over_tausend[33]
new under_tausend[33]
new over_twotausend[33]
new winmsg[32]
new iconstatus
new score[33][4]
new deathMsg
new scoreMsg
new points[2]
new round_ednded
new fleer_win
new g_iEntClassName[] = "
speedometer_think"
new const SOUND_CATCHER_WIN[] = "
misc/applause.wav"
new const SOUND_FLEER_WIN[] = "
misc/applause.wav"
new const SOUND_CATCHER_WIN_DEFAULT[] = "
events/task_complete.wav"
new const SOUND_FLEER_WIN_DEFAULT[] = "
events/task_complete.wav"
new const SOUND_CATCHER_LOSE[] = "
misc/looser.wav"
new const SOUND_FLEER_LOSE[] = "
misc/looser.wav"
new const SOUND_CATCHER_LOSE_DEFAULT[] = "
events/friend_died.wav"
new const SOUND_FLEER_LOSE_DEFAULT[] = "
events/friend_died.wav"
new users_AG[33]
new AG_anzahl[33][8]
new current_AG[33]
new AG_loop[33]
static Float:users_maxspeed_round[33]
static Float:users_maxspeed_map[33]
static Float:best_speed
new top_speed_name[33]
new g_iIsSpectator[MAX_PLAYERS]
new g_points[MAX_PLAYERS]
new g_speed[MAX_PLAYERS]
new dead_fixed_icon[33]
new turbo_used[33]
enum 
{
    R,
    G,
    B
}
enum _:Colors 
{
    DontChange,
    CH_Red,
    Blue,
    Grey
}
new fix_task = 0
new users_team[33]
new bool:Solid[33]
new bool:user_has_semi[33]
new Float:Origin[33][3]
new Prethink
new Postthink
new Fullpack
new Handle:sqldb
new sql_ERROR[512]
new users_fps[33]
new map[33]
new score_live[33]
new Deaths_live[33]
static Float:live_speed
new Catch_Enable = 1
/*    +-----------------------+
    |    CVARS        |
    +-----------------------+    */
new CV_Semityp
new CV_Semitrynsparenty
new CV_catchers_speed
new CV_Bonnyhop
new CV_Turbo_Usage_Percent
new CV_Turbo_Usage_Time
new CV_Catch_speed
new CV_Catch_fleer_speed
new CV_Catch_Turbo_speed
new CV_Catch_Points
new CV_Catchers_Color
new CV_Catcher_Color_R
new CV_Catcher_Color_G
new CV_Catcher_Color_B
new CV_Fleer_Color
new CV_FLEER_Color_R
new CV_FLEER_Color_G
new CV_FLEER_Color_B
new CV_Speedometer_Color
new CV_Speedo_R
new CV_Speedo_G
new CV_Speedo_B
new CV_render_amount
new CV_render_amount_U
new CV_render_amount_O
new CV_render_amount_OO
new CV_survivor
new CV_AG_TURBO
new CV_CHILLDOWN_TIME
new CV_CUSTOM_SOUND
new CV_Turbo_fade
new CV_AMXSUPER_FIX
new CV_Turbo_fade_STR[3]
new CV_LIVE_STATUS
new CV_KILL_BLOCK
new CV_Turbo_toggle
public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_logevent("
newRound",2,"0=World triggered", "1=Round_Start")
    RegisterHam( Ham_Spawn, "
player","Players_Spawn",1)
    set_task(3.0,"
Show_Stats",6000,"",0,"ab")
    register_touch("
player","player","touch")
    register_touch("
trigger_multiple", "player", "Forward_TriggerMultipleTouch" )
    RegisterHam(Ham_Weapon_SecondaryAttack, "
weapon_knife", "second_attack")
    RegisterHam(Ham_Weapon_PrimaryAttack, "
weapon_knife", "primary_attack")
    RegisterHam(Ham_Item_Deploy, "
weapon_knife", "knife_weapon_change", 1)
    RegisterHam(Ham_Player_Jump, "
player", "bunnyhop")
    RegisterHam(Ham_Player_ResetMaxSpeed, "
player", "Speed_settings", 1)
    RegisterHam(Ham_AddPlayerItem, "
player", "Player_AddPlayerItem")
    register_logevent("
endround",2,"0=World triggered","1=Round_End")
    register_event("
TextMsg","game_comencing","a","2&#Game_C")
    
register_event("TextMsg""game_comencing""a""2=#Game_will_restart_in")
    
register_clcmd"say","Say_Command")
    
register_clcmd"say_team","Say_Command")
    
register_dictionary_colored("catchmod.txt")
    
register_forwardFM_CmdStart"FwdCmdStart" )
    
/*    +-----------------------------------------------+
        |    SPEEDOMETER FIXED BY VATO        |
        +-----------------------------------------------+    */
    
register_think(g_iEntClassName"fw_ThinkEntity")
    new 
iEnt create_entity("info_target")
    
entity_set_string(iEntEV_SZ_classnameg_iEntClassName)
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 1.0)
    
register_event("SpecHealth2""ev_SpecHealth2""bd")
    
    
E_MaxPlayers get_maxplayers()
    
SyncHud CreateHudSyncObj()
    
iconstatus get_user_msgid("StatusIcon")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_terwin")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_ctwin")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_rounddraw")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_BOMBPL")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_BOMBDEF")
    
register_event("SendAudio""play_win_sound""a""2&%!MRAD_rescued")
    
register_message(get_user_msgid("TextMsg"), "message_textmsg")
    
register_forwardFM_ClientKill,"cmd_kill");
    
register_clcmd("say a","cmd_kill")
    
deathMsg get_user_msgid("DeathMsg")
    
scoreMsg get_user_msgid("ScoreInfo")
    
set_task10.0"RestartRound" )
    
/*    +-----------------------+
        |    CVARS        |
        +-----------------------+    */
    
new Catchcvar CvarRegister"amx_catch_enable""1" )
    
CvarHookChangeCatchcvar,"Catch_Cvar" )
    
/*    +-------------------------------+
        |    CATCHERS SPEED        |
        +-------------------------------+    */
    
CV_catchers_speed register_cvar("amx_catch_catchers_speed","1.0")
    
/*    +-------------------------------+
        |    AUTO BUNNYHOP        |
        +-------------------------------+    */
    
CV_Bonnyhop register_cvar("amx_catch_bunnyhop","1")
    
/*    +-------------------------------+
        |    TURBO USAGE IN %    |
        +-------------------------------+    */
    
CV_Turbo_Usage_Percent register_cvar("amx_catch_turbo_percent","10")
    
CV_Turbo_toggle register_cvar("amx_turbo_toggle","1")            // 0 = OFF - 1 = FLEERS - 2 = BOTH TEAMS
    /*    +-----------------------+
        |    TURBO TIME    |
        +-----------------------+    */
    
CV_Turbo_Usage_Time register_cvar("amx_catch_turbo_usage_time","0.25")
    
/*    +---------------------------------------+
        |    GAME SPEED = 320 * VALUE    |
        +---------------------------------------+    */
    
CV_Catch_speed register_cvar("amx_catch_speed","2.0")
    
/*    +-------------------------------+
        |    FLEERS/TURBO SPEED    |
        +-------------------------------+    */
    
CV_Catch_fleer_speed register_cvar("amx_catch_fleer_speed","1.0")
    
CV_Catch_Turbo_speed register_cvar("amx_catch_turbo_speed","1.5")
    
/*    +-------------------------------+
        |    POINTS FOR CATCH    |
        +-------------------------------+    */
    
CV_Catch_Points register_cvar("amx_catch_points","3")
    
/*    +-------------------------------+
        |    SPEEDOMETER COLORS    |
        +-------------------------------+    */
    
CV_Speedometer_Color register_cvar("amx_catch_speed_colors""255 255 255")
    
/*    +-------------------------------+
        |    CATCHERS GLOW COLOR    |
        +-------------------------------+    */
    
CV_Catchers_Color register_cvar("amx_catcher_colors""255 000 000")
    
/*    +-------------------------------+
        |    FLEERS GLOW COLOR    |
        +-------------------------------+    */
    
CV_Fleer_Color register_cvar("amx_fleer_colors","000 255 000")
    
/*    +-------------------------------------------------------------------------------+
        |    UNDER 1000UNITS | OVER 1000UNITS | OVER 2000UNITS ( GLOW AMOUNT )    |
        +-------------------------------------------------------------------------------+    */
    
CV_render_amount register_cvar("amx_render_amount","25 50 125")
    
/*    +-------------------------------+
        |    SURVIVE POINTS        |
        +-------------------------------+    */
    
CV_survivor register_cvar("amx_survivor_points","1")
    
/*    +---------------------------------------+
        |    VALUE OF TURBO FOR 1 AG    IN %    |
        +---------------------------------------+    */
    
CV_AG_TURBO register_cvar("amx_turbo_AG","10")        // 0 = OFF - HIGHER = TURBO %
    /*    +-------------------------------------------------------+
        |    CHILLDOWN BEFORE USE TURBO AGAIN IN SEC.    |
        +-------------------------------------------------------+    */
    
CV_CHILLDOWN_TIME register_cvar("amx_chilldown_time","3.0")
    
/*    +-------------------------------+
        |    CUSTOM WINSOUNDS    |
        +-------------------------------+    */
    
CV_CUSTOM_SOUND register_cvar("amx_customwinsound","1")
    
/*    +-------------------------------+
        |    FADE COLOR R | G | B    |
        +-------------------------------+    */
    
CV_Turbo_fade register_cvar("amx_turbo_fade_color","0 0 150")
    
/*    +---------------------------------------+
        |    UPDATE LIVESTATUS IN SEC.    |
        +---------------------------------------+    */
    
CV_LIVE_STATUS register_cvar("amx_update_live_status","10")
    
/*    +-------------------------------------------------------+
        |    0 = DEACTIVE / LESS VALUE = BLOCK CMD        |
        +-------------------------------------------------------+    */
    
CV_KILL_BLOCK register_cvar("amx_block_kills","2")
    
set_task(get_pcvar_float(CV_LIVE_STATUS),"update_live_stats",LIVE_TASK_ID,_,_,"ab")
    
/*    +---------------------------------------+
        |    FIX AMXSUPER TO GIVE GODMODE    |
        +---------------------------------------+    */
    
CV_AMXSUPER_FIX register_cvar("amx_amxsuper_fix","1")
    
/*    +-----------------------------------------------------------------------------------------------+
        |    0 = DEACTIVE | 1 = ONLY TEAM | 2 = FOR ALL ( WILLBE ACTIVATED ON TRAINING MOD )        |
        +-----------------------------------------------------------------------------------------------+    */
    
new handleCvar CvarRegister"amx_semiclip_enabled""1");
    
CvarHookChangehandleCvar"SemiclipCvar" );
    
    
toggleForward( .enable true );
    
CV_Semityp register_cvar"amx_semiclip_typ""0" )
    
CV_Semitrynsparenty register_cvar"amx_semiclip_transparancy""1" )
    
    new 
speedo_colors[16], speedo_red[4], speedo_green[4], speedo_blue[4]
    
get_pcvar_string(CV_Speedometer_Colorspeedo_colorssizeof speedo_colors 1)
    
parse(speedo_colorsspeedo_red3speedo_green3speedo_blue3)
    
CV_Speedo_R str_to_num(speedo_red)
    
CV_Speedo_G str_to_num(speedo_green)
    
CV_Speedo_B str_to_num(speedo_blue)
    
    
    new 
catchers_color[16],catchers_r[4], catchers_g[4], catchers_b[4]
    
get_pcvar_string(CV_Catchers_Colorcatchers_color,sizeof catchers_color -)
    
parse(catchers_color,catchers_r3catchers_g3catchers_b3)
    
CV_Catcher_Color_R str_to_num(catchers_r)
    
CV_Catcher_Color_G str_to_num(catchers_g)
    
CV_Catcher_Color_B str_to_num(catchers_b)
    
    new 
fleer_color[16],fleer_r[4], fleer_g[4], fleer_b[4]
    
get_pcvar_string(CV_Fleer_Colorfleer_color,sizeof fleer_color -)
    
parse(fleer_color,fleer_r3fleer_g3fleer_b3)
    
CV_FLEER_Color_R str_to_num(fleer_r)
    
CV_FLEER_Color_G str_to_num(fleer_g)
    
CV_FLEER_Color_B str_to_num(fleer_b)
    
    
    new 
turbo_fadecolor[16], turbo_fade_r[4], turbo_fade_g[4], turbo_fade_b[4]
    
get_pcvar_string(CV_Turbo_fade,turbo_fadecolor,sizeof turbo_fadecolor -1)
    
parse(turbo_fadecolorturbo_fade_r3,turbo_fade_g3,turbo_fade_b3)
    
CV_Turbo_fade_STR[R] = str_to_num(turbo_fade_r)
    
CV_Turbo_fade_STR[G] = str_to_num(turbo_fade_g)
    
CV_Turbo_fade_STR[b] = str_to_num(turbo_fade_b)
    
    
    new 
render_amm[16],render_am_U[4],render_am_O[4],render_am_OO[4]
    
get_pcvar_string(CV_render_amount,render_amm,sizeof render_amm -1)
    
parse(render_amm,render_am_U,3,render_am_O,3,render_am_OO,3)
    
CV_render_amount_U str_to_num(render_am_U)
    
CV_render_amount_O str_to_num(render_am_O)
    
CV_render_amount_OO str_to_num(render_am_OO)
    
set_task(1.0"install_db")
    
get_mapname(map,32)
    
}
public 
Catch_Cvar( const handleCvar, const oldValue[], const newValue[], const cvarName[] )
{
    
Catch_Enable = ( newValue] == '1' )
    
client_print_color0DontChange,"%L"LANG_PLAYER,Catch_Enable "CATCH_ON" "CATCH_OFF",PLUGIN )
    
server_cmd"sv_restart 1" );
    
//catch_toggleForward( .enable = newValue[ 0 ] == '1' );
}
public 
catch_toggleForward(const bool:enable )
{
    if(!
enable)
    {
        
client_print_color(0,DontChange"%L"LANG_PLAYER,"CATCH_OFF"PLUGIN)
        
Catch_Enable 0
    
}
    else
    {
        
client_print_color(0,DontChange"%L"LANG_PLAYER,"CATCH_ON"PLUGIN)
        
Catch_Enable 1
    
}
    
server_cmd("sv_restart 1")
}
/*    +-----------------------+
    |    BLOCK KILL     |
    +-----------------------+    */
public cmd_kill(const id)
{
    if(!
Catch_Enable || !is_user_alive(id))
    {
        return 
FMRES_IGNORED
    
}
    new 
connected_users 0
    
if(get_pcvar_num(CV_KILL_BLOCK) > 0)
    {
        for(new 
1<= E_MaxPlayers;i++)
        {
            if(
is_user_connected(i))
            {
                
connected_users++
            }
        }
        if(
connected_users <= get_pcvar_num(CV_KILL_BLOCK))
        {
            
client_print_color(idDontChange,"%L"LANG_PLAYER,"DONT_KILL"PLUGIN,get_pcvar_num(CV_KILL_BLOCK))
            
console_print(id,"%L",LANG_PLAYER,"CON_DONT_KILL"PLUGIN,get_pcvar_num(CV_KILL_BLOCK))
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}
public 
update_live_stats()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
steam_id[33],Temp[512],loss,ping
    
/*    +-------------------------------+
        |    0 = Connecting        |
        |    1 = Spec        |
        |    2 = Catcher        |
        |    3 = Fleer        |
        +-------------------------------+    */
    
for(new 1E_MaxPlayers;i++)
    {
        
get_user_ping(i,ping,loss)
        
get_user_authid(isteam_idcharsmax(steam_id))
        
format(Temp,charsmax(Temp),"UPDATE `catch_live` SET `speed`='%f' , `Maxspeed`='%f' , `fps`='%d' ,`Ping`='%d' , `ag`='0' WHERE `authid`='%s'",live_speed,users_maxspeed_round[i],users_fps,ping,steam_id)
        
SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
        
//client_print(0,print_chat,"UPDATED")
    
}
    return 
PLUGIN_HANDLED
}
public 
FwdCmdStartidiHandle )
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
users_fpsid ] = floatround/ ( get_uciHandleUC_Msec ) * 0.001 ) )
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    INSTALL DB    |
    +-----------------------+    */
public Say_Command(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
say_args[64]
    
read_args(say_argscharsmax(say_args))
    
remove_quotes(say_args)
    
    if(
say_args[0] != '/')
    {
        return 
PLUGIN_CONTINUE
    
}
    if(
equali(say_args"/install") || equali(say_args"/installdb"))
    {
        if(
get_user_flags(id) & ADMIN_KICK)
        {
            
install_db(id)
        }
        else
        {
            
client_print_color(idDontChange,"%L"LANG_PLAYER,"ERROR_NOT_ALLOWDED"PLUGIN)
        }
    }
    return 
PLUGIN_CONTINUE
}
public 
install_db(id)
{
    
    new 
host[64], user[64], pass[64], db[64]
    
get_cvar_string("amx_sql_host"host63)
    
get_cvar_string("amx_sql_user"user63)
    
get_cvar_string("amx_sql_pass"pass63)
    
get_cvar_string("amx_sql_db"db63)
    
sqldb SQL_MakeDbTuple(hostuserpassdb)
    new 
ErrorCode,Handle:SqlConnection SQL_Connect(sqldb,ErrorCode,sql_ERROR,charsmax(sql_ERROR))
    if(
SqlConnection == Empty_Handle)
    {
        
set_fail_state(sql_ERROR)
    }
    new 
Handle:Queries
    Queries 
SQL_PrepareQuery(SqlConnection,QUERY_CREATE_TABLE)
    
    if(!
SQL_Execute(Queries))
    {
        
SQL_QueryError(Queries,sql_ERROR,charsmax(sql_ERROR))
        
client_print_color(idDontChange,"%L"LANG_PLAYER,"ERROR_FAILED_INSTALL"PLUGIN)
        
set_fail_state(sql_ERROR)
    }
    else
    {
        
client_print_color(idDontChange,"%L"LANG_PLAYER,"SQL_INSTALLED"PLUGIN)
    }
    
SQL_FreeHandle(Queries)
    
SQL_FreeHandle(SqlConnection)
}
public 
Load_SQL(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
steam_id[33],Temp[512],name[33],loss,ping
    
/*    +-------------------------------+
        |    0 = Connecting        |
        |    1 = Spec        |
        |    2 = Catcher        |
        |    3 = Fleer        |
        +-------------------------------+    */
    
    
get_user_ping(id,ping,loss)
    
get_user_authid(idsteam_idcharsmax(steam_id))
    
get_user_name(id,name,32)
    
    
format(Temp,charsmax(Temp),"INSERT INTO `catch_live` ( `authid` , `name` , `Score` , `Deaths` , `Ping` , `speed` , `Maxspeed` , `fps` , `team` , `ag` , `map`)VALUES ('%s','%s','0','0','%d','0','0','%d','con','0','%s');",steam_id,name,ping,users_fps,map)
    
SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
    return 
PLUGIN_HANDLED
}
public 
client_disconnect(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
g_iIsSpectator[id] = 0
    Delete_SQL
(id)
    return 
PLUGIN_HANDLED
}
public 
Delete_SQL(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
/* Maybe i should delete the table or check if there are resaults for player on client_connect bacause of server crashed */
    
new steam_id[33],Temp[512]
    
get_user_authid(idsteam_idcharsmax(steam_id))
    
    
format(Temp,charsmax(Temp),"DELETE FROM `catch_live` WHERE `authid` = '%s'"steam_id);
    
SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
    return 
PLUGIN_HANDLED
}
public 
IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
SQL_FreeHandle(Query)
    
    return 
PLUGIN_HANDLED
}
/*    +-----------------------------------------------+
    |    Semiclip Forward Fix CREDIT @ Arkshine    |
    +-----------------------------------------------+    */
public SemiclipCvar( const handleCvar, const oldValue[], const newValue[], const cvarName[] )
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
toggleForward( .enable newValue] == '1' )
    return 
PLUGIN_HANDLED
}
toggleForward( const bool:enable )
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if( 
enable
    {
        
Prethink  register_forwardFM_PlayerPreThink"PreThink" );
        
Postthink register_forwardFM_PlayerPostThink"PostThink" );
        
Fullpack  register_forwardFM_AddToFullPack"Fullpack_Post");
    }
    else
    {
        
unregister_forwardFM_PlayerPreThinkPrethink );
        
unregister_forwardFM_PlayerPostThinkPostthink );
        
unregister_forwardFM_AddToFullPackFullpack);
    }
    return 
PLUGIN_HANDLED
}
public 
PreThink(plr)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
idlast_think

    
if(last_think plr)
    {
        for(
id 1;id <= E_MaxPlayers;id++ )
        {
            if(
is_user_alive(id))
            {
                if(
get_pcvar_num(CV_Semityp))
                {
                    
users_team[id] = get_user_team(id)
                }
                
Solid[id] = pev(id,pev_solid) == SOLID_SLIDEBOX true false
                pev
(id,pev_origin,Origin[id] )
            }
            else
            {
                
Solid[id] = false
            
}
        }
    }
    
last_think plr
    
if(Solid[plr])
    {
        for(
id 1;id <= E_MaxPlayers;id++)
        {
            if(
Solid[id] && get_distance_f(Origin[plr],Origin[id]) <= DISTANCE && id != plr )
            {
                if( 
get_pcvar_num(CV_Semityp) && users_team[plr] != users_team[id] )
                {
                    return 
FMRES_IGNORED
                
}
                
set_pev(id,pev_solid,SOLID_NOT)
                
user_has_semi[id] = true
            
}
        }
    }
    return 
FMRES_IGNORED
}
public 
PostThink(plr)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
id
    
for(id 1;id <= E_MaxPlayers;id++ )
    {
        if(
user_has_semi[id])
        {
            
set_pev(id,pev_solid,SOLID_SLIDEBOX)
            
user_has_semi[id] = false
        
}
    }
    return 
PLUGIN_HANDLED
}
public 
Fullpack_Post(handle,e,ent,host,hostflags,player,pset)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(
player)
    {
        if(
Solid[host] && Solid[ent] && get_distance_f(Origin[host],Origin[ent]) <= DISTANCE)
        {
            if(
get_pcvar_num(CV_Semityp) && users_team[host] != users_team[ent])
            {
                return 
FMRES_IGNORED
            
}
            
set_es(handle,ES_Solid,SOLID_NOT)
            if(
get_pcvar_num(CV_Semitrynsparenty) == 1)
            {
                
set_es(handle,ES_RenderMode,kRenderTransAlpha)
                
set_es(handle,ES_RenderAmt,85)
            }
            else if(
get_pcvar_num(CV_Semitrynsparenty) == 2)
            {
                
set_es(handle,ES_Effects,EF_NODRAW)
                
set_es(handle,ES_Solid,SOLID_NOT)
            }
        }
    }
    return 
FMRES_IGNORED
}
/*    +-----------------------+
    |    PRECACHE    |
    +-----------------------+    */
public plugin_precache()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
precache_sound("catchmod/ag_level_up.wav")
    
    if(
file_exists(SOUND_CATCHER_WIN) && get_pcvar_num(CV_CUSTOM_SOUND))
    {
        
precache_sound(SOUND_CATCHER_WIN)
        
precache_sound(SOUND_FLEER_WIN)
        
precache_sound(SOUND_CATCHER_LOSE)
        
precache_sound(SOUND_FLEER_LOSE)
    }
    else
    {
        
precache_sound(SOUND_CATCHER_WIN_DEFAULT)
        
precache_sound(SOUND_FLEER_WIN_DEFAULT)
        
precache_sound(SOUND_CATCHER_LOSE_DEFAULT)
        
precache_sound(SOUND_FLEER_LOSE_DEFAULT)
    }
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    FIX THE TEAMS    |
    +-----------------------+    */
public RestartRound()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
server_cmd("sv_restart 1")
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    SPEEDOMETER    |
    +-----------------------+    */
public fw_ThinkEntity(iEnt)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
SpeedTask()
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + FREQ)
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    RESETSTATS    |
    +-----------------------+    */
public newRound()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
round_ednded 0
    
for(new id=1;id<E_MaxPlayers;id++) 
    {
        
reset_stats(id)
    }
    return 
PLUGIN_HANDLED
}
/*    +-----------------------------------------------+
    |    TOP PLAYERS CREDIT @ Exolent[jNr]    |
    +-----------------------------------------------+    */
GetTopPlayers(players[32], &pnum, const flags[]="", const team[]="")
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
get_players(playerspnumflagsteam)
    
    
SortCustom1D(playerspnum"SortPlayers")
    return 
PLUGIN_HANDLED
}
public 
SortPlayers(item1item2)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
diff g_points[item2] - g_points[item1]
    
    if( !
diff )
    {
        
diff g_speed[item2] - g_speed[item1]
    }
    return 
clamp(diff, -11)
}
/*    +-----------------------+
    |    RESET STATS    |
    +-----------------------+    */
public game_comencing()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    for(new 
id 1;id <= E_MaxPlayers;id++)
    {
        
score[id][0] = 0
        score
[id][1] = 0
        score
[id][2] = 0
        score
[id][3] = 0
    
}
    if(
round_counter)
    {
        
round_counter 0
    
}
    else if(!
round_counter)
    {
        
round_counter 1
    
}
    return 
PLUGIN_HANDLED
}
public 
endround()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
round_ednded 1
    
    
if(round_counter)
    {
        
round_counter 0
        CSTS_ARE_CATCHER 
1
    
}
    else if(!
round_counter)
    {
        
round_counter 1
        CSTS_ARE_CATCHER 
0
    
}
    new 
punkte 0
    fleer_win 
0
    
for(new id=1;id<E_MaxPlayers;id++) 
    {
        if(
is_user_alive(id) && !user_is_catcher[id]) 
        {
            
score[id][3]++
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                
points[0] += get_pcvar_num(CV_survivor)
            }
            else
            {
                
points[1] += get_pcvar_num(CV_survivor)
            }    
            
score[id][0] = score[id][0] + get_pcvar_num(CV_survivor)
            
apply_scoreboard_survived(id)
            
punkte++
            
fleer_win 1
        
}    
    }
    if(
fleer_win == 1
    {
        
client_print_color(0,DontChange"%L"LANG_PLAYER,"FLEERS_WON"PLUGIN,punkte*get_pcvar_num(CV_survivor),punkte*get_pcvar_num(CV_survivor) > "s" "")
    }
    else
    {
        
client_print_color(0DontChange,"%L"LANG_PLAYER,"CATCHERS_WON"PLUGIN)
    }
    new 
players[32], pnum
    GetTopPlayers
(playerspnum"h")
    new 
idname[33]
    new 
message[512], len
    
for( new 0pnumi++ )
    {
        
id players[i];
        
get_user_name(id,name,32)        
        
        
len += formatex(message[len], charsmax(message) - len"%s%d. %s : AG : %d Speed : %d"len "^n" "", (1), nameg_points[id], g_speed[id]);
    }
    
set_hudmessage(255,255,255,0.02,0.25,0,0.1,5.0,0.0,0.0)
    
show_hudmessage(0,"%s",message)

    
update_teamscore()
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    SCOREBOARD    |
    +-----------------------+    */
public update_teamscore() 
{
    
message_begin(MSG_ALL,get_user_msgid("TeamScore"))
    
write_string("TERRORIST")
    
write_short(points[0])
    
message_end()
    
    
message_begin(MSG_ALL,get_user_msgid("TeamScore"))
    
write_string("CT")
    
write_short(points[1])
    
message_end()
}
/*    +-----------------------+
    |    RESET AGs    |
    +-----------------------+    */
public reset_stats(id)
{
    
TURBO[id][0] = 0
    users_maxspeed_round
[id] = 0.0
    
if(get_pcvar_num(CV_Turbo_toggle) == 1)
    {
        if(!
user_is_catcher[id])
        {
            if(
get_pcvar_num(CV_AG_TURBO))
            {
                if(
users_AG[id] == 0)
                {
                    
AG_loop[id] = 0
                
}
                else if(
users_AG[id] == 1)
                {
                    
AG_loop[id] = 1
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 2)
                {
                    
AG_loop[id] = 2
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 3)
                {
                    
AG_loop[id] = 3
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 4)
                {
                    
AG_loop[id] = 4
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 5)
                {
                    
AG_loop[id] = 5
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 6)
                {
                    
AG_loop[id] = 6
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                else if(
users_AG[id] == 8)
                {
                    
AG_loop[id] = 8
                    users_AG
[id] = 0
                    current_AG
[id] = 0
                
}
                
AG_anzahl[id][1] = 0
                AG_anzahl
[id][2] = 0
                AG_anzahl
[id][3] = 0
                AG_anzahl
[id][4] = 0
                AG_anzahl
[id][5] = 0
                AG_anzahl
[id][6] = 0
                AG_anzahl
[id][7] = 0
                set_task
(1.0,"Give_AGs",id,"",_,"a",AG_loop[id])
            }
            
TURBO[id][1] = 100
        
}
    }
    else if(
get_pcvar_num(CV_Turbo_toggle) == 2)
    {
        if(
get_pcvar_num(CV_AG_TURBO))
        {
            if(
users_AG[id] == 0)
            {
                
AG_loop[id] = 0
            
}
            else if(
users_AG[id] == 1)
            {
                
AG_loop[id] = 1
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 2)
            {
                
AG_loop[id] = 2
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 3)
            {
                
AG_loop[id] = 3
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 4)
            {
                
AG_loop[id] = 4
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 5)
            {
                
AG_loop[id] = 5
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 6)
            {
                
AG_loop[id] = 6
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            else if(
users_AG[id] == 8)
            {
                
AG_loop[id] = 8
                users_AG
[id] = 0
                current_AG
[id] = 0
            
}
            
AG_anzahl[id][1] = 0
            AG_anzahl
[id][2] = 0
            AG_anzahl
[id][3] = 0
            AG_anzahl
[id][4] = 0
            AG_anzahl
[id][5] = 0
            AG_anzahl
[id][6] = 0
            AG_anzahl
[id][7] = 0
            set_task
(1.0,"Give_AGs",id,"",_,"a",AG_loop[id])
        }
        
TURBO[id][1] = 100
    
}
}
/*    +-----------------------+
    |    AG SOUND TASK    |
    +-----------------------+    */
public Give_AGs(id)
{
    
fix_task++
    
TURBO[id][1] = TURBO[id][1] + get_pcvar_num(CV_AG_TURBO)
    
emit_sound(idCHAN_ITEM"catchmod/ag_level_up.wav"1.0ATTN_NORM0PITCH_NORM)
    if(
fix_task == AG_loop[id])
    {
        
AG_loop[id] = 0
    
}
}
/*    +-----------------------+
    |    TOUCH        |
    +-----------------------+    */
public touch(pToucherpTouched)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(!
round_ednded)
    {
        if(
IsPlayer(pToucher) && is_user_alive(pToucher) && user_is_catcher[pToucher])
        {
            if(
IsPlayer(pTouched) && is_user_alive(pTouched) && !user_is_catcher[pTouched])
            {    
                
score[pToucher][0] = score[pToucher][0] + get_pcvar_num(CV_Catch_Points)
                
score[pToucher][1]++
                
score[pTouched][2]++
                
                
                
set_msg_block(deathMsg,BLOCK_ONCE
                
set_msg_block(scoreMsg,BLOCK_ONCE)
                
user_silentkill(pTouched)
                
make_deathmsg(pToucher,pTouched,0,"his hands")
                
                
apply_scoreboard(pToucher)
                
apply_scoreboard(pTouched)                
                
update_teamscore()
            }
        }
    }
    return 
PLUGIN_HANDLED
}
public 
Forward_TriggerMultipleTouch(iEntityid)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
szModel[32]
    
entity_get_string(iEntityEV_SZ_modelszModel31)
    
    new 
target[32]
    
pev(iEntitypev_targetnametarget31)
    
    if(
is_user_alive(id) && !user_is_catcher[id] && equal(target"finish_round_fleer"))
    {
        new 
name[32]
        
get_user_name(id,name,32)
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_T:
            {
                
TerminateRound(RoundEndType_Objective,TeamWinning_Terrorist)
                
client_print_color(0DontChange,"%L"LANG_PLAYER,"TERR_CATCHED_FLAG"PLUGIN,name)
            }
            case 
CS_TEAM_CT:
            {
                
TerminateRound(RoundEndType_Objective,TeamWinning_Ct)
                
client_print_color(0DontChange,"%L"LANG_PLAYER,"CTS_CATCHED_FLAG"PLUGIN,name)
            }
        }
    }
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    UPDATE BOARD    |
    +-----------------------+    */
public apply_scoreboard(id
{
    
score_live[id] = get_user_frags(id)
    
Deaths_live[id] = get_user_deaths(id)
    
message_begin(MSG_ALL,get_user_msgid("ScoreInfo"))
    
write_byte(id)
    
write_short(score[id][0])
    
write_short(score[id][2])
    
write_short(0)
    
write_short(get_user_team(id))
    
message_end()
}
public 
apply_scoreboard_survived(id
{
    
score_live[id] = get_user_frags(id)
    
Deaths_live[id] = get_user_deaths(id)
    
message_begin(MSG_ALL,get_user_msgid("ScoreInfo"))
    
write_byte(id)
    
write_short(score[id][0])
    
write_short(score[id][2])
    
write_short(0)
    
write_short(get_user_team(id))
    
message_end()
}
/*    +-----------------------+
    |    SET EQUIPS    |
    +-----------------------+    */
public Players_Spawn(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
score_live[id] = get_user_frags(id)
    
Deaths_live[id] = get_user_deaths(id)
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {
        
g_iIsSpectator[id] = 0
        
if(get_pcvar_num(CV_AMXSUPER_FIX))
        {
            
set_task(3.0"godmode"id)
        }
        if(
CSTS_ARE_CATCHER == 1)
        {
            
Equip_Catcher(id)
        }
        else if(
CSTS_ARE_CATCHER == 0)
        {
            
Equip_Fleer(id)
        }
    }
    else if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
    {
        
g_iIsSpectator[id] = 0
        
if(get_pcvar_num(CV_AMXSUPER_FIX))
        {
            
set_task(3.0"godmode"id)
        }
        if(
CSTS_ARE_CATCHER == 0)
        {
            
Equip_Catcher(id)
        }
        else if(
CSTS_ARE_CATCHER == 1)
        {
            
Equip_Fleer(id)
        }
    }
    else if(
is_user_connected(id))
    {
        
set_user_rendering(id_000_0)
    }
    return 
PLUGIN_HANDLED
}
public 
Equip_Catcher(id)
{
    if(
is_user_alive(id))
    {
        
user_is_catcher[id] = 1
        set_user_rendering
(id,kRenderFxGlowShell,CV_Catcher_Color_R,CV_Catcher_Color_G,CV_Catcher_Color_B,kRenderNormal,CV_render_amount_U)
        
strip_user_weapons(id)
        
give_item(id,"weapon_knife")
        
set_user_godmode(id,1)
        
apply_scoreboard(id)
    }
}
public 
Equip_Fleer(id)
{
    if(
is_user_alive(id))
    {
        
user_is_catcher[id] = 0
        set_user_rendering
(id,kRenderFxGlowShell,CV_FLEER_Color_R,CV_FLEER_Color_G,CV_FLEER_Color_B,kRenderNormal,CV_render_amount_U)
        
strip_user_weapons(id)
        
give_item(id,"weapon_knife")
        
set_user_godmode(id,1)
        
apply_scoreboard(id)
    }
}
/*    +-------------------------------+
    |    GODMODE FOR DMGS    |
    +-------------------------------+    */
public godmode(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(
is_user_alive(id))
    {
        
set_user_godmode(id,1)
    }
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    SPEEDOMETER FIX        |
    +-------------------------------+    */
public client_putinserver(id
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
g_iIsSpectator[id] = 0
    Load_SQL
(id)
    return 
PLUGIN_HANDLED
}
public 
ev_SpecHealth2(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
g_iIsSpectator[id] = read_data(2)
    return 
PLUGIN_HANDLED
}  
/*    +---------------------------------------+
    |    BUNNYHOP CREDIT @ Bibu/One    |
    +---------------------------------------+    */
public bunnyhop(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(!
is_user_alive(id) || !get_pcvar_num(CV_Bonnyhop))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
buttons get_user_button(id)

    if(
buttons IN_JUMP
    {
        new 
flags entity_get_int(idEV_INT_flags)
            
        if(
flags|FL_WATERJUMP && entity_get_int(id,EV_INT_waterlevel)<&& flags&FL_ONGROUND
        {
            static 
Float:velocity[3]
            
entity_get_vector(idEV_VEC_velocityvelocity
            
velocity[2] += 250.0
            entity_set_vector
(idEV_VEC_velocityvelocity)
            
entity_set_int(idEV_INT_gaitsequence6)
        }
    }
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    TURBO FIX CREDIT @ Bibu    |
    +-------------------------------+    */
public second_attack(ent)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(!
get_pcvar_num(CV_Turbo_toggle))
    {
        return 
HAM_SUPERCEDE
    
}
    new 
id pev(ent,pev_owner)
    
    if(!
IsPlayer(id))
    {
        return 
HAM_IGNORED
    
}
    else if(!
chilldown[id])
    {
        if(
TURBO[id][0] == && TURBO[id][1] >= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            
User_has_turbo_ON(id)
        }
        else if(
TURBO[id][0] == 1)
        {
            
User_has_turbo_OFF(id)
        }
        return 
HAM_SUPERCEDE
    
}
    else
    {
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}
/*    +-------------------------------+
    |    ATTACK CREDIT @ Bibu    |
    +-------------------------------+    */
public primary_attack(ent)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
id pev(ent,pev_owner)
    
    if(
IsPlayer(id))
    {
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}
/*    +-------------------------------+
    |    REMOVE KNIFE MODEL    |
    +-------------------------------+    */
public knife_weapon_change(iEnt)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
id get_pdata_cbase(iEntm_pPlayerXO_WEAPON)

    
set_pev(idpev_viewmodel2"")
    
set_pev(idpev_weaponmodel2"")
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    SPEEDOMETER THINK    |
    +-------------------------------+    */
public SpeedTask()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
itarget
    
static Float:velocity[3]
    static 
Float:speed
    
for(i=1i<=E_MaxPlayersi++)
    {
        if(
is_user_alive(i))
        {
            
target pev(ipev_iuser1) == pev(ipev_iuser2) : i
            pev
(targetpev_velocityvelocity)
            
            
speed vector_length(velocity)
            
set_hudmessage(CV_Speedo_RCV_Speedo_GCV_Speedo_B0.410.7600.0FREQ0.010.0)
            if(
speed users_maxspeed_round[i])
            {
                
users_maxspeed_round[i] = speed            
            
}
            if(
speed users_maxspeed_map[i])
            {
                
users_maxspeed_map[i] = speed
            
}
            if(
speed best_speed)
            {
                
best_speed speed
                get_user_name
(i,top_speed_name,32)
            }
            
//new steam_id[33],Temp[512],loss,ping
            /*team :
                0 = connecting
                1 = spectating
                2 = Catcher
                3 = Fleer
            */
    
            //get_user_ping(i,ping,loss)
            //get_user_authid(i, steam_id, charsmax(steam_id))
            
live_speed speed
            
if(!get_pcvar_num(CV_AG_TURBO))
            {
                
ShowSyncHudMsg(i,SyncHud,"%L",LANG_PLAYER,"HUD_SPEED",users_maxspeed_round[i],users_maxspeed_map[i],best_speed,top_speed_name)
            }
            else
            {
                if(!
current_AG[i])
                {
                    
//format(Temp,charsmax(Temp),"UPDATE `catch_live` SET `speed`='%f' , `Maxspeed`='%f' , `fps`='%d' ,`Ping`='%d' , `ag`='0' WHERE `authid`='%s'",speed,users_maxspeed_round[i],users_fps,ping,steam_id)
                    
ShowSyncHudMsg(i,SyncHud,"%L",LANG_PLAYER,"HUD_SPEED_NOAG",users_maxspeed_round[i],users_maxspeed_map[i],best_speed,top_speed_name)
                }
                else
                {
                    
//format(Temp,charsmax(Temp),"UPDATE `catch_live` SET `speed`='%f' , `Maxspeed`='%f' , `fps`='%d' ,`Ping`='%d' , `ag`='%d' WHERE `authid`='%s'",speed,users_maxspeed_round[i],users_fps,ping,current_AG[i],steam_id)
                    
ShowSyncHudMsg(i,SyncHud,"%L",LANG_PLAYER,"HUD_SPEED_AGS",current_AG[i],users_maxspeed_round[i],users_maxspeed_map[i],best_speed,top_speed_name)
                }
            }
            
//client_print(i,print_chat,"%s",Temp)
            //SQL_ThreadQuery(sqldb,"IgnoreHandle",Temp)
            
if(speed <= 1000)
            {
                
cs_set_user_armor(i,floatround(speed),CS_ARMOR_NONE)
                if(!
under_tausend[i])
                {
                    
message_begin(MSG_ONE,iconstatus,{0,0,0},i)
                    
write_byte(0
                    
write_string("item_longjump")
                    
write_byte(0)
                    
write_byte(255)
                    
write_byte(0)
                    
message_end()
                    
under_tausend[i] = 1
                    over_tausend
[i] = 0
                    over_twotausend
[i] = 0
                    dead_fixed_icon
[i] = 0
                    
if(!user_is_catcher[i])
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_FLEER_Color_R,CV_FLEER_Color_G,CV_FLEER_Color_B,kRenderNormal,CV_render_amount_U)
                    }
                    else
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_Catcher_Color_R,CV_Catcher_Color_G,CV_Catcher_Color_B,kRenderNormal,CV_render_amount_U)
                    }
                }
            }
            else if(
speed 1000 && speed 2000)
            {
                
cs_set_user_armor(i,floatround(speed) - 1000,CS_ARMOR_NONE)
                if(!
over_tausend[i])
                {
                    
message_begin(MSG_ONE,iconstatus,{0,0,0},i)
                    
write_byte(2)
                    
write_string("item_longjump")
                    
write_byte(0)
                    
write_byte(255
                    
write_byte(0)
                    
message_end()
                    
over_tausend[i] = 1
                    under_tausend
[i] = 0
                    over_twotausend
[i] = 0
                    dead_fixed_icon
[i] = 0
                    
if(user_is_catcher[i])
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_Catcher_Color_R,CV_Catcher_Color_G,CV_Catcher_Color_B,kRenderNormal,CV_render_amount_O)
                    }
                    else
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_FLEER_Color_R,CV_FLEER_Color_G,CV_FLEER_Color_B,kRenderNormal,CV_render_amount_O)
                    }
                }
                if(
get_pcvar_num(CV_AG_TURBO))
                {
                    if(
speed 1200 && !AG_anzahl[i][1])
                    {
                        
AG_anzahl[i][1] = 1
                        current_AG
[i] = 1
                        
                    
}
                    else if(
speed 1200 && !AG_anzahl[i][2])
                    {
                        
AG_anzahl[i][2] = 1
                        current_AG
[i] = 2
                    
}
                    else if(
speed 1400 && !AG_anzahl[i][3])
                    {
                        
AG_anzahl[i][3] = 1
                        current_AG
[i] = 3
                    
}
                    else if(
speed 1600 && !AG_anzahl[i][4])
                    {
                        
AG_anzahl[i][4] = 1
                        current_AG
[i] = 4
                    
}
                    else if(
speed 1800 && !AG_anzahl[i][5])
                    {
                        
AG_anzahl[i][5] = 1
                        current_AG
[i] = 5
                    
}
                }
            }
            else if(
speed 2000 && speed 3000)
            {
                
cs_set_user_armor(i,floatround(speed) - 2000,CS_ARMOR_NONE)
                if(!
over_twotausend[i])
                {
                    
message_begin(MSG_ONE,iconstatus,{0,0,0},i)
                    
write_byte(2)
                    
write_string("item_longjump")
                    
write_byte(255)
                    
write_byte(255)
                    
write_byte(0)
                    
message_end()
                    
over_tausend[i] = 0
                    under_tausend
[i] = 0
                    over_twotausend
[i] = 1
                    dead_fixed_icon
[i] = 0
                    
if(!user_is_catcher[i])
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_FLEER_Color_R,CV_FLEER_Color_G,CV_FLEER_Color_B,kRenderNormal,CV_render_amount_OO)
                    }
                    else
                    {
                        
set_user_rendering(i,kRenderFxGlowShell,CV_Catcher_Color_R,CV_Catcher_Color_G,CV_Catcher_Color_B,kRenderNormal,CV_render_amount_OO)
                    }
                }
                if(
get_pcvar_num(CV_AG_TURBO))
                {
                    if(
speed 2100 && !AG_anzahl[i][6])
                    {
                        
AG_anzahl[i][6] = 1
                        current_AG
[i] = 6
                    
}
                    else if(
speed 2400 && !AG_anzahl[i][7])
                    {
                        
AG_anzahl[i][7] = 1
                        current_AG
[i] = 8
                    
}
                }
            }
        }
        else
        {
            if(
is_user_connected(i) && !dead_fixed_icon[i])
            {
                
message_begin(MSG_ONE,iconstatus,{0,0,0},i)
                
write_byte(2)
                
write_string("item_longjump")
                
write_byte(255)
                
write_byte(255)
                
write_byte(0)
                
message_end()
                
dead_fixed_icon[i] = 1
            
}
            
ShowSyncHudMsg(i,SyncHud,"%L",LANG_PLAYER,"HUD_SPEED_SPEC",speed,best_speed,top_speed_name)
        }
        if(
get_pcvar_num(CV_AG_TURBO))
        {
            
users_AG[i] = current_AG[i]
            
g_points[i] = users_AG[i]
        }
        
g_speed[i] = floatround(users_maxspeed_round[i])
    }
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    TURBO SETTINGS        |
    +-------------------------------+    */
public User_has_turbo_ON(id
{
    if(
is_user_alive(id) && !user_is_catcher[id]) 
    {
        if(
TURBO[id][1] < get_pcvar_num(CV_Turbo_Usage_Percent)) 
        {
            
TURBO[id][0] = 0
        
}
        else if(!
chilldown[id])
        {
            
TURBO[id][0] = 1
            TURBO
[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
            
set_task(get_pcvar_float(CV_Turbo_Usage_Time),"turbo_task",id)
            
Speed_settings(id)
            
chilldown[id] = 1
            UTIL_ScreenFade
(id,CV_Turbo_fade_STR,1.0,2.0,80)
        }
        
Player_Show_Stats(id)
    }
}
public 
User_has_turbo_OFF(id
{
    if(
TURBO[id][0] == 1
    {
        
TURBO[id][0] = 0
        remove_task
(id+10000)
        
Player_Show_Stats(id)
    }
}
public 
Speed_settings(id)  
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
Float:speed
    
    
if(!user_is_catcher[id])
    {
        
/*    +-------------------------------------------------------+
            |    STANDARD SPEED * CATCH TURBO * FLEERS SPEED    |
            +-------------------------------------------------------+    */
        
speed 320.0 get_pcvar_float(CV_Catch_speed) * get_pcvar_float(CV_Catch_fleer_speed)
        if(
TURBO[id][0] == 1)
        {
        
/*    +-------------------------------------------------------+
            |    SPEED * TURBOSPEED & SET SPEED BACK        |
            +-------------------------------------------------------+    */
            
speed *= get_pcvar_float(CV_Catch_Turbo_speed)
            
set_task(get_pcvar_float(CV_Turbo_Usage_Time),"turbo_fix",id)
        }
    }
    else 
    {
        
/*    +-------------------------------------------------------+
            |    STANDARD SPEED * CATCH TURBO * CATCHERS SPEED    |
            +-------------------------------------------------------+    */
        
speed 320.0 get_pcvar_float(CV_Catch_speed) * get_pcvar_float(CV_catchers_speed)
    }
    if(
is_user_alive(id))
    {
        
/*    +-------------------------------+
            |    SET THE SPEED        |
            +-------------------------------+    */
        
set_user_maxspeed(id,speed)
    }
    return 
PLUGIN_HANDLED
}
/*    +-----------------------+
    |    REMOVE C4    |
    +-----------------------+    */
public Player_AddPlayerItem(id iWeapon)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(
ExecuteHam(Ham_Item_GetWeaponPtriWeapon) != iWeapon    || cs_get_weapon_id(iWeapon) != CSW_C4)
    {
        return 
HAM_IGNORED
    
}
    
set_pev(iWeaponpev_flagspev(iWeaponpev_flags) | FL_KILLME)
    
cs_set_user_plant(id0)
    
set_pev(idpev_body0)
    
SetHamReturnInteger(0)
    return 
HAM_SUPERCEDE
}
/*    +-----------------------------------------------+
    |    CHANGE THE WIN MSGS CREDIT @ Bibu    |
    +-----------------------------------------------+    */
public message_textmsg( const MsgId, const MsgDest, const MsgEntity )
{    
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
message[32]
    
get_msg_arg_string(2messagecharsmax(message))
    if(
equal(message"#Terrorists_Win"))
    {
        if(!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
            
//formatex(winmsg, 31, "#Catchers win")
        
}
        else if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
            
//formatex(winmsg, 31, "#Fleers win")
        
}
    }
    else if(
equal(message"#CTs_Win"))
    {
        if(
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"CATCHERS_WIN")
            
//formatex(winmsg, 31, "#Catchers win")
        
}
        else if (!
CSTS_ARE_CATCHER)
        {
            
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
            
//formatex(winmsg, 31, "#Fleers win")
        
}
    }
    else if(
equal(message,"#Target_Saved"))
    {
        
formatex(winmsgcharsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
        
//formatex(winmsg, 31, "#Fleer win")
    
}
    else if(
equal(message,"#Hostages_Not_Rescued"))
    {
        
formatex(winmsg,charsmax(message), "%L",LANG_PLAYER,"FLEERS_WIN")
    }
        
    
set_msg_arg_string(2winmsg)
    return 
PLUGIN_HANDLED
}
/*    +---------------------------------------+
    |    WIN SOUNDS CREDIT @ Bibu    |
    +---------------------------------------+    */
public play_win_sound()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
client_cmd(0"stopsound")
    
    for (new 
id 1id <= E_MaxPlayersid++)
    {
        if(
is_user_connected(id))
        {
            if(
CSTS_ARE_CATCHER//CTs sind catcher
            
{
                if(
cs_get_user_team(id) == CS_TEAM_T && !user_is_catcher[id])
                {
                    if(
get_pcvar_num(CV_CUSTOM_SOUND))
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_CATCHER_WIN)
                    }
                    else
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_CATCHER_WIN_DEFAULT)
                    }
                }
                else if(
cs_get_user_team(id) == CS_TEAM_CT && user_is_catcher[id])
                {
                    if(
get_pcvar_num(CV_CUSTOM_SOUND))
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_FLEER_LOSE)
                    }
                    else
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_FLEER_LOSE_DEFAULT)
                    }
                }
            }
            else 
//Ts sind catcher
            
{
                
                if(
cs_get_user_team(id) == CS_TEAM_T && user_is_catcher[id])
                {
                    if(
get_pcvar_num(CV_CUSTOM_SOUND))
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_FLEER_LOSE)
                    }
                    else
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_FLEER_LOSE_DEFAULT)
                    }
                }
                else if(
cs_get_user_team(id) == CS_TEAM_CT && !user_is_catcher[id])
                {
                    if(
get_pcvar_num(CV_CUSTOM_SOUND))
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_CATCHER_WIN)
                    }
                    else
                    {
                        
client_cmd(id"spk ^"%s^""SOUND_CATCHER_WIN_DEFAULT)
                    }
                }
            }
        }
    }
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    SET TURBO STATS BACK    |
    +-------------------------------+    */
public turbo_fix(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
TURBO[id][0] = 0
    
return PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    APPLY SCORBOARD        |
    +-------------------------------+    */
public apply(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
apply_scoreboard(id)
    return 
PLUGIN_HANDLED
}
public 
Show_Stats() 
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    for(new 
id=1;id <= E_MaxPlayers;id++) 
    {
        if(
is_user_alive(id)) 
        {
            
Player_Show_Stats(id)
        }
    }
    return 
PLUGIN_HANDLED
}
/*    +-------------------------------+
    |    TURBO/STATS HUD        |
    +-------------------------------+    */
public Player_Show_Stats(id
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    new 
turbos[512]
    
set_dhudmessage(025500.400.7022.00.050.11.5)
    if(!
user_is_catcher[id]) 
    {
        if(
TURBO[id][1] >= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            if(
TURBO[id][0] == 1)
            {
                
turbo_used[id]++
                
set_dhudmessage(255000.400.7022.00.050.11.5)
                
format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_STATUS_USED",TURBO[id][1])
            }
            else if(
TURBO[id][1])
            {
                
format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_STATS_UNUSED",TURBO[id][1])    
            }
        }
        else if(
TURBO[id][1] <= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            
format(turbos,511,"%L",LANG_PLAYER,"FORMAT_FLEER_TURBO_OFF")
        }
    }
    else if(
user_is_catcher[id]) 
    {
        
format(turbos,511,"%L",LANG_PLAYER,"FORMAT_CATCHER_STATUS",TURBO[id][1])
    }
    
show_dhudmessage(id"%s",turbos)
    return 
PLUGIN_HANDLED
}
/*    +-----------------------------------------------+
    |    TURBO TASK TO RESTORE SETTINGS         |
    +-----------------------------------------------+    */
public turbo_task(id
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    if(
is_user_alive(id)) 
    {
        if(!
user_is_catcher[id]) 
        {
            if(
TURBO[id][1] > get_pcvar_num(CV_Turbo_Usage_Percent)) 
            {
                
TURBO[id][0] = 0
                Speed_settings
(id
                
Player_Show_Stats(id)
            }
            else 
            {
                
TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
                
Speed_settings(id
                
Player_Show_Stats(id)
            }
        }
        else 
        {
            
TURBO[id][0] = 0
            Player_Show_Stats
(id)            
        }
    }
    else 
    {
        
TURBO[id][0] = 0        
    
}
    
set_task(get_pcvar_float(CV_CHILLDOWN_TIME),"task_chilldown",id)
    return 
PLUGIN_HANDLED
}
/*    +---------------------------------------+
    |    CHILLDOWN TASK FOR TURBO    |
    +---------------------------------------+    */
public task_chilldown(id)
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
chilldown[id] = 0
    
return PLUGIN_HANDLED
}
public 
plugin_end()
{
    if(!
Catch_Enable)
    {
        return 
PLUGIN_HANDLED
    
}
    
SQL_FreeHandle(sqldb)
    return 
PLUGIN_HANDLED
}  
stock const g_szTeamName[Colors][] = 
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}
stock client_print_color(idiColor=DontChange, const szMsg[], any:...)
{
    
// check if id is different from 0
    
if( id && !is_user_connected(id) )
    {
        return 
0;
    }

    if( 
iColor Grey )
    {
        
iColor DontChange;
    }

    new 
szMessage[192];
    if( 
iColor == DontChange )
    {
        
szMessage[0] = 0x04;
    }
    else
    {
        
szMessage[0] = 0x03;
    }

    new 
iParams numargs();
    
// Specific player code
    
if(id)
    {
        if( 
iParams == )
        {
            
copy(szMessage[1], charsmax(szMessage)-1szMsg);
        }
        else
        {
            
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);
        }

        if( 
iColor )
        {
            new 
szTeam[11]; // store current team so we can restore it
            
get_user_team(idszTeamcharsmax(szTeam));

            
// set id TeamInfo in consequence
            // so SayText msg gonna show the right color
            
Send_TeamInfo(ididg_szTeamName[iColor]);

            
// Send the message
            
Send_SayText(ididszMessage);

            
// restore TeamInfo
            
Send_TeamInfo(ididszTeam);
        }
        else
        {
            
Send_SayText(ididszMessage);
        }
    } 

    
// Send message to all players
    
else
    {
        
// Figure out if at least 1 player is connected
        // so we don't send useless message if not
        // and we gonna use that player as team reference (aka SayText message sender) for color change
        
new iPlayers[32], iNum;
        
get_players(iPlayersiNum"ch");
        if( !
iNum )
        {
            return 
0;
        }

        new 
iFool iPlayers[0];

        new 
iMlNumberij;
        new Array:
aStoreML ArrayCreate();
        if( 
iParams >= // ML can be used
        
{
            for(
j=4j<iParamsj++)
            {
                
// retrieve original param value and check if it's LANG_PLAYER value
                
if( getarg(j) == LANG_PLAYER )
                {
                    
i=0;
                    
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
                    
while( ( szMessage] = getarg1i++ ) ) ) {}
                    if( 
GetLangTransKey(szMessage) != TransKey_Bad )
                    {
                        
// Store that arg as LANG_PLAYER so we can alter it later
                        
ArrayPushCell(aStoreMLj++);

                        
// Update ML array saire so we'll know 1st if ML is used,
                        // 2nd how many args we have to alterate
                        
iMlNumber++;
                    }
                }
            }
        }

        
// If arraysize == 0, ML is not used
        // we can only send 1 MSG_BROADCAST message
        
if( !iMlNumber )
        {
            if( 
iParams == )
            {
                
copy(szMessage[1], charsmax(szMessage)-1szMsg);
            }
            else
            {
                
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);
            }

            if( 
iColor )
            {
                new 
szTeam[11];
                
get_user_team(iFoolszTeamcharsmax(szTeam));
                
Send_TeamInfo(0iFoolg_szTeamName[iColor]);
                
Send_SayText(0iFoolszMessage);
                
Send_TeamInfo(0iFoolszTeam);
            }
            else
            {
                
Send_SayText(0iFoolszMessage);
            }
        }

        
// ML is used, we need to loop through all players,
        // format text and send a MSG_ONE_UNRELIABLE SayText message
        
else
        {
            new 
szTeam[11], szFakeTeam[10];
            
            if( 
iColor )
            {
                
get_user_team(iFoolszTeamcharsmax(szTeam));
                
copy(szFakeTeamcharsmax(szFakeTeam), g_szTeamName[iColor]);
            }

            for( 
0iNumi++ )
            {
                
id iPlayers[i];

                for(
j=0j<iMlNumberj++)
                {
                    
// Set all LANG_PLAYER args to player index ( = id )
                    // so we can format the text for that specific player
                    
setarg(ArrayGetCell(aStoreMLj), _id);
                }

                
// format string for specific player
                
vformat(szMessage[1], charsmax(szMessage)-1szMsg4);

                if( 
iColor )
                {
                    
Send_TeamInfo(idiFoolszFakeTeam);
                    
Send_SayText(idiFoolszMessage);
                    
Send_TeamInfo(idiFoolszTeam);
                }
                else
                {
                    
Send_SayText(idiFoolszMessage);
                }
            }
            
ArrayDestroy(aStoreML);
        }
    }
    return 
1;
}
stock Send_TeamInfo(iReceiveriPlayerIdszTeam[])
{
    static 
iTeamInfo 0;
    if( !
iTeamInfo )
    {
        
iTeamInfo get_user_msgid("TeamInfo");
    }
    
message_begin(iReceiver MSG_ONE_UNRELIABLE MSG_BROADCASTiTeamInfo, .player=iReceiver);
    
write_byte(iPlayerId);
    
write_string(szTeam);
    
message_end();
}
stock Send_SayText(iReceiveriPlayerIdszMessage[])
{
    static 
iSayText 0;
    if( !
iSayText )
    {
        
iSayText get_user_msgid("SayText");
    }
    
message_begin(iReceiver MSG_ONE_UNRELIABLE MSG_BROADCASTiSayText, .player=iReceiver);
    
write_byte(iPlayerId);
    
write_string(szMessage);
    
message_end();
}
stock register_dictionary_colored(const filename[])
{
    if( !
register_dictionary(filename) )
    {
        return 
0;
    }

    new 
szFileName[256];
    
get_localinfo("amxx_datadir"szFileNamecharsmax(szFileName));
    
format(szFileNamecharsmax(szFileName), "%s/lang/%s"szFileNamefilename);
    new 
fp fopen(szFileName"rt");
    if( !
fp )
    {
        
log_amx("Failed to open %s"szFileName);
        return 
0;
    }

    new 
szBuffer[512], szLang[3], szKey[64], szTranslation[256], TransKey:iKey;

    while( !
feof(fp) )
    {
        
fgets(fpszBuffercharsmax(szBuffer));
        
trim(szBuffer);

        if( 
szBuffer[0] == '[' )
        {
            
strtok(szBuffer[1], szLangcharsmax(szLang), szBuffer1']');
        }
        else if( 
szBuffer[0] )
        {
            
strbreak(szBufferszKeycharsmax(szKey), szTranslationcharsmax(szTranslation));
            
iKey GetLangTransKey(szKey);
            if( 
iKey != TransKey_Bad )
            {
                while( 
replace(szTranslationcharsmax(szTranslation), "!g""^4") ){}
                while( 
replace(szTranslationcharsmax(szTranslation), "!t""^3") ){}
                while( 
replace(szTranslationcharsmax(szTranslation), "!n""^1") ){}
                
AddTranslation(szLangiKeyszTranslation[2]);
            }
        }
        
    }
    
    
fclose(fp);
    return 
1;

Langfile :

Code:
[en]
ERROR_NOT_ALLOWDED = !n[!g%s!n] : You are not allowded to use this command!
ERROR_FAILED_INSTALL = !n[!g%s!n] : There was a problem to install you'r DB.Please check the logs for more information!
SQL_INSTALLED = !n[!g%s!n] : You installed succhesfully your DB.
FLEERS_WON = !n[!g%s!n] : Fleers won this round and got +!g%d !npoint%s.
CATCHERS_WON = !n[!g%s!n] : Catchers won this round.
TERR_CATCHED_FLAG = !n[!g%s!n] : Nice job !t%s!n! Terrorists cached the flag.
CTS_CATCHED_FLAG = !n[!g%s!n] : Nice job !t%s!n! Counter-Terrorists cached the flag.
CATCH_ON = !n[!g%s!n] : Catchmod is On!
CATCH_OFF = !n[!g%s!n] : Catchmod is Disabled!
DONT_KILL = !n[!g%s!n] : Sorry, there are less than !g%d !nusers on server. You can't kill your self!
CON_DONT_KILL = [%s] : Sorry, there are less than %d users on server. You can't kill your self!

/*HUDS*/
HUD_SPEED_NOAG = No AGs received.^nYour Maxspeed this round : %f^nYour Maxspeed for this map : %f^nBest Maxspeed was %f made by %s
HUD_SPEED = Your Maxspeed this round : %f^nYour Maxspeed for this map : %f^nBest Maxspeed was %f made by %s
HUD_SPEED_AGS = Received AGs this round : %d AG^nYour Maxspeed this round : %f^nYour Maxspeed for this map : %f^nBest Maxspeed was %f made by %s
HUD_SPEED_SPEC = Status : Spectator^nCurrentspeed : %f^nBest Maxspeed was %f made by %s
FORMAT_FLEER_STATUS_USED = You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - %d%+
FORMAT_FLEER_STATS_UNUSED = You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - %d% 
FORMAT_FLEER_TURBO_OFF = You are now a FLEER.^nYou have to FLEE^nTurbo: [|||||||||||||||] - OFF
FORMAT_CATCHER_STATUS = You are now a CATCHER.^nYou have to CATCH^nTurbo: [|||||||||||||||] - %d%
FORMAT_CATCHER_TURBO_OFF = You are now a CATCHER.^nYou have to CATCH^nTurbo: [|||||||||||||||] - OFF

/*MSGS*/
CATCHERS_WIN = #Catchers win
FLEERS_WIN = #Fleers win
Attached Thumbnails
Click image for larger version

Name:	colorchat.JPG
Views:	519
Size:	20.6 KB
ID:	86573  
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 11:16.


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