mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-08 02:48:26 +00:00
Added 'Shavit_StopChatSound'. (#448)
This commit is contained in:
parent
cdb745214d
commit
066f60c057
@ -941,6 +941,14 @@ native void Shavit_SetReplayData(int client, ArrayList data);
|
|||||||
*/
|
*/
|
||||||
native ArrayList Shavit_GetReplayData(int client);
|
native ArrayList Shavit_GetReplayData(int client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this native to stop the chat tick sound that happens in CS:S.
|
||||||
|
* Call it before each Shavit_PrintToChat() or Shavit_PrintToChatAll().
|
||||||
|
*
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native void Shavit_StopChatSound();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this native when printing anything in chat if it's related to the timer.
|
* Use this native when printing anything in chat if it's related to the timer.
|
||||||
* This native will auto-assign colors and a chat prefix.
|
* This native will auto-assign colors and a chat prefix.
|
||||||
@ -1029,6 +1037,7 @@ public void __pl_shavit_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("Shavit_SetPracticeMode");
|
MarkNativeAsOptional("Shavit_SetPracticeMode");
|
||||||
MarkNativeAsOptional("Shavit_SetReplayData");
|
MarkNativeAsOptional("Shavit_SetReplayData");
|
||||||
MarkNativeAsOptional("Shavit_StartTimer");
|
MarkNativeAsOptional("Shavit_StartTimer");
|
||||||
|
MarkNativeAsOptional("Shavit_StopChatSound");
|
||||||
MarkNativeAsOptional("Shavit_StopTimer");
|
MarkNativeAsOptional("Shavit_StopTimer");
|
||||||
MarkNativeAsOptional("Shavit_ZoneExists");
|
MarkNativeAsOptional("Shavit_ZoneExists");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,6 +129,9 @@ any gA_StyleSettings[STYLE_LIMIT][STYLESETTINGS_SIZE];
|
|||||||
// chat settings
|
// chat settings
|
||||||
char gS_ChatStrings[CHATSETTINGS_SIZE][128];
|
char gS_ChatStrings[CHATSETTINGS_SIZE][128];
|
||||||
|
|
||||||
|
// misc cache
|
||||||
|
bool gB_StopChatSound = false;
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "[shavit] Core",
|
name = "[shavit] Core",
|
||||||
@ -140,19 +143,14 @@ public Plugin myinfo =
|
|||||||
|
|
||||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||||
{
|
{
|
||||||
// get game type
|
|
||||||
CreateNative("Shavit_GetGameType", Native_GetGameType);
|
|
||||||
|
|
||||||
// get database handle
|
|
||||||
CreateNative("Shavit_GetDB", Native_GetDB);
|
|
||||||
|
|
||||||
// timer natives
|
|
||||||
CreateNative("Shavit_FinishMap", Native_FinishMap);
|
CreateNative("Shavit_FinishMap", Native_FinishMap);
|
||||||
CreateNative("Shavit_GetBhopStyle", Native_GetBhopStyle);
|
CreateNative("Shavit_GetBhopStyle", Native_GetBhopStyle);
|
||||||
CreateNative("Shavit_GetChatStrings", Native_GetChatStrings);
|
CreateNative("Shavit_GetChatStrings", Native_GetChatStrings);
|
||||||
CreateNative("Shavit_GetClientJumps", Native_GetClientJumps);
|
CreateNative("Shavit_GetClientJumps", Native_GetClientJumps);
|
||||||
CreateNative("Shavit_GetClientTime", Native_GetClientTime);
|
CreateNative("Shavit_GetClientTime", Native_GetClientTime);
|
||||||
CreateNative("Shavit_GetClientTrack", Native_GetClientTrack);
|
CreateNative("Shavit_GetClientTrack", Native_GetClientTrack);
|
||||||
|
CreateNative("Shavit_GetDB", Native_GetDB);
|
||||||
|
CreateNative("Shavit_GetGameType", Native_GetGameType);
|
||||||
CreateNative("Shavit_GetStrafeCount", Native_GetStrafeCount);
|
CreateNative("Shavit_GetStrafeCount", Native_GetStrafeCount);
|
||||||
CreateNative("Shavit_GetStyleCount", Native_GetStyleCount);
|
CreateNative("Shavit_GetStyleCount", Native_GetStyleCount);
|
||||||
CreateNative("Shavit_GetStyleSettings", Native_GetStyleSettings);
|
CreateNative("Shavit_GetStyleSettings", Native_GetStyleSettings);
|
||||||
@ -169,6 +167,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
CreateNative("Shavit_SaveSnapshot", Native_SaveSnapshot);
|
CreateNative("Shavit_SaveSnapshot", Native_SaveSnapshot);
|
||||||
CreateNative("Shavit_SetPracticeMode", Native_SetPracticeMode);
|
CreateNative("Shavit_SetPracticeMode", Native_SetPracticeMode);
|
||||||
CreateNative("Shavit_StartTimer", Native_StartTimer);
|
CreateNative("Shavit_StartTimer", Native_StartTimer);
|
||||||
|
CreateNative("Shavit_StopChatSound", Native_StopChatSound);
|
||||||
CreateNative("Shavit_StopTimer", Native_StopTimer);
|
CreateNative("Shavit_StopTimer", Native_StopTimer);
|
||||||
|
|
||||||
// registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins
|
// registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins
|
||||||
@ -1034,6 +1033,12 @@ public int Native_ResumeTimer(Handle handler, int numParams)
|
|||||||
ResumeTimer(GetNativeCell(1));
|
ResumeTimer(GetNativeCell(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Native_StopChatSound(Handle handler, int numParams)
|
||||||
|
{
|
||||||
|
gB_StopChatSound = true;
|
||||||
|
RequestFrame(RevertChatSound);
|
||||||
|
}
|
||||||
|
|
||||||
public int Native_PrintToChat(Handle handler, int numParams)
|
public int Native_PrintToChat(Handle handler, int numParams)
|
||||||
{
|
{
|
||||||
int client = GetNativeCell(1);
|
int client = GetNativeCell(1);
|
||||||
@ -1050,7 +1055,7 @@ public int Native_PrintToChat(Handle handler, int numParams)
|
|||||||
if(hSayText2 != null)
|
if(hSayText2 != null)
|
||||||
{
|
{
|
||||||
BfWriteByte(hSayText2, client);
|
BfWriteByte(hSayText2, client);
|
||||||
BfWriteByte(hSayText2, true);
|
BfWriteByte(hSayText2, !gB_StopChatSound);
|
||||||
BfWriteString(hSayText2, buffer);
|
BfWriteString(hSayText2, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,6 +1191,11 @@ int GetTimerStatus(int client)
|
|||||||
return view_as<int>(Timer_Running);
|
return view_as<int>(Timer_Running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RevertChatSound(any data)
|
||||||
|
{
|
||||||
|
gB_StopChatSound = false;
|
||||||
|
}
|
||||||
|
|
||||||
void StartTimer(int client, int track)
|
void StartTimer(int client, int track)
|
||||||
{
|
{
|
||||||
if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client))
|
if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user