ConnectAnnounce: sm_hide_connect_csays vip only
This commit is contained in:
parent
7c7f9b6152
commit
4276ecf499
@ -30,7 +30,7 @@ public Plugin myinfo = {
|
||||
name = "Connect Announce",
|
||||
author = "Neon + Botox + Dogan",
|
||||
description = "Connect Announcer with special features for VIPS",
|
||||
version = "3.0",
|
||||
version = "3.1",
|
||||
url = ""
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ 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_resetjoinmsg", Command_ResetJoinMsg, ADMFLAG_CUSTOM1, "Resets your custom connect message");
|
||||
|
||||
RegConsoleCmd("sm_hide_connect_csays", OnToggleHideCsays, "Toggle blocking connect csay messages");
|
||||
RegAdminCmd("sm_hide_connect_csays", OnToggleHideCsays, ADMFLAG_CUSTOM1, "Toggle blocking connect csay messages");
|
||||
|
||||
g_hCookieHideCsays = RegClientCookie("csays_blocked", "are csays blocked", CookieAccess_Protected);
|
||||
|
||||
@ -71,6 +71,15 @@ public void OnDatabaseConnect(Database db, const char[] error, any data)
|
||||
g_hDatabase = db;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientCookiesCached(int client)
|
||||
{
|
||||
if(IsClientAuthorized(client))
|
||||
ReadClientCookies(client);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -85,20 +94,17 @@ public void ToggleHideCsays(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientCookiesCached(int client)
|
||||
public void ReadClientCookies(int client)
|
||||
{
|
||||
char sBuffer[2];
|
||||
|
||||
GetClientCookie(client, g_hCookieHideCsays, sBuffer, sizeof(sBuffer));
|
||||
if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1))
|
||||
GetClientCookie(client, g_hCookieHideCsays, sBuffer, sizeof(sBuffer));
|
||||
|
||||
if(sBuffer[0] != '\0')
|
||||
{
|
||||
g_bHideCsays[client] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_bHideCsays[client] = false;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -123,6 +129,12 @@ public Action OnToggleHideCsays(int client, int args)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void ShowSettingsMenu(int client)
|
||||
{
|
||||
if(!CheckCommandAccess(client, "", ADMFLAG_CUSTOM1))
|
||||
{
|
||||
PrintToChat(client, "[SM] You don't have access to these Settings.");
|
||||
return;
|
||||
}
|
||||
|
||||
Menu menu = new Menu(MenuHandler_MainMenu);
|
||||
|
||||
menu.SetTitle("ConnectCsay Settings", client);
|
||||
@ -434,8 +446,11 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
||||
CPrintToChatAll(sRawMsg);
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(!g_bHideCsays[i] && IsClientInGame(i))
|
||||
if(IsClientInGame(i))
|
||||
{
|
||||
if(g_bHideCsays[i] || (g_bHideCsays[i] && client == i))
|
||||
continue;
|
||||
|
||||
PrintCenterText(i, "%s %s %s", "[VIP]", sName, "connected");
|
||||
}
|
||||
}
|
||||
@ -446,8 +461,11 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
||||
CPrintToChatAll(sFinalMessage);
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(!g_bHideCsays[i] && IsClientInGame(i))
|
||||
if(IsClientInGame(i))
|
||||
{
|
||||
if(g_bHideCsays[i] || (g_bHideCsays[i] && client == i))
|
||||
continue;
|
||||
|
||||
CRemoveTags(sCustomMessage, 256);
|
||||
PrintCenterText(i, "%s %s %s %s", "[VIP]", sName, "connected", sCustomMessage);
|
||||
}
|
||||
@ -459,8 +477,11 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
||||
CPrintToChatAll(sRawMsg);
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(!g_bHideCsays[i] && IsClientInGame(i))
|
||||
if(IsClientInGame(i))
|
||||
{
|
||||
if(g_bHideCsays[i] || (g_bHideCsays[i] && client == i))
|
||||
continue;
|
||||
|
||||
PrintCenterText(i, "%s %s %s", "[VIP]", sName, "connected");
|
||||
}
|
||||
}
|
||||
@ -474,6 +495,9 @@ public void OnClientPostAdminCheck(int client)
|
||||
if(IsFakeClient(client))
|
||||
return;
|
||||
|
||||
if(AreClientCookiesCached(client))
|
||||
ReadClientCookies(client);
|
||||
|
||||
if(g_hDatabase == INVALID_HANDLE)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user