added new formatting based on tiers for the connect message
This commit is contained in:
parent
a460fbeaeb
commit
07c8d450b3
1
ConnectAnnounce/configs/connect_announce/settings1.cfg
Normal file
1
ConnectAnnounce/configs/connect_announce/settings1.cfg
Normal file
@ -0,0 +1 @@
|
|||||||
|
{BLUE}{PLAYERTIER} {WHITE}{PLAYERTYPE} {GREEN}{NAME} {green}[{lightgreen}{STEAMID}{NOSTEAM}{green}] connected{COUNTRY}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
#include <clientprefs>
|
#include <clientprefs>
|
||||||
#include <PlayerManager>
|
#include <PlayerManager>
|
||||||
|
#include <unloze_playtime>
|
||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
@ -290,6 +291,169 @@ public Action Command_ResetJoinMsg(int client, int args)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public void GetPlayerTier(int client, int tier)
|
||||||
|
{
|
||||||
|
Handle hFile = OpenFile(g_sDataFile, "r");
|
||||||
|
static char sRawMsg[301];
|
||||||
|
|
||||||
|
if(hFile != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
ReadFileLine(hFile, sRawMsg, sizeof(sRawMsg));
|
||||||
|
TrimString(sRawMsg);
|
||||||
|
delete hFile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogError("[SM] File not found! (configs/ConnectAnnounce/settings.txt)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char sIP[16];
|
||||||
|
static char sAuth[32];
|
||||||
|
static char sCountry[32];
|
||||||
|
static char sName[128];
|
||||||
|
|
||||||
|
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
|
||||||
|
GetClientName(client, sName, sizeof(sName));
|
||||||
|
AdminId aid;
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{PLAYERTIER}"))
|
||||||
|
{
|
||||||
|
char s_tier[64];
|
||||||
|
Format(s_tier, sizeof(s_tier), "Tier %i", tier);
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{PLAYERTIER}", s_tier);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{PLAYERTYPE}"))
|
||||||
|
{
|
||||||
|
aid = GetUserAdmin(client);
|
||||||
|
|
||||||
|
if(GetAdminFlag(aid, Admin_Generic))
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{PLAYERTYPE}", "Admin");
|
||||||
|
}
|
||||||
|
else if(GetAdminFlag(aid, Admin_Custom1))
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{PLAYERTYPE}", "VIP");
|
||||||
|
}
|
||||||
|
else if(GetAdminFlag(aid, Admin_Custom6))
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{PLAYERTYPE}", "Member");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{PLAYERTYPE}", "Player");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{NOSTEAM}"))
|
||||||
|
{
|
||||||
|
if(!PM_IsPlayerSteam(client))
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{NOSTEAM}", " <NoSteam>");
|
||||||
|
else
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{NOSTEAM}", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{STEAMID}"))
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{STEAMID}", sAuth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{NAME}"))
|
||||||
|
{
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{NAME}", sName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrContains(sRawMsg, "{COUNTRY}"))
|
||||||
|
{
|
||||||
|
if(GetClientIP(client, sIP, sizeof(sIP)) && GeoipCountry(sIP, sCountry, sizeof(sCountry)))
|
||||||
|
{
|
||||||
|
char sBuffer[128];
|
||||||
|
Format(sBuffer, sizeof(sBuffer), " from %s", sCountry);
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{COUNTRY}", sBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ReplaceString(sRawMsg, sizeof(sRawMsg), "{COUNTRY}", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if (!CheckCommandAccess(client, "sm_joinmsg", ADMFLAG_CUSTOM1))
|
||||||
|
{
|
||||||
|
CPrintToChatAll(sRawMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete g_hCustomMessageFile2;
|
||||||
|
|
||||||
|
g_hCustomMessageFile2 = CreateKeyValues("custom_messages");
|
||||||
|
|
||||||
|
if (!FileToKeyValues(g_hCustomMessageFile2, g_sCustomMessageFile))
|
||||||
|
{
|
||||||
|
SetFailState("[ConnectAnnounce] Config file missing!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KvRewind(g_hCustomMessageFile2);
|
||||||
|
|
||||||
|
char sBanned[16];
|
||||||
|
char sFinalMessage[512];
|
||||||
|
char sCustomMessage[256];
|
||||||
|
|
||||||
|
if (KvJumpToKey(g_hCustomMessageFile2, sAuth))
|
||||||
|
{
|
||||||
|
KvGetString(g_hCustomMessageFile2, "banned", sBanned, sizeof(sBanned), "");
|
||||||
|
KvGetString(g_hCustomMessageFile2, "message", sCustomMessage, sizeof(sCustomMessage), "");
|
||||||
|
if(StrEqual(sCustomMessage, "reset") || StrEqual(sBanned, "true"))
|
||||||
|
{
|
||||||
|
CPrintToChatAll(sRawMsg);
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
{
|
||||||
|
if(g_bHideCsays[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PrintCenterText(i, "%s %s %s", "[VIP]", sName, "connected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sFinalMessage, sizeof(sFinalMessage), "%s %s", sRawMsg, sCustomMessage);
|
||||||
|
CPrintToChatAll(sFinalMessage);
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
{
|
||||||
|
if(g_bHideCsays[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CRemoveTags(sCustomMessage, 256);
|
||||||
|
PrintCenterText(i, "%s %s %s %s", "[VIP]", sName, "connected", sCustomMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CPrintToChatAll(sRawMsg);
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
{
|
||||||
|
if(g_bHideCsays[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PrintCenterText(i, "%s %s %s", "[VIP]", sName, "connected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
||||||
{
|
{
|
||||||
int client = 0;
|
int client = 0;
|
||||||
@ -338,7 +502,6 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
|
|||||||
|
|
||||||
if(StrContains(sRawMsg, "{PLAYERTYPE}"))
|
if(StrContains(sRawMsg, "{PLAYERTYPE}"))
|
||||||
{
|
{
|
||||||
|
|
||||||
aid = GetUserAdmin(client);
|
aid = GetUserAdmin(client);
|
||||||
|
|
||||||
if(GetAdminFlag(aid, Admin_Generic))
|
if(GetAdminFlag(aid, Admin_Generic))
|
||||||
@ -492,7 +655,9 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
char sServer[16];
|
char sServer[16];
|
||||||
g_cvHlstatsServerName.GetString(sServer, sizeof(sServer));
|
g_cvHlstatsServerName.GetString(sServer, sizeof(sServer));
|
||||||
|
|
||||||
|
/*
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
Format(sQuery, sizeof(sQuery), "SELECT COUNT(*) AS 'rank' FROM hlstats_Players WHERE hlstats_Players.game = '%s' 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 = '%s')", sServer, sAuth, sServer);
|
Format(sQuery, sizeof(sQuery), "SELECT COUNT(*) AS 'rank' FROM hlstats_Players WHERE hlstats_Players.game = '%s' 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 = '%s')", sServer, sAuth, sServer);
|
||||||
g_hDatabase.Query(TQueryCB, sQuery, GetClientUserId(client), DBPrio_High);
|
g_hDatabase.Query(TQueryCB, sQuery, GetClientUserId(client), DBPrio_High);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user