ConnectAnnounce: Added Csay for VIPs on connect
also added sm_hide_connect_csay for those who want to block it
This commit is contained in:
parent
0b15d273ad
commit
8cb5604663
@ -4,6 +4,7 @@
|
|||||||
#include <connect>
|
#include <connect>
|
||||||
#include <geoip>
|
#include <geoip>
|
||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
|
#include <clientprefs>
|
||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
@ -15,6 +16,9 @@ Database g_hDatabase;
|
|||||||
Handle g_hCustomMessageFile;
|
Handle g_hCustomMessageFile;
|
||||||
Handle g_hCustomMessageFile2;
|
Handle g_hCustomMessageFile2;
|
||||||
|
|
||||||
|
bool g_bHideCsays[MAXPLAYERS + 1] = { false, ... };
|
||||||
|
bool g_bHideCsaysHooked = false;
|
||||||
|
Handle g_hCookieHideCsays = null;
|
||||||
|
|
||||||
#define MSGLENGTH 100
|
#define MSGLENGTH 100
|
||||||
|
|
||||||
@ -23,9 +27,9 @@ Handle g_hCustomMessageFile2;
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Plugin myinfo = {
|
public Plugin myinfo = {
|
||||||
name = "Connect Announce",
|
name = "Connect Announce",
|
||||||
author = "Neon + Botox",
|
author = "Neon + Botox + Dogan",
|
||||||
description = "Connect Announcer",
|
description = "Connect Announcer with special features for VIPS",
|
||||||
version = "2.0",
|
version = "3.0",
|
||||||
url = ""
|
url = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +55,70 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
RegAdminCmd("sm_joinmsg", Command_JoinMsg, ADMFLAG_CUSTOM1, "Sets a custom message which will be shown upon connecting to the server");
|
RegAdminCmd("sm_joinmsg", Command_JoinMsg, ADMFLAG_CUSTOM1, "Sets a custom message which will be shown upon connecting to the server");
|
||||||
RegAdminCmd("sm_resetjoinmsg", Command_ResetJoinMsg, ADMFLAG_CUSTOM1, "Resets your custom connect message");
|
RegAdminCmd("sm_resetjoinmsg", Command_ResetJoinMsg, ADMFLAG_CUSTOM1, "Resets your custom connect message");
|
||||||
|
|
||||||
|
RegConsoleCmd("sm_hide_connect_csay", HideCsays, "Toggle blocking connect csay messages");
|
||||||
|
|
||||||
|
g_hCookieHideCsays = RegClientCookie("csays_blocked", "are csays blocked", CookieAccess_Protected);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public Action HideCsays(int client, int args)
|
||||||
|
{
|
||||||
|
g_bHideCsays[client] = !g_bHideCsays[client];
|
||||||
|
CheckHooks();
|
||||||
|
|
||||||
|
if(g_bHideCsays[client])
|
||||||
|
{
|
||||||
|
ReplyToCommand(client, "You blocked Connect Csays");
|
||||||
|
SetClientCookie(client, g_hCookieHideCsays, "1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReplyToCommand(client, "You unblocked Connect Csays");
|
||||||
|
SetClientCookie(client, g_hCookieHideCsays, "");
|
||||||
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientCookiesCached(int client)
|
||||||
|
{
|
||||||
|
char sBuffer[2];
|
||||||
|
|
||||||
|
GetClientCookie(client, g_hCookieHideCsays, sBuffer, sizeof(sBuffer));
|
||||||
|
|
||||||
|
if(sBuffer[0] != '\0')
|
||||||
|
{
|
||||||
|
g_bHideCsays[client] = true;
|
||||||
|
g_bHideCsaysHooked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bHideCsays[client] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientDisconnect(int client)
|
||||||
|
{
|
||||||
|
g_bHideCsays[client] = false;
|
||||||
|
CheckHooks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckHooks()
|
||||||
|
{
|
||||||
|
bool bShouldHook = false;
|
||||||
|
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(g_bHideCsays[i])
|
||||||
|
{
|
||||||
|
bShouldHook = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bHideCsaysHooked = bShouldHook;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -274,9 +342,9 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if (!CheckCommandAccess(client, "sm_joinmsg", ADMFLAG_CUSTOM1))
|
if (!CheckCommandAccess(client, "sm_joinmsg", ADMFLAG_CUSTOM1))
|
||||||
{
|
{
|
||||||
CPrintToChatAll(sRawMsg);
|
CPrintToChatAll(sRawMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -303,8 +371,8 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
|||||||
if (KvJumpToKey(g_hCustomMessageFile2, sAuth))
|
if (KvJumpToKey(g_hCustomMessageFile2, sAuth))
|
||||||
{
|
{
|
||||||
KvGetString(g_hCustomMessageFile2, "banned", sBanned, sizeof(sBanned), "");
|
KvGetString(g_hCustomMessageFile2, "banned", sBanned, sizeof(sBanned), "");
|
||||||
|
|
||||||
|
|
||||||
KvGetString(g_hCustomMessageFile2, "message", sCustomMessage, sizeof(sCustomMessage), "");
|
KvGetString(g_hCustomMessageFile2, "message", sCustomMessage, sizeof(sCustomMessage), "");
|
||||||
if (StrEqual(sCustomMessage, "reset") || StrEqual(sBanned, "true"))
|
if (StrEqual(sCustomMessage, "reset") || StrEqual(sBanned, "true"))
|
||||||
CPrintToChatAll(sRawMsg);
|
CPrintToChatAll(sRawMsg);
|
||||||
@ -334,4 +402,21 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
Format(sQuery, sizeof(sQuery), "SELECT COUNT(*) AS rank FROM hlstats_Players WHERE hlstats_Players.game = 'css-ze' AND hideranking = 0 AND skill > (SELECT skill from hlstats_Players JOIN hlstats_PlayerUniqueIds ON hlstats_Players.playerId = hlstats_PlayerUniqueIds.playerId WHERE uniqueId = '%s' AND hlstats_PlayerUniqueIds.game = 'css-ze')", sAuth);
|
Format(sQuery, sizeof(sQuery), "SELECT COUNT(*) AS rank FROM hlstats_Players WHERE hlstats_Players.game = 'css-ze' AND hideranking = 0 AND skill > (SELECT skill from hlstats_Players JOIN hlstats_PlayerUniqueIds ON hlstats_Players.playerId = hlstats_PlayerUniqueIds.playerId WHERE uniqueId = '%s' AND hlstats_PlayerUniqueIds.game = 'css-ze')", sAuth);
|
||||||
SQL_TQuery(g_hDatabase, TQueryCB, sQuery, GetClientUserId(client));
|
SQL_TQuery(g_hDatabase, TQueryCB, sQuery, GetClientUserId(client));
|
||||||
}
|
|
||||||
|
char sCustomMessage[256];
|
||||||
|
char buffer[128];
|
||||||
|
GetClientName(client, buffer, 128);
|
||||||
|
KvGetString(g_hCustomMessageFile2, "message", sCustomMessage, sizeof(sCustomMessage), "");
|
||||||
|
CRemoveTags(sCustomMessage, 256);
|
||||||
|
|
||||||
|
if(CheckCommandAccess(client, "nigger", ADMFLAG_CUSTOM1) == true)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(!g_bHideCsays[i])
|
||||||
|
{
|
||||||
|
PrintCenterText(i, "%s %s %s", "[VIP]", buffer, sCustomMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user