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

[CS:GO] Plugin wont show in console.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VipEx
Junior Member
Join Date: Apr 2014
Old 04-21-2014 , 14:03   [CS:GO] Plugin wont show in console.
Reply With Quote #1

Although im new with source servers(?) im trying to install this awesome plugin.
I'm a bit shaky at this. So i was hopeing you could help me along?
I have done everything like the documentation said. But i cant figure out why the plugin isnt installed(?) in the SourceMod...

Here are som pictures

http://4st.me/qpp0U.png

http://4st.me/sPqk4.png

Turning to the smart people for help! <3

VipEx is offline
SpT7777
Junior Member
Join Date: Jan 2010
Old 04-22-2014 , 09:58   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #2

write to console
sm plugins load hlstatsx
and look what happend
SpT7777 is offline
VipEx
Junior Member
Join Date: Apr 2014
Old 04-22-2014 , 14:28   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #3

Here is the result :/ A little bit closer atleast i guess

http://4st.me/aPURF.png
VipEx is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 04-22-2014 , 14:56   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #4

Quote:
Originally Posted by VipEx View Post
Here is the result :/ A little bit closer atleast i guess

http://4st.me/aPURF.png
plugin error download and add it again..

DOWNLOAD FULL VERSION
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.
sixten_8_9@ is offline
VipEx
Junior Member
Join Date: Apr 2014
Old 04-22-2014 , 15:36   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #5

I have downloaded the .bz2 file before.
Should i take the zipped one?

If u feel in the mood of helping me along the way, add my steam. ==> VipEx || paffiskonto


VipEx is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 04-22-2014 , 16:42   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #6

Quote:
Originally Posted by VipEx View Post
I have downloaded the .bz2 file before.
Should i take the zipped one?

If u feel in the mood of helping me along the way, add my steam. ==> VipEx || paffiskonto


test this file.

Attachment 132904

this works for me!!



Mod Edit: Putting the binary (smx file) back again without the source code will result in a ban.
Attached Thumbnails
Click image for larger version

Name:	tt.png
Views:	3968
Size:	16.0 KB
ID:	132903  
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.

Last edited by asherkin; 04-22-2014 at 19:15. Reason: Removed binary, no source code.
sixten_8_9@ is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-22-2014 , 17:11   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #7

Quote:
Originally Posted by sixten_8_9@ View Post
test this file.

Attachment 132902

this works for me!!

Where's the source of that smx?
WildCard65 is offline
VipEx
Junior Member
Join Date: Apr 2014
Old 04-22-2014 , 17:29   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #8

Got the plugin itself working.

http://4st.me/ThkrP.png

But it prints a message saying its for Counter strike source?

Can't use commands like Rank and so. Guess that's another problem though... More googleing.
If someone would want me to have a easy time please add ==> paffiskonto@steam <3 <3 <3

VipEx is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 04-22-2014 , 18:10   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #9

Quote:
Originally Posted by VipEx View Post
Got the plugin itself working.

http://4st.me/ThkrP.png

But it prints a message saying its for Counter strike source?

Can't use commands like Rank and so. Guess that's another problem though... More googleing.
If someone would want me to have a easy time please add ==> paffiskonto@steam <3 <3 <3

works on csgo, because the picture is on csgo server..
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.

Last edited by sixten_8_9@; 04-22-2014 at 18:15.
sixten_8_9@ is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 04-22-2014 , 19:34   Re: [CS:GO] Plugin wont show in console.
Reply With Quote #10

Quote:
Originally Posted by sixten_8_9@ View Post
test this file.

Attachment 132904

this works for me!!



Mod Edit: Putting the binary (smx file) back again without the source code will result in a ban.

HERE IS THE CODE SOURCEMOD ADMINS:

PHP Code:
/**
 * HLstatsX Community Edition - SourceMod plugin to display ingame messages
 * http://www.hlxcommunity.com/
 * Copyright (C) 2008-2009 Nicholas Hastings
 * Copyright (C) 2007-2009 TTS Oetzel & Goerz GmbH
 * Modified by Nicholas Hastings (psychonic) for use with HLstatsX Community Edition
 *
 * This program 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; either version 2
 * of the License, or (at your option) any later version.
 *
 * 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#pragma semicolon 1
 
#define REQUIRE_EXTENSIONS 
#include <sourcemod>
#include <sdktools>
#undef REQUIRE_EXTENSIONS
#include <cstrike>
#include <clientprefs>
 
#define VERSION "1.6.19"
#define HLXTAG "HLstatsX:CE"

enum GameType {
    
Game_Unknown = -1,
    
Game_CSS,
    
Game_DODS,
    
Game_L4D,
    
Game_TF,
    
Game_HL2MP,
    
Game_INSMOD,
    
Game_FF,
    
Game_ZPS,
    
Game_AOC,
    
Game_FOF,
    
Game_GES,
    
Game_PVKII,
    
Game_CSP,
    
Game_ND,
    
Game_DDD,
    
Game_CSGO,
};

new 
GameType:gamemod Game_Unknown;

new 
Handlehlx_block_chat_commands;
new 
Handlehlx_message_prefix;
new 
Handlehlx_protect_address;
new 
Handlehlx_server_tag;
new 
Handlesv_tags;
new 
Handlemessage_recipients;
new const 
Stringblocked_commands[][] = { "rank""skill""points""place""session""session_data"
                                     
"kpd""kdratio""kdeath""next""load""status""servers"
                                     
"top20""top10""top5""clans""bans""cheaters""statsme""weapons"
                                     
"weapon""action""actions""accuracy""targets""target""kills"
                                     
"kill""player_kills""cmd""cmds""command""hlx_display 0"
                                     
"hlx_display 1""hlx_teams 0""hlx_teams 1""hlx_hideranking"
                                     
"hlx_chat 0""hlx_chat 1""hlx_menu""servers 1""servers 2"
                                     
"servers 3""hlx""hlstatsx""help" };

new 
Handle:HLstatsXMenuMain;
new 
Handle:HLstatsXMenuAuto;
new 
Handle:HLstatsXMenuEvents;

new 
HandlePlayerColorArray;
new 
ColorSlotArray[] = { -1, -1, -1, -1, -1, -};

new const 
String:ct_models[][] = {
    
"models/player/ct_urban.mdl"
    
"models/player/ct_gsg9.mdl"
    
"models/player/ct_sas.mdl"
    
"models/player/ct_gign.mdl"
};

new const 
String:ts_models[][] = {
    
"models/player/t_phoenix.mdl"
    
"models/player/t_leet.mdl"
    
"models/player/t_arctic.mdl"
    
"models/player/t_guerilla.mdl"
};

new const 
Stringmodnamelist[][] = {
    
"Counter-Strike: Source",
    
"Day of Defeat: Source",
    
"Left 4 Dead (1 or 2)",
    
"Team Fortress 2",
    
"Half-Life 2 Deathmatch",
    
"Insurgency",
    
"Fortress Forever",
    
"Zombie Panic: Source",
    
"Age of Chivalry",
    
"Fistful of Frags",
    
"GoldenEye: Source",
    
"Pirates, Vikings, and Knights",
    
"CSPromod",
    
"Nuclear Dawn",
    
"Dino D-Day",
    
"Counter-Strike: Global Offensive"
};

new 
Stringmessage_prefix[32];
new 
bool:g_bPlyrCanDoMotd[MAXPLAYERS+1];
new 
bool:g_bGameCanDoMotd true;
new 
bool:g_bTrackColors4Chat;
new 
g_iSDKVersion SOURCE_SDK_UNKNOWN;
new 
Handle:g_cvarTeamPlay INVALID_HANDLE;
new 
bool:g_bTeamPlay;
new 
bool:g_bLateLoad false;
new 
bool:g_bIgnoreNextTagChange false;
new 
Handle:g_hCustomTags;

#define SVTAGSIZE 128

public Plugin:myinfo = {
    
name "HLstatsX CE Ingame Plugin",
    
author "psychonic, cypis",
    
description "Provides ingame functionality for interaction from an HLstatsX CE installation",
    
version VERSION,
    
url "http://www.hlxcommunity.com"
};


public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
g_bLateLoad late;
    
MarkNativeAsOptional("CS_SwitchTeam");
    
MarkNativeAsOptional("CS_RespawnPlayer");
    
MarkNativeAsOptional("SetCookieMenuItem");
    
    return 
APLRes_Success;
}


public 
OnPluginStart() 
{
    
get_server_mod();

    
CreateHLstatsXMenuMain(HLstatsXMenuMain);
    
CreateHLstatsXMenuAuto(HLstatsXMenuAuto);
    
CreateHLstatsXMenuEvents(HLstatsXMenuEvents);

    
RegServerCmd("hlx_sm_psay",          hlx_sm_psay);
    
RegServerCmd("hlx_sm_psay2",         hlx_sm_psay2);
    
RegServerCmd("hlx_sm_bulkpsay",      hlx_sm_psay);
    
RegServerCmd("hlx_sm_csay",          hlx_sm_csay);
    
RegServerCmd("hlx_sm_msay",          hlx_sm_msay);
    
RegServerCmd("hlx_sm_tsay",          hlx_sm_tsay);
    
RegServerCmd("hlx_sm_hint",          hlx_sm_hint);
    
RegServerCmd("hlx_sm_browse",        hlx_sm_browse);
    
RegServerCmd("hlx_sm_swap",          hlx_sm_swap);
    
RegServerCmd("hlx_sm_redirect",      hlx_sm_redirect);
    
RegServerCmd("hlx_sm_player_action"hlx_sm_player_action);
    
RegServerCmd("hlx_sm_team_action",   hlx_sm_team_action);
    
RegServerCmd("hlx_sm_world_action",  hlx_sm_world_action);

    if (
gamemod == Game_INSMOD)
    {
        
AddCommandListener(hlx_block_commands"say2");
    }
    else if (
gamemod == Game_ND)
    {
        
AddCommandListener(hlx_block_commands"say_squad");
    }
    
    
AddCommandListener(hlx_block_commands"say");
    
AddCommandListener(hlx_block_commands"say_team");
    
    switch (
gamemod)
    {
        case 
Game_CSSGame_L4DGame_TFGame_HL2MPGame_AOCGame_FOFGame_PVKIIGame_NDGame_DDDGame_CSGO:
        {
            
g_bTrackColors4Chat true;
            
HookEvent("player_team",  HLstatsX_Event_PlyTeamChangeEventHookMode_Pre);
        }
    }
    
    switch (
gamemod)
    {
        case 
Game_L4DGame_INSMODGame_GES:
        {
            
g_bGameCanDoMotd false;
        }
    }
    
    if (
gamemod == Game_HL2MP)
    {
        
g_cvarTeamPlay FindConVar("mp_teamplay");
        if (
g_cvarTeamPlay != INVALID_HANDLE)
        {
            
g_bTeamPlay GetConVarBool(g_cvarTeamPlay);
            
HookConVarChange(g_cvarTeamPlayOnTeamPlayChange);
        }
    }
    
    
CreateConVar("hlxce_plugin_version"VERSION"HLstatsX:CE Ingame Plugin"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
CreateConVar("hlxce_version""""HLstatsX:CE"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
CreateConVar("hlxce_webpage""http://www.hlxcommunity.com""http://www.hlxcommunity.com"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
    
hlx_block_chat_commands CreateConVar("hlx_block_commands""1""If activated HLstatsX commands are blocked from the chat area"FCVAR_PLUGIN);
    
hlx_message_prefix CreateConVar("hlx_message_prefix""""Define the prefix displayed on every HLstatsX ingame message"FCVAR_PLUGIN);
    
hlx_protect_address CreateConVar("hlx_protect_address""""Address to be protected for logging/forwarding"FCVAR_PLUGIN);
    
hlx_server_tag CreateConVar("hlx_server_tag""1""If enabled, adds \"HLstatsX:CE\" to server tags on supported games. 1 = Enabled (default), 0 = Disabled",
        
FCVAR_PLUGINtrue0.0true1.0);
    
    
g_hCustomTags CreateArray(SVTAGSIZE);
    
sv_tags FindConVar("sv_tags");
    
g_iSDKVersion GuessSDKVersion();
    
    if (
g_bLateLoad)
    {
        
GetConVarString(hlx_message_prefixmessage_prefixsizeof(message_prefix));
        
decl String:protaddr[24];
        
GetConVarString(hlx_protect_addressprotaddrsizeof(protaddr));
        
OnProtectAddressChange(hlx_protect_address""protaddr);
    }
    
    
MyAddServerTag(HLXTAG);
    
    
HookConVarChange(hlx_message_prefixOnMessagePrefixChange);
    
HookConVarChange(hlx_protect_addressOnProtectAddressChange);
    
HookConVarChange(hlx_server_tagOnServerTagChange);
    if (
sv_tags != INVALID_HANDLE)
    {
        
HookConVarChange(sv_tagsOnSVTagsChange);
    }
    
    
RegServerCmd("log"ProtectLoggingChange);
    
RegServerCmd("logaddress_del"ProtectForwardingChange);
    
RegServerCmd("logaddress_delall"ProtectForwardingDelallChange);
    
RegServerCmd("hlx_message_prefix_clear"MessagePrefixClear);

    
PlayerColorArray CreateArray();
    
message_recipients CreateStack();
    
    
GetTeams(gamemod == Game_INSMOD);
}


public 
OnAllPluginsLoaded()
{
    if (
LibraryExists("clientprefs"))
    {
        
SetCookieMenuItem(HLXSettingsMenu0"HLstatsX:CE Settings");
    }
}

public 
HLXSettingsMenu(clientCookieMenuAction:actionany:infoString:buffer[], maxlen)
{
    if (
action == CookieMenuAction_SelectOption)
    {
        
DisplayMenu(HLstatsXMenuMainclientMENU_TIME_FOREVER);
    }
}


public 
OnMapStart()
{
    
GetTeams(gamemod == Game_INSMOD);

    if (
g_bTrackColors4Chat)
    {
        
find_player_team_slot(2);
        
find_player_team_slot(3);
        if (
gamemod == Game_PVKII)
        {
            
find_player_team_slot(4);
        }
    }
}

bool:BTagsSupported()
{
    return (
sv_tags != INVALID_HANDLE && (g_iSDKVersion == SOURCE_SDK_EPISODE2 || g_iSDKVersion == SOURCE_SDK_EPISODE2VALVE || gamemod == Game_ND));
}

stock MyAddServerTag(const String:tag[])
{
    if (!
BTagsSupported())
    {
        
// game doesn't support sv_tags
        
return;
    }
    
    if (!
GetConVarBool(hlx_server_tag))
    {
        return;
    }
    
    if (
FindStringInArray(g_hCustomTagstag) == -1)
    {
        
PushArrayString(g_hCustomTagstag);
    }
    
    
decl String:current_tags[SVTAGSIZE];
    
GetConVarString(sv_tagscurrent_tagssizeof(current_tags));
    if (
StrContains(current_tagstag) > -1)
    {
        
// already have tag
        
return;
    }
    
    
decl String:new_tags[SVTAGSIZE];
    
Format(new_tagssizeof(new_tags), "%s%s%s"current_tags, (current_tags[0]!=0)?",":""tag);
    
    new 
flags GetConVarFlags(sv_tags);
    
SetConVarFlags(sv_tagsflags & ~FCVAR_NOTIFY);
    
g_bIgnoreNextTagChange true;
    
SetConVarString(sv_tagsnew_tags);
    
g_bIgnoreNextTagChange false;
    
SetConVarFlags(sv_tagsflags);
}

stock MyRemoveServerTag(const String:tag[])
{
    if (!
BTagsSupported())
    {
        
// game doesn't support sv_tags
        
return;
    }
    
    new 
idx FindStringInArray(g_hCustomTagstag);
    if (
idx > -1)
    {
        
RemoveFromArray(g_hCustomTagsidx);
    }
    
    
decl String:current_tags[SVTAGSIZE];
    
GetConVarString(sv_tagscurrent_tagssizeof(current_tags));
    if (
StrContains(current_tagstag) == -1)
    {
        
// tag isn't on here, just bug out
        
return;
    }
    
    
ReplaceString(current_tagssizeof(current_tags), tag"");
    
ReplaceString(current_tagssizeof(current_tags), ",,""");
    
    new 
flags GetConVarFlags(sv_tags);
    
SetConVarFlags(sv_tagsflags & ~FCVAR_NOTIFY);
    
g_bIgnoreNextTagChange true;
    
SetConVarString(sv_tagscurrent_tags);
    
g_bIgnoreNextTagChange false;
    
SetConVarFlags(sv_tagsflags);
}

get_server_mod()
{
    new 
Stringgame_description[64];
    
GetGameDescription(game_descriptionsizeof(game_description), true);
    
    if (
StrContains(game_description"Counter-Strike"false) != -1)
    {
        
gamemod Game_CSS;
    }
    else if (
StrContains(game_description"Day of Defeat"false) != -1)
    {
        
gamemod Game_DODS;
    }
    else if (
StrContains(game_description"Half-Life 2 Deathmatch"false) != -1)
    {
        
gamemod Game_HL2MP;
    }
    else if (
StrContains(game_description"Team Fortress"false) != -1)
    {
        
gamemod Game_TF;
    }
    else if (
StrContains(game_description"L4D"false) != -|| StrContains(game_description"Left 4 D"false) != -1)
    {
        
gamemod Game_L4D;
    }
    else if (
StrContains(game_description"Insurgency"false) != -1)
    {
        
gamemod Game_INSMOD;
        
//psychonic - added detection for more supported games
    
}
    else if (
StrContains(game_description"Fortress Forever"false) != -1)
    {
        
gamemod Game_FF;
    }
    else if (
StrContains(game_description"ZPS"false) != -1)
    {
        
gamemod Game_ZPS;
    }
    else if (
StrContains(game_description"Age of Chivalry"false) != -1)
    {
        
gamemod Game_AOC;
    }
    else if (
StrContains(game_description"PVKII"false) != -1)
    {
        
gamemod Game_PVKII;
    }
    else if (
StrContains(game_description"CSPromod"false) != -1)
    {
        
gamemod Game_CSP;
    }
    else if (
StrContains(game_description"Nuclear Dawn"false) != -1)
    {
        
gamemod Game_ND;
    }
    
    
// game mod could not detected, try further
    
if (gamemod == Game_Unknown)
    {
        new 
Stringgame_folder[64];
        
GetGameFolderName(game_foldersizeof(game_folder));
        if (
StrContains(game_folder"cstrike"false) != -1)
        {
            
gamemod Game_CSS;
        }
        else if (
strncmp(game_folder"dod"3false) == 0)
        {
            
gamemod Game_DODS;
        }
        else if (
StrContains(game_folder"hl2mp"false) != -|| StrContains(game_folder"hl2ctf"false) != -1)
        {
            
gamemod Game_HL2MP;
        }
        else if (
StrContains(game_folder"fistful_of_frags"false) != -1)
        {
            
gamemod Game_FOF;
        }
        else if (
strncmp(game_folder"tf"2false) == 0)
        {
            
gamemod Game_TF;
        }
        else if (
StrContains(game_folder"left4dead"false) != -1)
        {
            
gamemod Game_L4D;
        }
        else if (
StrContains(game_folder"insurgency"false) != -1)
        {
            
gamemod Game_INSMOD;
            
//psychonic - added detection for more supported games
        
}
        else if (
StrContains(game_folder"FortressForever"false) != -1)
        {
            
gamemod Game_FF;
        }
        else if (
StrContains(game_folder"zps"false) != -1)
        {
            
gamemod Game_ZPS;
        }
        else if (
StrContains(game_folder"ageofchivalry"false) != -1)
        {
            
gamemod Game_AOC;
        }
        else if (
StrContains(game_folder"gesource"false) != -1)
        {
            
gamemod Game_GES;
        }
        else if (
StrContains(game_folder"pvkii"false) != -1)
        {
            
gamemod Game_PVKII;
        }
        else if (
StrContains(game_folder"cspromod"false) != -1)
        {
            
gamemod Game_CSP;
        }
        else if (
StrContains(game_folder"nucleardawn"false) != -1)
        {
            
gamemod Game_ND;
        }
        else if (
StrContains(game_folder"dinodday"false) != -1)
        {
            
gamemod Game_DDD;
        }
        else if (
StrContains(game_folder"csgo"false) != -1)
        {
            
gamemod Game_CSGO;
        }
        else
        {
            
LogToGame("HLX:CE Mod Not In Detected List, Using Defaults (%s, %s)"game_descriptiongame_folder);
            
LogToGame("HLX:CE If this is incorrect, please file a bug at hlxcommunity.com");
        }
    }
    if (
gamemod Game_Unknown)
    {
        
LogToGame("HLX:CE Mod Detection: %s"modnamelist[_:gamemod]);
        
LogToGame("HLX:CE If this is incorrect, please file a bug at hlxcommunity.com");
    }
}

public 
OnClientPostAdminCheck(client)
{
    if (
g_bGameCanDoMotd && !IsFakeClient(client))
    {
        
QueryClientConVar(client"cl_disablehtmlmotd"motdQuery);
    }
}


public 
motdQuery(QueryCookie:cookieclientConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
    if (
result == ConVarQuery_Okay && StringToInt(cvarValue) == || result != ConVarQuery_Okay)
    {
        
g_bPlyrCanDoMotd[client] = true;
    }
}


public 
OnServerTagChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if (
GetConVarBool(hlx_server_tag))
    {
        
MyAddServerTag(HLXTAG);
    }
    else
    {
        
MyRemoveServerTag(HLXTAG);
    }
}

public 
OnSVTagsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if (
g_bIgnoreNextTagChange)
    {
        
// we fired this callback, no need to reapply tags
        
return;
    }
    
    
// reapply each custom tag
    
new cnt GetArraySize(g_hCustomTags);
    for (new 
0cnti++)
    {
        
decl String:tag[SVTAGSIZE];
        
GetArrayString(g_hCustomTagsitagsizeof(tag));
        
MyAddServerTag(tag);
    }
}


public 
OnProtectAddressChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if (
newVal[0] > 0)
    {
        
decl Stringlog_command[192];
        
Format(log_commandsizeof(log_command), "logaddress_add %s"newVal);
        
LogToGame("Command: %s"log_command);
        
ServerCommand(log_command);
    }
}

public 
OnTeamPlayChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    
g_bTeamPlay GetConVarBool(g_cvarTeamPlay);
}

public 
Action:ProtectLoggingChange(args)
{
    if (
hlx_protect_address != INVALID_HANDLE)
    {
        
decl Stringprotect_address[192];
        
GetConVarString(hlx_protect_addressprotect_addresssizeof(protect_address));
        if (
strcmp(protect_address"") != 0)
        {
            if (
args >= 1)
            {
                
decl Stringlog_action[192];
                
GetCmdArg(1log_actionsizeof(log_action));
                if ((
strcmp(log_action"off") == 0) || (strcmp(log_action"0") == 0))
                {
                    
LogToGame("HLstatsX address protection active, logging reenabled!");
                    
ServerCommand("log 1");
                }
            }
        }
    }
    return 
Plugin_Continue;
}


public 
Action:ProtectForwardingChange(args)
{
    if (
hlx_protect_address != INVALID_HANDLE)
    {
        
decl Stringprotect_address[192];
        
GetConVarString(hlx_protect_addressprotect_addresssizeof(protect_address));
        if (
strcmp(protect_address"") != 0)
        {
            if (
args == 1)
            {
                
decl Stringlog_action[192];
                
GetCmdArg(1log_actionsizeof(log_action));
                if (
strcmp(log_actionprotect_address) == 0)
                {
                    
decl Stringlog_command[192];
                    
Format(log_commandsizeof(log_command), "logaddress_add %s"protect_address);
                    
LogToGame("HLstatsX address protection active, logaddress readded!");
                    
ServerCommand(log_command);
                }
            }
            else if (
args 1)
            {
                new 
Stringlog_action[192];
                for(new 
1<= argsi++)
                {
                    
decl Stringtemp_argument[192];
                    
GetCmdArg(itemp_argumentsizeof(temp_argument));
                    
strcopy(log_action[strlen(log_action)], sizeof(log_action), temp_argument);
                }
                if (
strcmp(log_actionprotect_address) == 0)
                {
                    
decl Stringlog_command[192];
                    
Format(log_commandsizeof(log_command), "logaddress_add %s"protect_address);
                    
LogToGame("HLstatsX address protection active, logaddress readded!");
                    
ServerCommand(log_command);
                }
            
            }
        }
    }
    return 
Plugin_Continue;
}


public 
Action:ProtectForwardingDelallChange(args)
{
    if (
hlx_protect_address != INVALID_HANDLE)
    {
        
decl Stringprotect_address[192];
        
GetConVarString(hlx_protect_addressprotect_addresssizeof(protect_address));
        if (
strcmp(protect_address"") != 0)
        {
            
decl Stringlog_command[192];
            
Format(log_commandsizeof(log_command), "logaddress_add %s"protect_address);
            
LogToGame("HLstatsX address protection active, logaddress readded!");
            
ServerCommand(log_command);
        }
    }
    return 
Plugin_Continue;
}


public 
OnMessagePrefixChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    
strcopy(message_prefixsizeof(message_prefix), newVal);
}


public 
Action:MessagePrefixClear(args)
{
    
message_prefix "";
}


find_player_team_slot(team_index
{
    if (
team_index > -1)
    {
        
ColorSlotArray[team_index] = -1;
        for(new 
1<= MaxClientsi++)
        {
            if (
IsClientInGame(i) && GetClientTeam(i) == team_index)
            {
                
ColorSlotArray[team_index] = i;
                break;
            }
        }
    }
}


stock validate_team_colors() 
{
    for (new 
0sizeof(ColorSlotArray); i++)
    {
        new 
color_client ColorSlotArray[i];
        if (
color_client 0)
        {
            if (
IsClientInGame(color_client) && GetClientTeam(color_client) != color_client)
            {
                
find_player_team_slot(i);
            }
        }
        else
        {
            if (
== || == || (== && gamemod == Game_PVKII))
            {
                
find_player_team_slot(i);
            }
        }
    }
}

public 
OnClientDisconnect(client)
{
    if (
g_bTrackColors4Chat && client && IsClientInGame(client))
    {
        new 
team_index GetClientTeam(client);
        if (
client == ColorSlotArray[team_index])
        {
            
ColorSlotArray[team_index] = -1;
        }
    }
    
    
g_bPlyrCanDoMotd[client] = false;
}

color_player(color_typeplayer_indexStringclient_message[192]) 
{
    new 
color_player_index = -1;
    if (
g_bTrackColors4Chat || (gamemod == Game_DODS) || (gamemod == Game_ZPS) || (gamemod == Game_GES) || (gamemod == Game_CSP))
    {
        
decl Stringclient_name[192];
        
GetClientName(player_indexclient_namesizeof(client_name));
        if ((
strcmp(client_message"") != 0) && (strcmp(client_name"") != 0))
        {
            if (
color_type == 1)
            {
                
decl Stringsearch_client_name[192];
                
Format(search_client_namesizeof(search_client_name), "%s "client_name);
                
decl Stringcolored_player_name[192];
                switch (
gamemod)
                {
                    case 
Game_DODSGame_GESGame_CSP:
                        
Format(colored_player_namesizeof(colored_player_name), "\x04%s\x01 "client_name);
                    case 
Game_HL2MP:
                        
Format(colored_player_namesizeof(colored_player_name), "%c%s\x01 "g_bTeamPlay?3:4client_name);
                    case 
Game_ZPS:
                        
Format(colored_player_namesizeof(colored_player_name), "\x05%s\x01 "client_name);
                    default:
                        
Format(colored_player_namesizeof(colored_player_name), "\x03%s\x01 "client_name);
                }
                if (
ReplaceString(client_messagesizeof(client_message), search_client_namecolored_player_name) > 0)
                {
                    return 
player_index;
                }
            }
            else
            {
                
decl Stringsearch_client_name[192];
                
Format(search_client_namesizeof(search_client_name), " %s "client_name);
                
decl Stringcolored_player_name[192];
                switch (
gamemod)
                {
                    case 
Game_ZPS:
                        
Format(colored_player_namesizeof(colored_player_name), " \x05%s\x01 "client_name);
                    case 
Game_GES:
                        
Format(colored_player_namesizeof(colored_player_name), " \x05%s\x01 "client_name);
                    default:
                        
Format(colored_player_namesizeof(colored_player_name), " \x04%s\x01 "client_name);
                }
                
ReplaceString(client_messagesizeof(client_message), search_client_namecolored_player_name);
            }
        }
    }
    else if (
gamemod == Game_FF)
    {
        
decl Stringclient_name[192];
        
GetClientName(player_indexclient_namesizeof(client_name));
        
        new 
team GetClientTeam(player_index);
        if (
team && team 6)
        {
            
decl Stringcolored_player_name[192];
            
Format(colored_player_namesizeof(colored_player_name), "^%d%s^0", (team-1), client_name);
            if (
ReplaceString(client_messagesizeof(client_message), client_namecolored_player_name) > 0)
            {
                return 
player_index;
            }
        }
    }
    return 
color_player_index;
}


color_all_players(Stringmessage[192]) 
{
    new 
color_index = -1;
    if ((
g_bTrackColors4Chat || (gamemod == Game_DODS) || (gamemod == Game_ZPS) || (gamemod == Game_FF) || (gamemod == Game_GES) || (gamemod == Game_CSP)) && (PlayerColorArray != INVALID_HANDLE))
    {
        if (
strcmp(message"") != 0)
        {
            
ClearArray(PlayerColorArray);

            new 
lowest_matching_pos 192;
            new 
lowest_matching_pos_client = -1;

            for(new 
1<= MaxClientsi++)
            {
                new 
client i;
                if (
IsClientInGame(client))
                {
                    
decl Stringclient_name[32];
                    
GetClientName(clientclient_namesizeof(client_name));

                    if (
strcmp(client_name"") != 0)
                    {
                        new 
message_pos StrContains(messageclient_name);
                        if (
message_pos > -1)
                        {
                            if (
lowest_matching_pos message_pos)
                            {
                                
lowest_matching_pos message_pos;
                                
lowest_matching_pos_client client;
                            }
                            new 
TempPlayerColorArray[1];
                            
TempPlayerColorArray[0] = client;
                            
PushArrayArray(PlayerColorArrayTempPlayerColorArray);
                        }
                    }
                }
            }
            new 
size GetArraySize(PlayerColorArray);
            for (new 
0sizei++)
            {
                new 
temp_player_array[1];
                
GetArrayArray(PlayerColorArrayitemp_player_array);
                new 
temp_client temp_player_array[0];
                if (
temp_client == lowest_matching_pos_client)
                {
                    new 
temp_color_index color_player(1temp_clientmessage);
                    
color_index temp_color_index;
                }
                else
                {
                    
color_player(0temp_clientmessage);
                }
            }
            
ClearArray(PlayerColorArray);
        }
    }
    
    return 
color_index;
}



color_team_entities(String:message[192])
{
    switch(
gamemod)
    {
        case 
Game_CSSGame_CSGO:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "TERRORIST ""\x03TERRORIST\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "CT ""\x03CT\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_L4D:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Survivors ""\x03Survivors\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Infected ""\x03Infected\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_TF:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Red ""\x03Red\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Blue ""\x03Blue\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_FF:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ReplaceString(messagesizeof(message), "Red Team""^2Red Team^0") > 0)
                {
                    return 
0;
                }
                if (
ReplaceString(messagesizeof(message), "Blue Team""^1Blue Team^0") > 0)
                {
                    return 
0;
                }
                if (
ReplaceString(messagesizeof(message), "Yellow Team""^3Yellow Team^0") > 0)
                {
                    return 
0;
                }
                if (
ReplaceString(messagesizeof(message), "Green Team""^4Green Team^0") > 0)
                {
                    return 
0;
                }
            }
        }
        case 
Game_AOC:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Agathia Knights ""\x03Agathia Knights\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "The Mason Order ""\x03The Mason Order\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_FOF:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Desperados ""\x03Desperados\x01 ") > 0
                        
|| ReplaceString(messagesizeof(message), "Desparados ""\x03Desperados\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Vigilantes ""\x03Vigilantes\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_HL2MP:
        {
            if (
g_bTeamPlay && strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "The Combine ""\x03The Combine\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Rebel Forces ""\x03Rebel Forces\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_PVKII:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Pirates ""\x03Pirates\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Vikings ""\x03Vikings\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
                if (
ColorSlotArray[4] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Knights ""\x03Knights\x01 ") > 0)
                    {
                        return 
ColorSlotArray[4];
                    }
                }
            }
        }
        case 
Game_ND:
        {
            if (
strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "EMPIRE ""\x03Empire\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "CONSORTIUM ""\x03Consortium\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
        case 
Game_DDD:
        {
            if (
g_bTeamPlay && strcmp(message"") != 0)
            {
                if (
ColorSlotArray[2] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Allies ""\x03Allies\x01 ") > 0)
                    {
                        return 
ColorSlotArray[2];
                    }
                }
                if (
ColorSlotArray[3] > -1)
                {
                    if (
ReplaceString(messagesizeof(message), "Axis ""\x03Axis\x01 ") > 0)
                    {
                        return 
ColorSlotArray[3];
                    }
                }
            }
        }
    }

    return -
1;
}


display_menu(player_indextimeStringfull_message[1024], need_handler 0)
{
    
ReplaceString(full_messagesizeof(full_message), "\\n""\10");
    if (
need_handler == 0)
    {
        
InternalShowMenu(player_indexfull_messagetime);
    }
    else
    {
        
InternalShowMenu(player_indexfull_messagetime, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9), InternalMenuHandler);
    }
}


public 
InternalMenuHandler(Handle:menuMenuAction:actionparam1param2)
{
    new 
client param1;
    if (
IsClientInGame(client))
    {
        if (
action == MenuAction_Select)
        {
            
decl Stringplayer_event[192];
            
IntToString(param2player_eventsizeof(player_event));
            
LogPlayerEvent(client"selected"player_event);
        }
        else if (
action == MenuAction_Cancel)
        {
            
LogPlayerEvent(client"selected""cancel");
        }
    }
}


public 
Action:hlx_sm_psay(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_psay <userid><colored><message> - sends private message");
        return 
Plugin_Handled;
    }

    
decl Stringclient_list[192];
    
GetCmdArg(1client_listsizeof(client_list));
    
BuildClientList(client_list);

    
decl Stringcolored_param[32];
    
GetCmdArg(2colored_paramsizeof(colored_param));
    new 
is_colored 0;
    new 
ignore_param 0;
    
    if (
strcmp(colored_param"1") == 0)
    {
        
is_colored 1;
        
ignore_param 1;
    }
    else if (
strcmp(colored_param"2") == 0)
    {
        
is_colored 2;
        
ignore_param 1;
    }
    else if (
strcmp(colored_param"0") == 0)
    {
        
ignore_param 1;
    }

    new 
Stringclient_message[192];
    
GetCmdArg((ignore_param 2), client_messagesizeof(client_message));
    
    if (
IsStackEmpty(message_recipients))
    {
        return 
Plugin_Handled;
    }
    
    new 
color_index = -1;
    
decl Stringdisplay_message[192];

    switch (
gamemod)
    {
        case 
Game_CSSGame_DODSGame_L4DGame_TFGame_HL2MPGame_ZPSGame_AOCGame_FOFGame_GESGame_PVKIIGame_CSPGame_NDGame_DDDGame_CSGO:
        {
            if (
is_colored 0)
            {
                if (
is_colored == 1)
                {
                    new 
player_color_index color_all_players(client_message);
                    if (
player_color_index > -1)
                    {
                        
color_index player_color_index;
                    }
                    else
                    {
                        if (
g_bTrackColors4Chat)
                        {
                            
validate_team_colors();
                        }
                        
color_index color_team_entities(client_message);
                    }
                }
            }
            if (
strcmp(message_prefix"") == 0)
            {
                
Format(display_messagesizeof(display_message), "\x01%s"client_message);
            }
            else
            {
                
Format(display_messagesizeof(display_message), "%c%s\x01 %s", ((gamemod == Game_ZPS || gamemod == Game_GES)?5:4), message_prefixclient_message);
            }
            
            new 
boolsetupColorForRecipients false;
            if (
color_index == -1)
            {
                
setupColorForRecipients true;
            }
            
            if (
g_bTrackColors4Chat && is_colored != 2)
            {
                while (
IsStackEmpty(message_recipients) == false)
                {
                    new 
recipient_client = -1;
                    
PopStackCell(message_recipientsrecipient_client);

                    new 
player_index GetClientOfUserId(recipient_client);
                    if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index))
                    {
                        if (
setupColorForRecipients == true)
                        {
                            
color_index player_index;
                        }
                        
/*new Handle:hBf;
                        hBf = StartMessageOne("SayText2", player_index);
                        if (hBf != INVALID_HANDLE)
                        {
                            BfWriteByte(hBf, color_index); 
                            BfWriteByte(hBf, 0);
                            
                            if (gamemod == Game_CSGO)
                            {
                                // hackhackhack...
                                // CS:GO won't print any colors unless you not only start with standard color (1)
                                // like in other games, but also have a 'printable' character following it. We will just
                                // use an unused control code
                                BfWriteByte(hBf, 1);
                                BfWriteByte(hBf, 11);
                            }
                            
                            BfWriteString(hBf, display_message);
                            EndMessage();
                        }*/
                        
PbSayText2(player_indexcolor_indexfalsedisplay_message);
                    }
                }
            }
            else
            {
                
PrintToChatRecipients(display_message);
            }
        }
        case 
Game_FF:
        {
            
// thanks to hlstriker for help with this
            
            
decl Stringclient_message_backup[192];
            
strcopy(client_message_backupsizeof(client_message_backup), client_message);
        
            if (
is_colored == 1)
            {
                
color_index color_all_players(client_message);
                if (
color_index ==  -1)
                {
                    
color_team_entities(client_message);
                }
            }
            
            if (
strcmp(message_prefix"") == 0)
            {
                
Format(display_messagesizeof(display_message), "Console: %s%s\n", ((is_colored == 2)?"^4":""), client_message);
            }
            else
            {
                
Format(display_messagesizeof(display_message), "Console: ^4%s:%s %s\n"message_prefix, ((is_colored == 2)?"":"^"), client_message);
            }
            
            
PrintToChatRecipientsFF(display_message);
        }
        default:
        {
            if (
strcmp(message_prefix"") != 0)
            {
                
Format(display_messagesizeof(display_message), "%s %s"message_prefixclient_message);
                
PrintToChatRecipients(display_message);
                return 
Plugin_Handled;
            }
            
PrintToChatRecipients(client_message);
        }
    }
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_psay2(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_psay2 <userid><colored><message> - sends green colored private message");
        return 
Plugin_Handled;
    }
    
    
decl Stringclient_list[192];
    
GetCmdArg(1client_listsizeof(client_list));
    
BuildClientList(client_list);

    
decl Stringcolored_param[32];
    
GetCmdArg(2colored_paramsizeof(colored_param));
    
    new 
ignore_param 0;
    if (
strcmp(colored_param"2") == || strcmp(colored_param"1") == || strcmp(colored_param"0") == 0)
    {
        
ignore_param 1;
    }

    new 
Stringclient_message[192];
    
GetCmdArg((ignore_param 2), client_messagesizeof(client_message));

    if (
IsStackEmpty(message_recipients)) {
        return 
Plugin_Handled;
    }
    
    
// Strip color control codes
    
decl String:buffer_message[192];
    new 
0;
    for (new 
0sizeof(client_message); i++)
    {
        new 
char client_message[i];
        if (
char && char 0)
        {
            continue;
        }
        
buffer_message[j] = client_message[i];
        if (
char == 0)
        {
            break;
        }
        
j++;
    }
    
    switch(
gamemod)
    {
        case 
Game_INSMOD:
        {
            new 
prefix 0;
            if (
strcmp(message_prefix"") != 0)
            {
                
prefix 1;
                
Format(client_messagesizeof(client_message), "%s: %s"message_prefixbuffer_message);
            }
            
            while (
IsStackEmpty(message_recipients) == false)
            {
                new 
recipient_client = -1;
                
PopStackCell(message_recipientsrecipient_client);

                new 
player_index GetClientOfUserId(recipient_client);
                if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index))
                {
                    
// thanks to Fyren and IceMatrix for help with this
                    /*new Handle:hBf;
                    hBf = StartMessageOne("SayText", player_index);
                    if (hBf != INVALID_HANDLE)
                    {
                        BfWriteByte(hBf, 1);
                        BfWriteBool(hBf, true);
                        BfWriteByte(hBf, player_index); 
                        
                        if (prefix == 0)
                        {
                            BfWriteString(hBf, buffer_message);
                        }
                        else
                        {
                            BfWriteString(hBf, client_message);
                        }
                        EndMessage();
                    }*/
                    
                    
if (prefix == 0)
                    {
                        
PbSayText(player_index1truebuffer_message);
                    }
                    else
                    {
                        
PbSayText(player_index1trueclient_message);
                    }
                }
            }
        }
        case 
Game_FF:
        {
            if (
strcmp(message_prefix"") == 0)
            {
                
Format(client_messagesizeof(client_message), "Console: \x02^4%s\n"buffer_message);
            }
            else
            {
                
Format(client_messagesizeof(client_message), "Console: \x02^4%s: %s\n"message_prefixbuffer_message);
            }
            
            
PrintToChatRecipientsFF(client_message);
        }
        case 
Game_ZPSGame_GES:
        {
            if (
strcmp(message_prefix"") == 0)
            {
                
Format(client_messagesizeof(client_message), "\x05%s"buffer_message);
            }
            else
            {
                
Format(client_messagesizeof(client_message), "\x05%s %s"message_prefixbuffer_message);
            }
            
PrintToChatRecipients(client_message);
        }
        default:
        {
            if (
strcmp(message_prefix"") == 0)
            {
                
Format(client_messagesizeof(client_message), "\x04%s"buffer_message);
            }
            else
            {
                
Format(client_messagesizeof(client_message), "\x04%s %s"message_prefixbuffer_message);
            }
            
PrintToChatRecipients(client_message);
        }
    }
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_csay(args)
{
    if (
args 1)
    {
        
PrintToServer("Usage: hlx_sm_csay <message> - display center message");
        return 
Plugin_Handled;
    }

    new 
Stringdisplay_message[192];
    
GetCmdArg(1display_messagesizeof(display_message));

    if (
strcmp(display_message"") != 0)
    {
        if (
gamemod == Game_L4D)
        {
            
PrintToChatAll("\x03%s"display_message);
        }
        else
        {
            
PrintCenterTextAll("%s"display_message);
        }
    }
        
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_msay(args)
{
    if (
args 3)
    {
        
PrintToServer("Usage: hlx_sm_msay <time><userid><message> - sends hud message");
        return 
Plugin_Handled;
    }

    if (
gamemod == Game_HL2MP)
    {
        return 
Plugin_Handled;
    }
    
    
decl Stringdisplay_time[16];
    
GetCmdArg(1display_timesizeof(display_time));
    
    
decl Stringclient_id[32];
    
GetCmdArg(2client_idsizeof(client_id));
    
    
decl Stringhandler_param[32];
    
GetCmdArg(3handler_paramsizeof(handler_param));
    
    new 
ignore_param 0;
    new 
need_handler 0;
    if (
handler_param[1] == && (handler_param[0] == '1' || handler_param[0] == '0'))
    {
        
need_handler 1;
        
ignore_param 1;
    }

    new 
Stringclient_message[1024];
    
GetCmdArg((ignore_param 3), client_message1024);

    new 
time StringToInt(display_time);
    if (
time <= 0)
    {
        
time 10;
    }

    new 
client StringToInt(client_id);
    if (
client 0)
    {
        new 
player_index GetClientOfUserId(client);
        if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index) && strcmp(client_message"") != 0)
        {
            
display_menu(player_indextimeclient_messageneed_handler);
        }    
    }
    
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_tsay(args)
{
    if (
args 3)
    {
        
PrintToServer("Usage: hlx_sm_tsay <time><userid><message> - sends hud message");
        return 
Plugin_Handled;
    }

    
decl Stringdisplay_time[16];
    
GetCmdArg(1display_timesizeof(display_time));
    
    
decl Stringclient_id[32];
    
GetCmdArg(2client_idsizeof(client_id));

    new 
Stringclient_message[192];
    
GetCmdArg(3client_messagesizeof(client_message));
    
    new 
client StringToInt(client_id);
    if ((
client 0) && (strcmp(client_message"") != 0))
    {
        new 
player_index GetClientOfUserId(client);
        if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index))
        {
            new 
Handle:values CreateKeyValues("msg");
            
KvSetString(values"title"client_message);
            
KvSetNum(values"level"1); 
            
KvSetString(values"time"display_time); 
            
CreateDialog(player_indexvaluesDialogType_Msg);
            
CloseHandle(values);
        }    
    }
        
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_hint(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_hint <userid><message> - send hint message");
        return 
Plugin_Handled;
    }

    
decl Stringclient_list[192];
    
GetCmdArg(1client_listsizeof(client_list));
    
BuildClientList(client_list);

    new 
Stringclient_message[192];
    
GetCmdArg(2client_messagesizeof(client_message));

    if (
IsStackEmpty(message_recipients) == false && strcmp(client_message"") != 0)
    {
        while (
IsStackEmpty(message_recipients) == false)
        {
            new 
recipient_client = -1;
            
PopStackCell(message_recipientsrecipient_client);
        
            new 
player_index GetClientOfUserId(recipient_client);
            if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index) && IsClientInGame(player_index))
            {
                
PrintHintText(player_index"%s"client_message);
            }
        }
    }
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_browse(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_browse <userid><url> - open client ingame browser");
        return 
Plugin_Handled;
    }

    
decl Stringclient_list[192];
    
GetCmdArg(1client_listsizeof(client_list));
    
BuildClientList(client_list);

    new 
Stringclient_url[192];
    
GetCmdArg(2client_urlsizeof(client_url));

    if (
IsStackEmpty(message_recipients) == false && strcmp(client_url"") != 0)
    {
        while (
IsStackEmpty(message_recipients) == false)
        {
            new 
recipient_client = -1;
            
PopStackCell(message_recipientsrecipient_client);

            new 
player_index GetClientOfUserId(recipient_client);
            if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index))
            {
                if (
g_bGameCanDoMotd)
                {
                    if (
g_bPlyrCanDoMotd[player_index])
                    {
                        
SendSourceModMOTD(player_index"HLstatsX:CE"client_urlMOTDPANEL_TYPE_URL);
                    }
                    else
                    {
                        
PrintToChat(player_index"HTML MOTD needs to be enabled in your game options to use this command");
                    }
                }
                else
                {
                    
PrintToChat(player_index"This game does not support the HTML MOTD window required for this command");
                }
            }
        }
    }
            
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_swap(args)
{
    if (
args 1)
    {
        
PrintToServer("Usage: hlx_sm_swap <userid> - swaps players to the opposite team (css only)");
        return 
Plugin_Handled;
    }

    if (
gamemod != Game_CSS || gamemod != Game_CSGO)
    {
        
PrintToServer("hlx_sm_swap is not supported by this game.");
        return 
Plugin_Handled;
    }
    
    
decl String:client_id[32];
    
GetCmdArg(1client_idsizeof(client_id));

    new 
client StringToInt(client_id);
    if (
client 0)
    {
        new 
player_index GetClientOfUserId(client);
        if (
player_index && IsClientInGame(player_index))
        {
            
swap_player(player_index);
        }
    }
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_redirect(args)
{
    if (
args 3)
    {
        
PrintToServer("Usage: hlx_sm_redirect <time><userid><address><reason> - asks player to be redirected to specified gameserver");
        return 
Plugin_Handled;
    }

    
decl Stringdisplay_time[16];
    
GetCmdArg(1display_timesizeof(display_time));

    
decl Stringclient_list[192];
    
GetCmdArg(2client_listsizeof(client_list));
    
BuildClientList(client_list);
    
    new 
Stringserver_address[192];
    
GetCmdArg(3server_addresssizeof(server_address));

    new 
Stringredirect_reason[192];
    
GetCmdArg(4redirect_reasonsizeof(redirect_reason));

    if (
IsStackEmpty(message_recipients) == false && strcmp(server_address"") != 0)
    {
        while (
IsStackEmpty(message_recipients) == false)
        {
            new 
recipient_client = -1;
            
PopStackCell(message_recipientsrecipient_client);

            new 
player_index GetClientOfUserId(recipient_client);
            if (
player_index && !IsFakeClient(player_index) && IsClientInGame(player_index))
            {
                new 
Handle:top_values CreateKeyValues("msg");
                
KvSetString(top_values"title"redirect_reason);
                
KvSetNum(top_values"level"1); 
                
KvSetString(top_values"time"display_time); 
                
CreateDialog(player_indextop_valuesDialogType_Msg);
                
CloseHandle(top_values);
        
                new 
Floatdisplay_time_float;
                
display_time_float StringToFloat(display_time);
                
DisplayAskConnectBox(player_indexdisplay_time_floatserver_address);
            }
        }
    }
        
    return 
Plugin_Handled;
}


public 
Action:hlx_sm_player_action(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_player_action <clientid><action> - trigger player action to be handled from HLstatsX");
        return 
Plugin_Handled;
    }

    
decl Stringclient_id[32];
    
GetCmdArg(1client_idsizeof(client_id));

    
decl Stringplayer_action[64];
    
GetCmdArg(2player_actionsizeof(player_action));

    new 
client StringToInt(client_id);

    
LogPlayerEvent(client"triggered"player_action);

    return 
Plugin_Handled;
}


public 
Action:hlx_sm_team_action(args)
{
    if (
args 2)
    {
        
PrintToServer("Usage: hlx_sm_team_action <team_name><action> - trigger team action to be handled from HLstatsX");
        return 
Plugin_Handled;
    }

    
decl Stringteam_name[64];
    
GetCmdArg(1team_namesizeof(team_name));

    
decl Stringteam_action[64];
    
GetCmdArg(2team_actionsizeof(team_action));

    
LogToGame("Team \"%s\" triggered \"%s\""team_nameteam_action); 

    return 
Plugin_Handled;
}


public 
Action:hlx_sm_world_action(args)
{
    if (
args 1)
    {
        
PrintToServer("Usage: hlx_sm_world_action <action> - trigger world action to be handled from HLstatsX");
        return 
Plugin_Handled;
    }

    
decl Stringworld_action[64];
    
GetCmdArg(1world_actionsizeof(world_action));

    
LogToGame("World triggered \"%s\""world_action); 

    return 
Plugin_Handled;
}


is_command_blocked(Stringcommand[])
{
    new 
command_blocked 0;
    new 
command_index 0;
    while ((
command_blocked == 0) && (command_index sizeof(blocked_commands)))
    {
        if (
strcmp(commandblocked_commands[command_index]) == 0)
        {
            
command_blocked++;
        }
        
command_index++;
    }
    if (
command_blocked 0)
    {
        return 
1;
    }
    return 
0;
}


public 
Action:hlx_block_commands(client, const String:command[], args)
{
    if (
client)
    {
        if (
client == 0)
        {
            return 
Plugin_Continue;
        }
        new 
block_chat_commands GetConVarInt(hlx_block_chat_commands);

        
decl Stringuser_command[192];
        
GetCmdArgString(user_commandsizeof(user_command));

        
decl Stringorigin_command[192];
        new 
start_index 0;
        new 
command_length strlen(user_command);
        if (
command_length 0)
        {
            if (
user_command[0] == 34)
            {
                
start_index 1;
                if (
user_command[command_length 1] == 34)
                {
                    
user_command[command_length 1] = 0;
                }
            }
            
strcopy(origin_commandsizeof(origin_command), user_command[start_index]);
            
            if (
user_command[start_index] == 47)
            {
                
start_index++;
            }
        }

        new 
Stringcommand_type[32] = "say";

        if (
gamemod == Game_INSMOD)
        {
            
decl Stringsay_type[1];
            
strcopy(say_type2user_command[start_index]);
            if (
strcmp(say_type"1") == 0)
            {
                
command_type "say";
            }
            else if (
strcmp(say_type"2") == 0)
            {
                
command_type "say_team";
            }
            
start_index += 4;
        }

        if (
command_length 0)
        {
            if (
block_chat_commands 0)
            {
                new 
command_blocked is_command_blocked(user_command[start_index]);
                if (
command_blocked 0)
                {
                    if (
IsClientInGame(client))
                    {
                        if ((
strcmp("hlx_menu"user_command[start_index]) == 0) ||
                            (
strcmp("hlx"user_command[start_index]) == 0) ||
                            (
strcmp("hlstatsx"user_command[start_index]) == 0))
                        {
                            
DisplayMenu(HLstatsXMenuMainclientMENU_TIME_FOREVER);
                        }

                        if (
gamemod == Game_INSMOD)
                        {
                            
LogPlayerEvent(clientcommand_typeuser_command[start_index]);
                        }
                        else
                        {
                            
LogPlayerEvent(clientcommand_typeorigin_command);
                        }
                    }
                    return 
Plugin_Stop;
                }
            }
            else
            {
                if (
IsClientInGame(client) &&
                    (
strcmp("hlx_menu"user_command[start_index]) == 0
                    
|| strcmp("hlx"user_command[start_index]) == 0
                    
|| strcmp("hlstatsx"user_command[start_index]) == 0))
                {
                    
DisplayMenu(HLstatsXMenuMainclientMENU_TIME_FOREVER);
                }
                
                return 
Plugin_Continue;
            }
        }
        
    }
    return 
Plugin_Continue;
}


public 
ActionHLstatsX_Event_PlyTeamChange(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
client 0)
    {
        for (new 
0; (sizeof(ColorSlotArray)); i++)
        {
            new 
color_client ColorSlotArray[i];
            if (
color_client > -1)
            {
                if (
color_client == client)
                {
                    
ColorSlotArray[i] = -1;
                }
            }
        }
    }

    return 
Plugin_Continue;
}
                        


swap_player(player_index)
{
    if (
IsClientInGame(player_index))
    {
        switch (
GetClientTeam(player_index))
        {
            case 
CS_TEAM_CT:
            {
                if (
IsPlayerAlive(player_index))
                {
                    
CS_SwitchTeam(player_indexCS_TEAM_T);
                    
CS_RespawnPlayer(player_index);
                    new 
new_model GetRandomInt(03);
                    
SetEntityModel(player_indexts_models[new_model]);
                }
                else
                {
                    
CS_SwitchTeam(player_indexCS_TEAM_T);
                }
            }
            case 
CS_TEAM_T:
            {
                if (
IsPlayerAlive(player_index))
                {
                    
CS_SwitchTeam(player_indexCS_TEAM_CT);
                    
CS_RespawnPlayer(player_index);
                    new 
new_model GetRandomInt(03);
                    
SetEntityModel(player_indexct_models[new_model]);
                    new 
weapon_entity GetPlayerWeaponSlot(player_index4);
                    if (
weapon_entity 0)
                    {
                        
decl Stringclass_name[32];
                        
GetEdictClassname(weapon_entityclass_namesizeof(class_name));
                        if (
strcmp(class_name"weapon_c4") == 0)
                        {
                            
RemovePlayerItem(player_indexweapon_entity);
                        }
                    }
                }
                else
                {
                    
CS_SwitchTeam(player_indexCS_TEAM_CT);
                }
            }
        }
    }
}


public 
CreateHLstatsXMenuMain(&HandleMenuHandle)
{
    
MenuHandle CreateMenu(HLstatsXMainCommandHandlerMenuAction_Select|MenuAction_Cancel);

    if (!
g_bGameCanDoMotd)
    {
        
SetMenuTitle(MenuHandle"HLstatsX - Main Menu");
        
AddMenuItem(MenuHandle"""Display Rank");
        
AddMenuItem(MenuHandle"""Next Players");
        
AddMenuItem(MenuHandle"""Top10 Players");
        
AddMenuItem(MenuHandle"""Auto Ranking");
        
AddMenuItem(MenuHandle"""Toggle Point Msgs");
        
AddMenuItem(MenuHandle"""Toggle Ranking Display");
    }
    else
    {
        
SetMenuTitle(MenuHandle"HLstatsX - Main Menu");
        
AddMenuItem(MenuHandle"""Display Rank");
        
AddMenuItem(MenuHandle"""Next Players");
        
AddMenuItem(MenuHandle"""Top10 Players");
        
AddMenuItem(MenuHandle"""Clans Ranking");
        
AddMenuItem(MenuHandle"""Server Status");
        
AddMenuItem(MenuHandle"""Statsme");
        
AddMenuItem(MenuHandle"""Auto Ranking");
        
AddMenuItem(MenuHandle"""Toggle Point Msgs");
        
AddMenuItem(MenuHandle"""Weapon Usage");
        
AddMenuItem(MenuHandle"""Weapons Accuracy");
        
AddMenuItem(MenuHandle"""Weapons Targets");
        
AddMenuItem(MenuHandle"""Player Kills");
        
AddMenuItem(MenuHandle"""Toggle Ranking Display");
        
AddMenuItem(MenuHandle"""Ban and Cheater List");
        
AddMenuItem(MenuHandle"""Display Help");
    }

    
SetMenuPagination(MenuHandle8);
}


public 
CreateHLstatsXMenuAuto(&HandleMenuHandle)
{
    
MenuHandle CreateMenu(HLstatsXAutoCommandHandlerMenuAction_Select|MenuAction_Cancel);

    
SetMenuTitle(MenuHandle"HLstatsX - Auto-Ranking");
    
AddMenuItem(MenuHandle"""Enable on round-start");
    
AddMenuItem(MenuHandle"""Enable on round-end");
    
AddMenuItem(MenuHandle"""Enable on player death");
    
AddMenuItem(MenuHandle"""Disable");

    
SetMenuPagination(MenuHandle8);
}


public 
CreateHLstatsXMenuEvents(&HandleMenuHandle)
{
    
MenuHandle CreateMenu(HLstatsXEventsCommandHandlerMenuAction_Select|MenuAction_Cancel);

    
SetMenuTitle(MenuHandle"HLstatsX - Console Events");
    
AddMenuItem(MenuHandle"""Enable Events");
    
AddMenuItem(MenuHandle"""Disable Events");
    
AddMenuItem(MenuHandle"""Enable Global Chat");
    
AddMenuItem(MenuHandle"""Disable Global Chat");

    
SetMenuPagination(MenuHandle8);
}


make_player_command(clientStringplayer_command[192]) 
{
    
LogPlayerEvent(client"say"player_command);
}


public 
HLstatsXMainCommandHandler(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        if (
IsClientInGame(param1))
        {
            if (!
g_bGameCanDoMotd)
            {
                switch (
param2)
                {
                    case 

                        
make_player_command(param1"/rank");
                    case 

                        
make_player_command(param1"/next");
                    case 

                        
make_player_command(param1"/top10");
                    case 

                        
DisplayMenu(HLstatsXMenuAutoparam1MENU_TIME_FOREVER);
                    case 

                        
DisplayMenu(HLstatsXMenuEventsparam1MENU_TIME_FOREVER);
                    case 

                        
make_player_command(param1"/hlx_hideranking");
                }
            }
            else
            {
                switch (
param2)
                {
                    case 

                        
make_player_command(param1"/rank");
                    case 

                        
make_player_command(param1"/next");
                    case 

                        
make_player_command(param1"/top10");
                    case 

                        
make_player_command(param1"/clans");
                    case 

                        
make_player_command(param1"/status");
                    case 

                        
make_player_command(param1"/statsme");
                    case 

                        
DisplayMenu(HLstatsXMenuAutoparam1MENU_TIME_FOREVER);
                    case 

                        
DisplayMenu(HLstatsXMenuEventsparam1MENU_TIME_FOREVER);
                    case 

                        
make_player_command(param1"/weapons");
                    case 

                        
make_player_command(param1"/accuracy");
                    case 
10 
                        
make_player_command(param1"/targets");
                    case 
11 
                        
make_player_command(param1"/kills");
                    case 
12 
                        
make_player_command(param1"/hlx_hideranking");
                    case 
13 
                        
make_player_command(param1"/bans");
                    case 
14 
                        
make_player_command(param1"/help");
                }
            }
        }
    }
}


public 
HLstatsXAutoCommandHandler(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        if (
IsClientInGame(param1))
        {
            switch (
param2)
            {
                case 

                    
make_player_command(param1"/hlx_auto start rank");
                case 

                    
make_player_command(param1"/hlx_auto end rank");
                case 

                    
make_player_command(param1"/hlx_auto kill rank");
                case 

                    
make_player_command(param1"/hlx_auto clear");
            }
        }
    }
}


public 
HLstatsXEventsCommandHandler(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        if (
IsClientInGame(param1))
        {
            switch (
param2)
            {
                case 

                    
make_player_command(param1"/hlx_display 1");
                case 

                    
make_player_command(param1"/hlx_display 0");
                case 

                    
make_player_command(param1"/hlx_chat 1");
                case 

                    
make_player_command(param1"/hlx_chat 0");
            }
        }
    }
}

stock BuildClientList(const String:client_list[])
{
    if (
StrContains(client_list",") > -1)
    {
        
decl String:MessageRecipients[MaxClients][8];
        new 
recipient_count ExplodeString(client_list","MessageRecipientsMaxClients8);
        for (new 
0; (recipient_count); i++)
        {
            
PushStackCell(message_recipientsStringToInt(MessageRecipients[i]));
        }
    }
    else
    {
        
PushStackCell(message_recipientsStringToInt(client_list));
    }
}

stock PrintToChatRecipients(const String:message[])
{
    while (
IsStackEmpty(message_recipients) == false)
    {
        new 
recipient_client = -1;
        
PopStackCell(message_recipientsrecipient_client);

        new 
client GetClientOfUserId(recipient_client);
        if (
client && !IsFakeClient(client) && IsClientInGame(client))
        {
            
PrintToChat(client"%s"message);
        }
    }
}

stock PrintToChatRecipientsFF(const String:message[])
{
    while (
IsStackEmpty(message_recipients) == false)
    {
        new 
recipient_client = -1;
        
PopStackCell(message_recipientsrecipient_client);

        new 
client GetClientOfUserId(recipient_client);
        if (
client && !IsFakeClient(client) && IsClientInGame(client))
        {    
            
/*new Handle:hBf;
            hBf = StartMessageOne("SayText", client);
            if (hBf != INVALID_HANDLE)
            {
                BfWriteByte(hBf, 0); // send as console
                BfWriteString(hBf, message);
                BfWriteByte(hBf, 1); // 1 to enable color parsing, 0 to not
                EndMessage();
            }*/
            
PbSayText(client0truemessage);
        }
    }
}

stock PbSayText2(clientauthor 0bool:bWantsToChat false, const String:szFormat[], any:...)
{
    
decl String:szSendMsg[192];
    
VFormat(szSendMsgsizeof(szSendMsg), szFormat5);
    
StrCat(szSendMsgsizeof(szSendMsg), "\n");

    new 
Handle:pb StartMessageOne("SayText2"client);

    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbSetInt(pb"ent_idx"author);
        
// process as chat (removes color if enabled)
        
PbSetBool(pb"chat"bWantsToChat);

        
PbSetString(pb"msg_name"szSendMsg);
        
PbAddString(pb"params""");
        
PbAddString(pb"params""");
        
PbAddString(pb"params""");
        
PbAddString(pb"params""");
    }
    else
    {
        
BfWriteByte(pbauthor); 
        
BfWriteByte(pbbWantsToChat);

        
BfWriteString(pbszFormat);
    }
    
    
EndMessage();
}

stock PbSayText(clientauthor 0bool:bWantsToChat false, const String:szFormat[], any:...)
{
    
decl String:szSendMsg[192];
    
VFormat(szSendMsgsizeof(szSendMsg), szFormat5);
    
StrCat(szSendMsgsizeof(szSendMsg), "\n");

    new 
Handle:pb StartMessageOne("SayText"client);

    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbSetInt(pb"ent_idx"author);
        
PbSetString(pb"text"szSendMsg);
        
PbSetBool(pb"chat"bWantsToChat);
        
    }
    else
    {
        
BfWriteByte(pbauthor); // send as console
        
BfWriteString(pbszFormat);
        
BfWriteByte(pbbWantsToChat); // 1 to enable color parsing, 0 to not
    
}
    
    
EndMessage();
}

stock SendSourceModMOTD(client, const String:title[], const String:msg[], type=MOTDPANEL_TYPE_INDEX)
{    
    new 
Handle:pb StartMessageOne("VGUIMenu"client);

    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbSetString(pb"name""info");
        
PbSetBool(pb"show"true);

        new 
Handle:subkeyString:szType[5];
        
IntToString(typeszType4);

        
subkey PbAddMessage(pb"subkeys");
        
PbSetString(subkey"name""type");
        
PbSetString(subkey"str"szType); // MOTDPANEL_TYPE_URL

        
subkey PbAddMessage(pb"subkeys");
        
PbSetString(subkey"name""title");
        
PbSetString(subkey"str"title);

        
subkey PbAddMessage(pb"subkeys");
        
PbSetString(subkey"name""msg");
        
PbSetString(subkey"str"msg);

        
EndMessage();
    }
    else
    {
        
ShowMOTDPanel(clienttitlemsgtype);
    }
}

/////////////////////////////////////////////////////////logege 

#define LOGHELPER_VERSION 3
new String:g_team_list[16][64];

// Call this on map start to cache team names in g_team_list

stock GetTeams(bool:insmod false)
{
    if (!
insmod)
    {
        new 
max_teams_count GetTeamCount();
        for (new 
team_index 0; (team_index max_teams_count); team_index++)
        {
            
decl Stringteam_name[64];
            
GetTeamName(team_indexteam_namesizeof(team_name));

            if (
strcmp(team_name"") != 0)
            {
                
g_team_list[team_index] = team_name;
            }
        }
    }
    else
    {
        
// they really need to get their act together... GetTeamName() would be awesome since they can't even keep their team indexes consistent
        
decl String:mapname[64];
        
GetCurrentMap(mapnamesizeof(mapname));
        if (
strcmp(mapname"ins_karam") == || strcmp(mapname"ins_baghdad") == 0)
        {
            
g_team_list[1] = "Iraqi Insurgents";
            
g_team_list[2] = "U.S. Marines";
        }
        else
        {
            
g_team_list[1] = "U.S. Marines";
            
g_team_list[2] = "Iraqi Insurgents";
        }
        
g_team_list[0] = "Unassigned";
        
g_team_list[3] = "SPECTATOR";
    }
}

stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = "")
{
    if (
IsValidPlayer(client))
    {
        
decl String:player_authid[32];
        if (!
GetClientAuthString(clientplayer_authidsizeof(player_authid)))
        {
            
strcopy(player_authidsizeof(player_authid), "UNKNOWN");
        }

        if (
display_location)
        {
            
decl Float:player_origin[3];
            
GetClientAbsOrigin(clientplayer_origin);
            
LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s (position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventpropertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2])); 
        }
        else
        {
            
LogToGame("\"%N<%d><%s><%s>\" %s \"%s\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventproperties); 
        }
    }
}

stock LogPlyrPlyrEvent(clientvictim, const String:verb[], const String:event[], bool:display_location false, const String:properties[] = "")
{
    if (
IsValidPlayer(client) && IsValidPlayer(victim))
    {
        
decl String:player_authid[32];
        if (!
GetClientAuthString(clientplayer_authidsizeof(player_authid)))
        {
            
strcopy(player_authidsizeof(player_authid), "UNKNOWN");
        }
        
decl String:victim_authid[32];
        if (!
GetClientAuthString(victimvictim_authidsizeof(victim_authid)))
        {
            
strcopy(victim_authidsizeof(victim_authid), "UNKNOWN");
        }
        
        if (
display_location)
        {
            
decl Float:player_origin[3];
            
GetClientAbsOrigin(clientplayer_origin);
            
            
decl Float:victim_origin[3];
            
GetClientAbsOrigin(victimvictim_origin);
            
            
LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s (position \"%d %d %d\") (victim_position \"%d %d %d\")"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], propertiesRoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); 
        }
        else
        {
            
LogToGame("\"%N<%d><%s><%s>\" %s \"%s\" against \"%N<%d><%s><%s>\"%s"clientGetClientUserId(client), player_authidg_team_list[GetClientTeam(client)], verbeventvictimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], properties); 
        }
    }
}

stock LogKill(attackervictim, const String:weapon[], bool:display_location false, const String:properties[] = "")
{
    if (
IsValidPlayer(attacker) && IsValidPlayer(victim))
    {
        
decl String:attacker_authid[32];
        if (!
GetClientAuthString(attackerattacker_authidsizeof(attacker_authid)))
        {
            
strcopy(attacker_authidsizeof(attacker_authid), "UNKNOWN");
        }
        
decl String:victim_authid[32];
        if (!
GetClientAuthString(victimvictim_authidsizeof(victim_authid)))
        {
            
strcopy(victim_authidsizeof(victim_authid), "UNKNOWN");
        }
            
        if (
display_location)
        {
            
decl Float:attacker_origin[3];
            
GetClientAbsOrigin(attackerattacker_origin);
            
decl Float:victim_origin[3];
            
GetClientAbsOrigin(victimvictim_origin);
            
            
LogToGame("\"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\"%s (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")"attackerGetClientUserId(attacker), attacker_authidg_team_list[GetClientTeam(attacker)], victimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], weaponpropertiesRoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2])); 
        }
        else
        {
            
LogToGame("\"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\"%s"attackerGetClientUserId(attacker), attacker_authidg_team_list[GetClientTeam(attacker)], victimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], weaponproperties); 
        }
    }
}

// For Psychostats "KTRAJ" kill trajectory log lines
stock LogPSKillTraj(attackervictim, const String:weapon[])
{
    if (
IsValidPlayer(attacker) && IsValidPlayer(victim))
    {
        
decl String:attacker_authid[32];
        if (!
GetClientAuthString(attackerattacker_authidsizeof(attacker_authid)))
        {
            
strcopy(attacker_authidsizeof(attacker_authid), "UNKNOWN");
        }
        
decl String:victim_authid[32];
        if (!
GetClientAuthString(victimvictim_authidsizeof(victim_authid)))
        {
            
strcopy(victim_authidsizeof(victim_authid), "UNKNOWN");
        }
        
        
decl Float:attacker_origin[3];
        
GetClientAbsOrigin(attackerattacker_origin);
        
decl Float:victim_origin[3];
        
GetClientAbsOrigin(victimvictim_origin);
        
        
LogToGame("[KTRAJ] \"%N<%d><%s><%s>\" killed \"%N<%d><%s><%s>\" with \"%s\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")"attackerGetClientUserId(attacker), attacker_authidg_team_list[GetClientTeam(attacker)], victimGetClientUserId(victim), victim_authidg_team_list[GetClientTeam(victim)], weaponRoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2]));
    }
}

// Verb should always be triggered" for this.
stock LogTeamEvent(team, const String:verb[], const String:event[], const String:properties[] = "")
{
    if (
team > -1)
    {
        
LogToGame("Team \"%s\" %s \"%s\"%s"g_team_list[team], verbeventproperties);
    }
}

stock LogKillLoc(attackervictim)
{
    if (
attacker && victim 0)
    {
        
decl Float:attacker_origin[3];
        
GetClientAbsOrigin(attackerattacker_origin);
        
decl Float:victim_origin[3];
        
GetClientAbsOrigin(victimvictim_origin);
                
        
LogToGame("World triggered \"killlocation\" (attacker_position \"%d %d %d\") (victim_position \"%d %d %d\")"RoundFloat(attacker_origin[0]), RoundFloat(attacker_origin[1]), RoundFloat(attacker_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2]));
    }
}

stock LogRoleChange(client, const String:role[], const String:properties[] = "")
{
    
LogPlayerEventclient"changed role to"rolefalseproperties );
}

stock LogMapLoad()
{
    
decl String:map[64];
    
GetCurrentMap(mapsizeof(map));
    
LogToGame("Loading map \"%s\""map);
}

stock IsValidPlayer(client)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
    {
        return 
true;
    }
    return 
false;

OBS!! For more info about the code??
ask the owner who did create the code..
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.

Last edited by sixten_8_9@; 04-22-2014 at 19:41.
sixten_8_9@ 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 07:40.


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