mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
only print the stage time message once per stage (#965)
* only print the stage time message once per stage * show stage message every time when segmenting * add missing Shavit_OnStageMessage forward include
This commit is contained in:
parent
41c0486035
commit
f69f761685
@ -734,6 +734,17 @@ forward void Shavit_OnEnterZone(int client, int type, int track, int id, int ent
|
||||
*/
|
||||
forward void Shavit_OnLeaveZone(int client, int type, int track, int id, int entity, int data);
|
||||
|
||||
/**
|
||||
* Called when a player leaves a zone.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param stageNumber Stage number.
|
||||
* @param message The stage time message that will be printed.
|
||||
* @param maxlen The buffer size of message.
|
||||
* @return Plugin_Handled to block the timer from printing msg to the client. Plugin_Continue to let the timer print msg.
|
||||
*/
|
||||
forward Action Shavit_OnStageMessage(int client, int stageNumber, char[] message, int maxlen);
|
||||
|
||||
/**
|
||||
* Called when a player gets the worst record in the server for the style.
|
||||
* Note: Will be only called for ranked styles.
|
||||
|
||||
@ -127,6 +127,7 @@ float gV_ZoneCenter[MAX_ZONES][3];
|
||||
int gI_StageZoneID[MAX_ZONES];
|
||||
int gI_EntityZone[4096];
|
||||
bool gB_ZonesCreated = false;
|
||||
int gI_LastStage[MAXPLAYERS+1];
|
||||
|
||||
char gS_BeamSprite[PLATFORM_MAX_PATH];
|
||||
int gI_BeamSprite = -1;
|
||||
@ -2741,6 +2742,8 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
||||
|
||||
public void Shavit_OnRestart(int client, int track)
|
||||
{
|
||||
gI_LastStage[client] = 0;
|
||||
|
||||
if(gCV_TeleportToStart.BoolValue)
|
||||
{
|
||||
int iIndex = -1;
|
||||
@ -2999,18 +3002,23 @@ public void StartTouchPost(int entity, int other)
|
||||
|
||||
case Zone_Stage:
|
||||
{
|
||||
if(status != Timer_Stopped && Shavit_GetClientTrack(other) == gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack)
|
||||
int num = gA_ZoneCache[gI_EntityZone[entity]].iZoneData;
|
||||
char special[sizeof(stylestrings_t::sSpecialString)];
|
||||
Shavit_GetStyleStrings(Shavit_GetBhopStyle(other), sSpecialString, special, sizeof(special));
|
||||
|
||||
if(status != Timer_Stopped && Shavit_GetClientTrack(other) == gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack && (num > gI_LastStage[other] || StrContains(special, "segments") != -1))
|
||||
{
|
||||
gI_LastStage[other] = num;
|
||||
char sTime[32];
|
||||
FormatSeconds(Shavit_GetClientTime(other), sTime, 32, true);
|
||||
|
||||
char sMessage[255];
|
||||
FormatEx(sMessage, 255, "%T", "ZoneStageEnter", other, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, gA_ZoneCache[gI_EntityZone[entity]].iZoneData, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, sTime, gS_ChatStrings.sText);
|
||||
FormatEx(sMessage, 255, "%T", "ZoneStageEnter", other, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, num, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, sTime, gS_ChatStrings.sText);
|
||||
|
||||
Action aResult = Plugin_Continue;
|
||||
Call_StartForward(gH_Forwards_StageMessage);
|
||||
Call_PushCell(other);
|
||||
Call_PushCell(gA_ZoneCache[gI_EntityZone[entity]].iZoneData);
|
||||
Call_PushCell(num);
|
||||
Call_PushStringEx(sMessage, 255, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||
Call_PushCell(255);
|
||||
Call_Finish(aResult);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user