mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Add topleft hud and clantag forwards
This commit is contained in:
parent
a0d205247a
commit
ef8af7807d
@ -575,6 +575,37 @@ forward void Shavit_OnReplayStart(int client);
|
|||||||
*/
|
*/
|
||||||
forward void Shavit_OnReplayEnd(int client);
|
forward void Shavit_OnReplayEnd(int client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when top left HUD updates.
|
||||||
|
*
|
||||||
|
* @param client Client index that recieves the hud.
|
||||||
|
* @param target Client index that recieves the hud.
|
||||||
|
* @param topleft Reference to the HUD buffer.
|
||||||
|
* @param topleftlength Max length of the topleft buffer.
|
||||||
|
* @return Plugin_Handled or Plugin_Stop to block the HUD message from appearing. Anything else to pass along new values.
|
||||||
|
*/
|
||||||
|
forward Action Shavit_OnTopLeftHUD(int client, int target, char[] topleft, const int topleftlength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before clan tag variables are processed
|
||||||
|
*
|
||||||
|
* @param client Client index.
|
||||||
|
* @param clantag Reference to the clan tag buffer.
|
||||||
|
* @param clantaglength Max length of the customtag buffer.
|
||||||
|
* @return Plugin_Handled or Plugin_Stop to block the clan tag from changing. Anything else to pass along new values.
|
||||||
|
*/
|
||||||
|
forward Action Shavit_OnClanTagChangePre(int client, char[] clantag, int clantaglength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after clan tags are changed
|
||||||
|
*
|
||||||
|
* @param client Client index.
|
||||||
|
* @param customtag Reference to the custom clan tag buffer.
|
||||||
|
* @param customtaglength Max length of the customtag buffer.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
forward void Shavit_OnClanTagChangePost(int client, char[] customtag, int customtaglength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the game type the server is running.
|
* Returns the game type the server is running.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -81,6 +81,9 @@ enum struct color_t
|
|||||||
// game type (CS:S/CS:GO/TF2)
|
// game type (CS:S/CS:GO/TF2)
|
||||||
EngineVersion gEV_Type = Engine_Unknown;
|
EngineVersion gEV_Type = Engine_Unknown;
|
||||||
|
|
||||||
|
// forwards
|
||||||
|
Handle gH_Forwards_OnTopLeftHUD = null;
|
||||||
|
|
||||||
// modules
|
// modules
|
||||||
bool gB_Replay = false;
|
bool gB_Replay = false;
|
||||||
bool gB_Zones = false;
|
bool gB_Zones = false;
|
||||||
@ -133,6 +136,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
// forwards
|
||||||
|
gH_Forwards_OnTopLeftHUD = CreateGlobalForward("Shavit_OnTopLeftHUD", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Cell);
|
||||||
|
|
||||||
|
|
||||||
// natives
|
// natives
|
||||||
CreateNative("Shavit_ForceHUDUpdate", Native_ForceHUDUpdate);
|
CreateNative("Shavit_ForceHUDUpdate", Native_ForceHUDUpdate);
|
||||||
CreateNative("Shavit_GetHUDSettings", Native_GetHUDSettings);
|
CreateNative("Shavit_GetHUDSettings", Native_GetHUDSettings);
|
||||||
@ -1585,6 +1592,19 @@ void UpdateTopLeftHUD(int client, bool wait)
|
|||||||
Format(sTopLeft, 128, "%s\n%s (#%d)", sTopLeft, sSelfPB, Shavit_GetRankForTime(style, fSelfPB, track));
|
Format(sTopLeft, 128, "%s\n%s (#%d)", sTopLeft, sSelfPB, Shavit_GetRankForTime(style, fSelfPB, track));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action result = Plugin_Continue;
|
||||||
|
Call_StartForward(gH_Forwards_OnTopLeftHUD);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(target);
|
||||||
|
Call_PushStringEx(sTopLeft, 128, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||||
|
Call_PushCell(128);
|
||||||
|
Call_Finish(result);
|
||||||
|
|
||||||
|
if(result != Plugin_Continue && result != Plugin_Changed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetHudTextParams(0.01, 0.01, 2.5, 255, 255, 255, 255, 0, 0.0, 0.0, 0.0);
|
SetHudTextParams(0.01, 0.01, 2.5, 255, 255, 255, 255, 0, 0.0, 0.0, 0.0);
|
||||||
ShowSyncHudText(client, gH_HUD, "%s", sTopLeft);
|
ShowSyncHudText(client, gH_HUD, "%s", sTopLeft);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,6 +147,10 @@ ConVar gCV_SpectatorList = null;
|
|||||||
ConVar gCV_MaxCP = null;
|
ConVar gCV_MaxCP = null;
|
||||||
ConVar gCV_MaxCP_Segmented = null;
|
ConVar gCV_MaxCP_Segmented = null;
|
||||||
|
|
||||||
|
// forwards
|
||||||
|
Handle gH_Forwards_OnClanTagChangePre = null;
|
||||||
|
Handle gH_Forwards_OnClanTagChangePost = null;
|
||||||
|
|
||||||
// cached cvars
|
// cached cvars
|
||||||
int gI_HumanTeam = 0;
|
int gI_HumanTeam = 0;
|
||||||
|
|
||||||
@ -176,6 +180,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
// forwards
|
||||||
|
gH_Forwards_OnClanTagChangePre = CreateGlobalForward("Shavit_OnClanTagChangePre", ET_Event, Param_Cell, Param_String, Param_Cell);
|
||||||
|
gH_Forwards_OnClanTagChangePost = CreateGlobalForward("Shavit_OnClanTagChangePost", ET_Event, Param_Cell, Param_String, Param_Cell);
|
||||||
|
|
||||||
gB_Late = late;
|
gB_Late = late;
|
||||||
|
|
||||||
return APLRes_Success;
|
return APLRes_Success;
|
||||||
@ -888,7 +896,25 @@ void UpdateClanTag(int client)
|
|||||||
ReplaceString(sCustomTag, 32, "{tr}", sTrack);
|
ReplaceString(sCustomTag, 32, "{tr}", sTrack);
|
||||||
ReplaceString(sCustomTag, 32, "{rank}", sRank);
|
ReplaceString(sCustomTag, 32, "{rank}", sRank);
|
||||||
|
|
||||||
|
Action result = Plugin_Continue;
|
||||||
|
Call_StartForward(gH_Forwards_OnClanTagChangePre);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushStringEx(sTag, 32, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||||
|
Call_PushCell(32);
|
||||||
|
Call_Finish(result);
|
||||||
|
|
||||||
|
if(result != Plugin_Continue && result != Plugin_Changed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CS_SetClientClanTag(client, sCustomTag);
|
CS_SetClientClanTag(client, sCustomTag);
|
||||||
|
|
||||||
|
Call_StartForward(gH_Forwards_OnClanTagChangePost);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushStringEx(sCustomTag, 32, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||||
|
Call_PushCell(32);
|
||||||
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveRagdoll(int client)
|
void RemoveRagdoll(int client)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user