mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Barebones bonus timer.
This commit is contained in:
parent
b236cb3093
commit
67caaf8d07
@ -1,64 +0,0 @@
|
|||||||
#if defined _chat_processor_included
|
|
||||||
#endinput
|
|
||||||
#endif
|
|
||||||
#define _chat_processor_included
|
|
||||||
|
|
||||||
//Globals
|
|
||||||
#define MAXLENGTH_INPUT 128
|
|
||||||
#define MAXLENGTH_NAME 64
|
|
||||||
#define MAXLENGTH_MESSAGE 256
|
|
||||||
|
|
||||||
enum eChatFlags
|
|
||||||
{
|
|
||||||
ChatFlag_Invalid,
|
|
||||||
ChatFlag_All,
|
|
||||||
ChatFlag_Team,
|
|
||||||
ChatFlag_Spec,
|
|
||||||
ChatFlag_Dead
|
|
||||||
}
|
|
||||||
|
|
||||||
//Forwards
|
|
||||||
/**
|
|
||||||
* Called while sending a chat message before It's sent.
|
|
||||||
* Limits on the name and message strings can be found above.
|
|
||||||
*
|
|
||||||
* param author Author that created the message.
|
|
||||||
* param recipients Array of clients who will receive the message.
|
|
||||||
* param flag Determines which type of message is being sent.
|
|
||||||
* param name Name string of the author to be pushed.
|
|
||||||
* param message Message string from the author to be pushed.
|
|
||||||
*
|
|
||||||
* return types
|
|
||||||
* - Plugin_Continue Stops the message.
|
|
||||||
* - Plugin_Stop Stops the message.
|
|
||||||
* - Plugin_Changed Fires the post-forward below and prints out a message.
|
|
||||||
* - Plugin_Handled Fires the post-forward below but doesn't print a message.
|
|
||||||
**/
|
|
||||||
forward Action OnChatMessage(int& author, ArrayList recipients, eChatFlags& flag, char[] name, char[] message, bool& bProcessColors, bool& bRemoveColors);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called after the chat message is sent to the designated clients by the author.
|
|
||||||
*
|
|
||||||
* param author Author that sent the message.
|
|
||||||
* param recipients Array of clients who received the message.
|
|
||||||
* param flag Determines which type of message was sent.
|
|
||||||
* param name Name string of the author.
|
|
||||||
* param message Message string from the author.
|
|
||||||
*
|
|
||||||
* noreturn
|
|
||||||
**/
|
|
||||||
forward void OnChatMessagePost(int author, ArrayList recipients, eChatFlags flag, const char[] name, const char[] message, bool bProcessColors, bool bRemoveColors);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Shared plugin information
|
|
||||||
**/
|
|
||||||
public SharedPlugin _pl_chat_processor =
|
|
||||||
{
|
|
||||||
name = "chat-processor",
|
|
||||||
file = "chat-processor.smx",
|
|
||||||
#if defined REQUIRE_PLUGIN
|
|
||||||
required = 1
|
|
||||||
#else
|
|
||||||
required = 0
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
// code by alongub https://github.com/alongubkin/
|
|
||||||
|
|
||||||
#if defined _rtler_included
|
|
||||||
#endinput
|
|
||||||
#endif
|
|
||||||
#define _rtler_included
|
|
||||||
|
|
||||||
#pragma semicolon 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a string that contains words in RTL languages to be displayed correctly in-game.
|
|
||||||
*
|
|
||||||
* @param dest Destination string buffer to copy the RTL-ed string to.
|
|
||||||
* @param destLen Destination buffer length (includes null terminator).
|
|
||||||
* @param original Original non-rtled string.
|
|
||||||
*
|
|
||||||
* @return The amount of words that needed RTLifying.
|
|
||||||
*/
|
|
||||||
native int RTLify(char[] dest, int destLen, const char[] original);
|
|
||||||
|
|
||||||
public SharedPlugin __pl_rtler =
|
|
||||||
{
|
|
||||||
name = "rtler",
|
|
||||||
file = "rtler.smx",
|
|
||||||
#if defined REQUIRE_PLUGIN
|
|
||||||
required = 1,
|
|
||||||
#else
|
|
||||||
required = 0,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
public void __pl_rtler_SetNTVOptional()
|
|
||||||
{
|
|
||||||
MarkNativeAsOptional("RTLify");
|
|
||||||
}
|
|
||||||
@ -138,6 +138,7 @@ enum
|
|||||||
iGoodGains,
|
iGoodGains,
|
||||||
fServerTime,
|
fServerTime,
|
||||||
iSHSWCombination,
|
iSHSWCombination,
|
||||||
|
iTimerTrack,
|
||||||
TIMERSNAPSHOT_SIZE
|
TIMERSNAPSHOT_SIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -282,42 +283,47 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
|
|||||||
* @param vel A vector that contain's the player's desired movement. vel[0] is forwardmove, vel[1] is sidemove.
|
* @param vel A vector that contain's the player's desired movement. vel[0] is forwardmove, vel[1] is sidemove.
|
||||||
* @param angles The player's requested viewangles. They will not necessarily be applied as SRCDS itself won't accept every value.
|
* @param angles The player's requested viewangles. They will not necessarily be applied as SRCDS itself won't accept every value.
|
||||||
* @param status The player's timer status.
|
* @param status The player's timer status.
|
||||||
|
* @param track The player's timer track.
|
||||||
* @return Plugin_Continue to let shavit-core keep doing what it does, Plugin_Changed to pass different values.
|
* @return Plugin_Continue to let shavit-core keep doing what it does, Plugin_Changed to pass different values.
|
||||||
*/
|
*/
|
||||||
forward Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status);
|
forward Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player's timer starts.
|
* Called when a player's timer starts.
|
||||||
* (WARNING: Will be called every tick when the player stands at the start zone!)
|
* (WARNING: Will be called every tick when the player stands at the start zone!)
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @return Plugin_Continue to do nothing or anything else to not start the timer.
|
* @return Plugin_Continue to do nothing or anything else to not start the timer.
|
||||||
*/
|
*/
|
||||||
forward Action Shavit_OnStart(int client);
|
forward Action Shavit_OnStart(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player uses the restart command.
|
* Called when a player uses the restart command.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnRestart(int client);
|
forward void Shavit_OnRestart(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player uses the !end command.
|
* Called when a player uses the !end command.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnEnd(int client);
|
forward void Shavit_OnEnd(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player's timer stops. (stop =/= finish a map)
|
* Called when a player's timer stops. (stop =/= finish a map)
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnStop(int client);
|
forward void Shavit_OnStop(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a player finishes a map.
|
* Called before a player finishes a map.
|
||||||
@ -337,9 +343,10 @@ forward Action Shavit_OnFinishPre(int client, any snapshot[TIMERSNAPSHOT_SIZE]);
|
|||||||
* @param jumps Jumps amount.
|
* @param jumps Jumps amount.
|
||||||
* @param strafes Amount of strafes.
|
* @param strafes Amount of strafes.
|
||||||
* @param sync Sync percentage (0.0 to 100.0) or -1.0 when not measured.
|
* @param sync Sync percentage (0.0 to 100.0) or -1.0 when not measured.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync);
|
forward void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like Shavit_OnFinish, but after the insertion query was called.
|
* Like Shavit_OnFinish, but after the insertion query was called.
|
||||||
@ -366,9 +373,10 @@ forward void Shavit_OnFinish_Post(int client, int style, float time, int jumps,
|
|||||||
* @param jumps Jumps amount.
|
* @param jumps Jumps amount.
|
||||||
* @param strafes Amount of strafes.
|
* @param strafes Amount of strafes.
|
||||||
* @param sync Sync percentage (0.0 to 100.0) or -1.0 when not measured.
|
* @param sync Sync percentage (0.0 to 100.0) or -1.0 when not measured.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int strafes, float sync);
|
forward void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int strafes, float sync, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an admin deletes a WR.
|
* Called when an admin deletes a WR.
|
||||||
@ -383,17 +391,19 @@ forward void Shavit_OnWRDeleted(int style, int id);
|
|||||||
* Called when a player's timer paused.
|
* Called when a player's timer paused.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnPause(int client);
|
forward void Shavit_OnPause(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player's timer resumed.
|
* Called when a player's timer resumed.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnResume(int client);
|
forward void Shavit_OnResume(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player's rank has updated or was just looked up.
|
* Called when a player's rank has updated or was just looked up.
|
||||||
@ -410,9 +420,10 @@ forward void Shavit_OnRankUpdated(int client);
|
|||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
* @param oldstyle Old bhop style.
|
* @param oldstyle Old bhop style.
|
||||||
* @param newstyle New bhop style.
|
* @param newstyle New bhop style.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
forward void Shavit_OnStyleChanged(int client, int oldstyle, int newstyle);
|
forward void Shavit_OnStyleChanged(int client, int oldstyle, int newstyle, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the styles configuration finishes loading and it's ready to load everything into the cache.
|
* Called when the styles configuration finishes loading and it's ready to load everything into the cache.
|
||||||
@ -496,18 +507,20 @@ native void Shavit_GetDB(Database &hSQL);
|
|||||||
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
|
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
native void Shavit_StartTimer(int client);
|
native void Shavit_StartTimer(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restarts the timer for a player.
|
* Restarts the timer for a player.
|
||||||
* Will work as if the player just used sm_r.
|
* Will work as if the player just used sm_r.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
native void Shavit_RestartTimer(int client);
|
native void Shavit_RestartTimer(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the timer for a player.
|
* Stops the timer for a player.
|
||||||
@ -523,9 +536,10 @@ native void Shavit_StopTimer(int client);
|
|||||||
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
|
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
|
||||||
*
|
*
|
||||||
* @param client Client index.
|
* @param client Client index.
|
||||||
|
* @param track Timer track.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
native void Shavit_FinishMap(int client);
|
native void Shavit_FinishMap(int client, int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the player's timer stats on variables
|
* Stores the player's timer stats on variables
|
||||||
@ -537,6 +551,7 @@ native void Shavit_FinishMap(int client);
|
|||||||
* @param started Timer started?
|
* @param started Timer started?
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
|
#pragma deprecated Use different natives or Shavit_SaveSnapshot instead.
|
||||||
native void Shavit_GetTimer(int client, float &time, int &jumps, int &style, bool &started);
|
native void Shavit_GetTimer(int client, float &time, int &jumps, int &style, bool &started);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -547,6 +562,14 @@ native void Shavit_GetTimer(int client, float &time, int &jumps, int &style, boo
|
|||||||
*/
|
*/
|
||||||
native float Shavit_GetClientTime(int client);
|
native float Shavit_GetClientTime(int client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the client's track. (Track_Main/Track_Bonus etc..)
|
||||||
|
*
|
||||||
|
* @param client Client index.
|
||||||
|
* @return Timer track.
|
||||||
|
*/
|
||||||
|
native int Shavit_GetClientTrack(int client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve client jumps since timer start.
|
* Retrieve client jumps since timer start.
|
||||||
*
|
*
|
||||||
@ -930,6 +953,7 @@ public void __pl_shavit_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("Shavit_GetChatStrings");
|
MarkNativeAsOptional("Shavit_GetChatStrings");
|
||||||
MarkNativeAsOptional("Shavit_GetClientJumps");
|
MarkNativeAsOptional("Shavit_GetClientJumps");
|
||||||
MarkNativeAsOptional("Shavit_GetClientTime");
|
MarkNativeAsOptional("Shavit_GetClientTime");
|
||||||
|
MarkNativeAsOptional("Shavit_GetClientTrack");
|
||||||
MarkNativeAsOptional("Shavit_GetHUDSettings");
|
MarkNativeAsOptional("Shavit_GetHUDSettings");
|
||||||
MarkNativeAsOptional("Shavit_GetPlayerPB");
|
MarkNativeAsOptional("Shavit_GetPlayerPB");
|
||||||
MarkNativeAsOptional("Shavit_GetPoints");
|
MarkNativeAsOptional("Shavit_GetPoints");
|
||||||
|
|||||||
@ -76,6 +76,7 @@ bool gB_DoubleSteps[MAXPLAYERS+1];
|
|||||||
float gF_StrafeWarning[MAXPLAYERS+1];
|
float gF_StrafeWarning[MAXPLAYERS+1];
|
||||||
bool gB_PracticeMode[MAXPLAYERS+1];
|
bool gB_PracticeMode[MAXPLAYERS+1];
|
||||||
int gI_SHSW_FirstCombination[MAXPLAYERS+1];
|
int gI_SHSW_FirstCombination[MAXPLAYERS+1];
|
||||||
|
int gI_Track[MAXPLAYERS+1];
|
||||||
|
|
||||||
float gF_HSW_Requirement = 0.0;
|
float gF_HSW_Requirement = 0.0;
|
||||||
StringMap gSM_StyleCommands = null;
|
StringMap gSM_StyleCommands = null;
|
||||||
@ -149,28 +150,29 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
CreateNative("Shavit_GetDB", Native_GetDB);
|
CreateNative("Shavit_GetDB", Native_GetDB);
|
||||||
|
|
||||||
// timer natives
|
// timer natives
|
||||||
CreateNative("Shavit_StartTimer", Native_StartTimer);
|
|
||||||
CreateNative("Shavit_StopTimer", Native_StopTimer);
|
|
||||||
CreateNative("Shavit_FinishMap", Native_FinishMap);
|
CreateNative("Shavit_FinishMap", Native_FinishMap);
|
||||||
CreateNative("Shavit_GetTimer", Native_GetTimer);
|
|
||||||
CreateNative("Shavit_GetClientTime", Native_GetClientTime);
|
|
||||||
CreateNative("Shavit_GetClientJumps", Native_GetClientJumps);
|
|
||||||
CreateNative("Shavit_GetBhopStyle", Native_GetBhopStyle);
|
CreateNative("Shavit_GetBhopStyle", Native_GetBhopStyle);
|
||||||
CreateNative("Shavit_GetTimerStatus", Native_GetTimerStatus);
|
CreateNative("Shavit_GetChatStrings", Native_GetChatStrings);
|
||||||
CreateNative("Shavit_PauseTimer", Native_PauseTimer);
|
CreateNative("Shavit_GetClientJumps", Native_GetClientJumps);
|
||||||
CreateNative("Shavit_ResumeTimer", Native_ResumeTimer);
|
CreateNative("Shavit_GetClientTime", Native_GetClientTime);
|
||||||
CreateNative("Shavit_PrintToChat", Native_PrintToChat);
|
CreateNative("Shavit_GetClientTrack", Native_GetClientTrack);
|
||||||
CreateNative("Shavit_RestartTimer", Native_RestartTimer);
|
|
||||||
CreateNative("Shavit_GetStrafeCount", Native_GetStrafeCount);
|
CreateNative("Shavit_GetStrafeCount", Native_GetStrafeCount);
|
||||||
CreateNative("Shavit_GetSync", Native_GetSync);
|
|
||||||
CreateNative("Shavit_GetStyleCount", Native_GetStyleCount);
|
CreateNative("Shavit_GetStyleCount", Native_GetStyleCount);
|
||||||
CreateNative("Shavit_GetStyleSettings", Native_GetStyleSettings);
|
CreateNative("Shavit_GetStyleSettings", Native_GetStyleSettings);
|
||||||
CreateNative("Shavit_GetStyleStrings", Native_GetStyleStrings);
|
CreateNative("Shavit_GetStyleStrings", Native_GetStyleStrings);
|
||||||
CreateNative("Shavit_GetChatStrings", Native_GetChatStrings);
|
CreateNative("Shavit_GetSync", Native_GetSync);
|
||||||
CreateNative("Shavit_SetPracticeMode", Native_SetPracticeMode);
|
CreateNative("Shavit_GetTimer", Native_GetTimer);
|
||||||
|
CreateNative("Shavit_GetTimerStatus", Native_GetTimerStatus);
|
||||||
CreateNative("Shavit_IsPracticeMode", Native_IsPracticeMode);
|
CreateNative("Shavit_IsPracticeMode", Native_IsPracticeMode);
|
||||||
CreateNative("Shavit_SaveSnapshot", Native_SaveSnapshot);
|
|
||||||
CreateNative("Shavit_LoadSnapshot", Native_LoadSnapshot);
|
CreateNative("Shavit_LoadSnapshot", Native_LoadSnapshot);
|
||||||
|
CreateNative("Shavit_PauseTimer", Native_PauseTimer);
|
||||||
|
CreateNative("Shavit_PrintToChat", Native_PrintToChat);
|
||||||
|
CreateNative("Shavit_RestartTimer", Native_RestartTimer);
|
||||||
|
CreateNative("Shavit_ResumeTimer", Native_ResumeTimer);
|
||||||
|
CreateNative("Shavit_SaveSnapshot", Native_SaveSnapshot);
|
||||||
|
CreateNative("Shavit_SetPracticeMode", Native_SetPracticeMode);
|
||||||
|
CreateNative("Shavit_StartTimer", Native_StartTimer);
|
||||||
|
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
|
||||||
RegPluginLibrary("shavit");
|
RegPluginLibrary("shavit");
|
||||||
@ -183,19 +185,19 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
// forwards
|
// forwards
|
||||||
gH_Forwards_Start = CreateGlobalForward("Shavit_OnStart", ET_Event, Param_Cell);
|
gH_Forwards_Start = CreateGlobalForward("Shavit_OnStart", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_Stop = CreateGlobalForward("Shavit_OnStop", ET_Event, Param_Cell);
|
gH_Forwards_Stop = CreateGlobalForward("Shavit_OnStop", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_FinishPre = CreateGlobalForward("Shavit_OnFinishPre", ET_Event, Param_Cell, Param_Array);
|
gH_Forwards_FinishPre = CreateGlobalForward("Shavit_OnFinishPre", ET_Event, Param_Cell, Param_Array);
|
||||||
gH_Forwards_Finish = CreateGlobalForward("Shavit_OnFinish", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
gH_Forwards_Finish = CreateGlobalForward("Shavit_OnFinish", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnRestart = CreateGlobalForward("Shavit_OnRestart", ET_Event, Param_Cell);
|
gH_Forwards_OnRestart = CreateGlobalForward("Shavit_OnRestart", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnEnd = CreateGlobalForward("Shavit_OnEnd", ET_Event, Param_Cell);
|
gH_Forwards_OnEnd = CreateGlobalForward("Shavit_OnEnd", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnPause = CreateGlobalForward("Shavit_OnPause", ET_Event, Param_Cell);
|
gH_Forwards_OnPause = CreateGlobalForward("Shavit_OnPause", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnResume = CreateGlobalForward("Shavit_OnResume", ET_Event, Param_Cell);
|
gH_Forwards_OnResume = CreateGlobalForward("Shavit_OnResume", ET_Event, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnStyleChanged = CreateGlobalForward("Shavit_OnStyleChanged", ET_Event, Param_Cell, Param_Cell, Param_Cell);
|
gH_Forwards_OnStyleChanged = CreateGlobalForward("Shavit_OnStyleChanged", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
gH_Forwards_OnStyleConfigLoaded = CreateGlobalForward("Shavit_OnStyleConfigLoaded", ET_Event, Param_Cell);
|
gH_Forwards_OnStyleConfigLoaded = CreateGlobalForward("Shavit_OnStyleConfigLoaded", ET_Event, Param_Cell);
|
||||||
gH_Forwards_OnDatabaseLoaded = CreateGlobalForward("Shavit_OnDatabaseLoaded", ET_Event, Param_Cell);
|
gH_Forwards_OnDatabaseLoaded = CreateGlobalForward("Shavit_OnDatabaseLoaded", ET_Event, Param_Cell);
|
||||||
gH_Forwards_OnChatConfigLoaded = CreateGlobalForward("Shavit_OnChatConfigLoaded", ET_Event);
|
gH_Forwards_OnChatConfigLoaded = CreateGlobalForward("Shavit_OnChatConfigLoaded", ET_Event);
|
||||||
gH_Forwards_OnUserCmdPre = CreateGlobalForward("Shavit_OnUserCmdPre", ET_Event, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_Cell);
|
gH_Forwards_OnUserCmdPre = CreateGlobalForward("Shavit_OnUserCmdPre", ET_Event, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_Cell, Param_Cell);
|
||||||
|
|
||||||
LoadTranslations("shavit-core.phrases");
|
LoadTranslations("shavit-core.phrases");
|
||||||
|
|
||||||
@ -246,8 +248,13 @@ public void OnPluginStart()
|
|||||||
RegConsoleCmd("sm_r", Command_StartTimer, "Start your timer.");
|
RegConsoleCmd("sm_r", Command_StartTimer, "Start your timer.");
|
||||||
RegConsoleCmd("sm_restart", Command_StartTimer, "Start your timer.");
|
RegConsoleCmd("sm_restart", Command_StartTimer, "Start your timer.");
|
||||||
|
|
||||||
|
RegConsoleCmd("sm_b", Command_StartTimer_Bonus, "Start your timer on the bonus track.");
|
||||||
|
RegConsoleCmd("sm_bonus", Command_StartTimer_Bonus, "Start your timer on the bonus track.");
|
||||||
|
|
||||||
// teleport to end
|
// teleport to end
|
||||||
RegConsoleCmd("sm_end", Command_TeleportEnd, "Teleport to endzone.");
|
RegConsoleCmd("sm_end", Command_TeleportEnd, "Teleport to endzone.");
|
||||||
|
RegConsoleCmd("sm_bend", Command_TeleportEnd_Bonus, "Teleport to endzone of the bonus track.");
|
||||||
|
RegConsoleCmd("sm_bonusend", Command_TeleportEnd_Bonus, "Teleport to endzone of the bonus track.");
|
||||||
|
|
||||||
// timer stop
|
// timer stop
|
||||||
RegConsoleCmd("sm_stop", Command_StopTimer, "Stop your timer.");
|
RegConsoleCmd("sm_stop", Command_StopTimer, "Stop your timer.");
|
||||||
@ -444,9 +451,48 @@ public Action Command_StartTimer(int client, int args)
|
|||||||
{
|
{
|
||||||
Call_StartForward(gH_Forwards_OnRestart);
|
Call_StartForward(gH_Forwards_OnRestart);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(Track_Main);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
|
|
||||||
StartTimer(client);
|
StartTimer(client, Track_Main);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shavit_PrintToChat(client, "%T", "StartZoneUndefined", client, gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Command_StartTimer_Bonus(int client, int args)
|
||||||
|
{
|
||||||
|
if(!IsValidClient(client))
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!gB_Restart)
|
||||||
|
{
|
||||||
|
if(args != -1)
|
||||||
|
{
|
||||||
|
char[] sCommand = new char[16];
|
||||||
|
GetCmdArg(0, sCommand, 16);
|
||||||
|
|
||||||
|
Shavit_PrintToChat(client, "%T", "CommandDisabled", client, gS_ChatStrings[sMessageVariable], sCommand, gS_ChatStrings[sMessageText]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gB_AllowTimerWithoutZone || (gB_Zones && Shavit_ZoneExists(Zone_Start, Track_Bonus)))
|
||||||
|
{
|
||||||
|
Call_StartForward(gH_Forwards_OnRestart);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(Track_Bonus);
|
||||||
|
Call_Finish();
|
||||||
|
|
||||||
|
StartTimer(client, Track_Bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -470,6 +516,32 @@ public Action Command_TeleportEnd(int client, int args)
|
|||||||
|
|
||||||
Call_StartForward(gH_Forwards_OnEnd);
|
Call_StartForward(gH_Forwards_OnEnd);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(Track_Main); // sm_bend will be bonus end
|
||||||
|
Call_Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shavit_PrintToChat(client, "%T", "EndZoneUndefined", client, gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Command_TeleportEnd_Bonus(int client, int args)
|
||||||
|
{
|
||||||
|
if(!IsValidClient(client))
|
||||||
|
{
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gB_Zones && Shavit_ZoneExists(Zone_End, Track_Bonus))
|
||||||
|
{
|
||||||
|
Shavit_StopTimer(client);
|
||||||
|
|
||||||
|
Call_StartForward(gH_Forwards_OnEnd);
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(Track_Bonus);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,6 +762,7 @@ void ChangeClientStyle(int client, int style)
|
|||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
Call_PushCell(gBS_Style[client]);
|
Call_PushCell(gBS_Style[client]);
|
||||||
Call_PushCell(style);
|
Call_PushCell(style);
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
|
|
||||||
gBS_Style[client] = style;
|
gBS_Style[client] = style;
|
||||||
@ -708,6 +781,7 @@ void ChangeClientStyle(int client, int style)
|
|||||||
{
|
{
|
||||||
Call_StartForward(gH_Forwards_OnRestart);
|
Call_StartForward(gH_Forwards_OnRestart);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,11 +929,12 @@ public int Native_GetTimer(Handle handler, int numParams)
|
|||||||
|
|
||||||
public int Native_GetClientTime(Handle handler, int numParams)
|
public int Native_GetClientTime(Handle handler, int numParams)
|
||||||
{
|
{
|
||||||
// 1 - client
|
return view_as<int>(CalculateTime(GetNativeCell(1)));
|
||||||
int client = GetNativeCell(1);
|
}
|
||||||
|
|
||||||
// 2 - time
|
public int Native_GetClientTrack(Handle handler, int numParams)
|
||||||
return view_as<int>(CalculateTime(client));
|
{
|
||||||
|
return gI_Track[GetNativeCell(1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Native_GetClientJumps(Handle handler, int numParams)
|
public int Native_GetClientJumps(Handle handler, int numParams)
|
||||||
@ -879,7 +954,7 @@ public int Native_GetTimerStatus(Handle handler, int numParams)
|
|||||||
|
|
||||||
public int Native_StartTimer(Handle handler, int numParams)
|
public int Native_StartTimer(Handle handler, int numParams)
|
||||||
{
|
{
|
||||||
StartTimer(GetNativeCell(1));
|
StartTimer(GetNativeCell(1), GetNativeCell(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Native_StopTimer(Handle handler, int numParams)
|
public int Native_StopTimer(Handle handler, int numParams)
|
||||||
@ -890,6 +965,7 @@ public int Native_StopTimer(Handle handler, int numParams)
|
|||||||
|
|
||||||
Call_StartForward(gH_Forwards_Stop);
|
Call_StartForward(gH_Forwards_Stop);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,6 +986,8 @@ public int Native_FinishMap(Handle handler, int numParams)
|
|||||||
snapshot[iGoodGains] = gI_GoodGains[client];
|
snapshot[iGoodGains] = gI_GoodGains[client];
|
||||||
snapshot[fServerTime] = GetEngineTime();
|
snapshot[fServerTime] = GetEngineTime();
|
||||||
snapshot[fCurrentTime] = CalculateTime(client);
|
snapshot[fCurrentTime] = CalculateTime(client);
|
||||||
|
snapshot[iSHSWCombination] = gI_SHSW_FirstCombination[client];
|
||||||
|
snapshot[iTimerTrack] = gI_Track[client];
|
||||||
|
|
||||||
Action result = Plugin_Continue;
|
Action result = Plugin_Continue;
|
||||||
Call_StartForward(gH_Forwards_FinishPre);
|
Call_StartForward(gH_Forwards_FinishPre);
|
||||||
@ -943,6 +1021,7 @@ public int Native_FinishMap(Handle handler, int numParams)
|
|||||||
Call_PushCell((gA_StyleSettings[snapshot[bsStyle]][bSync])? (snapshot[iGoodGains] == 0)? 0.0:(snapshot[iGoodGains] / float(snapshot[iTotalMeasures]) * 100.0):-1.0);
|
Call_PushCell((gA_StyleSettings[snapshot[bsStyle]][bSync])? (snapshot[iGoodGains] == 0)? 0.0:(snapshot[iGoodGains] / float(snapshot[iTotalMeasures]) * 100.0):-1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
|
|
||||||
StopTimer(client);
|
StopTimer(client);
|
||||||
@ -990,12 +1069,14 @@ public int Native_PrintToChat(Handle handler, int numParams)
|
|||||||
public int Native_RestartTimer(Handle handler, int numParams)
|
public int Native_RestartTimer(Handle handler, int numParams)
|
||||||
{
|
{
|
||||||
int client = GetNativeCell(1);
|
int client = GetNativeCell(1);
|
||||||
|
int track = GetNativeCell(2);
|
||||||
|
|
||||||
Call_StartForward(gH_Forwards_OnRestart);
|
Call_StartForward(gH_Forwards_OnRestart);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(track);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
|
|
||||||
StartTimer(client);
|
StartTimer(client, track);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Native_GetStrafeCount(Handle handler, int numParams)
|
public int Native_GetStrafeCount(Handle handler, int numParams)
|
||||||
@ -1067,6 +1148,7 @@ public int Native_SaveSnapshot(Handle handler, int numParams)
|
|||||||
snapshot[fServerTime] = GetEngineTime();
|
snapshot[fServerTime] = GetEngineTime();
|
||||||
snapshot[fCurrentTime] = CalculateTime(client);
|
snapshot[fCurrentTime] = CalculateTime(client);
|
||||||
snapshot[iSHSWCombination] = gI_SHSW_FirstCombination[client];
|
snapshot[iSHSWCombination] = gI_SHSW_FirstCombination[client];
|
||||||
|
snapshot[iTimerTrack] = gI_Track[client];
|
||||||
|
|
||||||
return SetNativeArray(2, snapshot, TIMERSNAPSHOT_SIZE);
|
return SetNativeArray(2, snapshot, TIMERSNAPSHOT_SIZE);
|
||||||
}
|
}
|
||||||
@ -1089,6 +1171,7 @@ public int Native_LoadSnapshot(Handle handler, int numParams)
|
|||||||
gI_GoodGains[client] = view_as<int>(snapshot[iGoodGains]);
|
gI_GoodGains[client] = view_as<int>(snapshot[iGoodGains]);
|
||||||
gF_StartTime[client] = GetEngineTime() - view_as<float>(snapshot[fCurrentTime]);
|
gF_StartTime[client] = GetEngineTime() - view_as<float>(snapshot[fCurrentTime]);
|
||||||
gI_SHSW_FirstCombination[client] = view_as<int>(snapshot[iSHSWCombination]);
|
gI_SHSW_FirstCombination[client] = view_as<int>(snapshot[iSHSWCombination]);
|
||||||
|
gI_Track[client] = view_as<int>(snapshot[iTimerTrack]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetTimerStatus(int client)
|
int GetTimerStatus(int client)
|
||||||
@ -1106,7 +1189,7 @@ int GetTimerStatus(int client)
|
|||||||
return view_as<int>(Timer_Running);
|
return view_as<int>(Timer_Running);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartTimer(int client)
|
void StartTimer(int client, int track)
|
||||||
{
|
{
|
||||||
if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client))
|
if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client))
|
||||||
{
|
{
|
||||||
@ -1123,10 +1206,12 @@ void StartTimer(int client)
|
|||||||
gI_TotalMeasures[client] = 0;
|
gI_TotalMeasures[client] = 0;
|
||||||
gI_GoodGains[client] = 0;
|
gI_GoodGains[client] = 0;
|
||||||
gF_StartTime[client] = GetEngineTime();
|
gF_StartTime[client] = GetEngineTime();
|
||||||
|
gI_Track[client] = track;
|
||||||
|
|
||||||
Action result = Plugin_Continue;
|
Action result = Plugin_Continue;
|
||||||
Call_StartForward(gH_Forwards_Start);
|
Call_StartForward(gH_Forwards_Start);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(track);
|
||||||
Call_Finish(result);
|
Call_Finish(result);
|
||||||
|
|
||||||
if(result == Plugin_Continue)
|
if(result == Plugin_Continue)
|
||||||
@ -1178,6 +1263,7 @@ void PauseTimer(int client)
|
|||||||
|
|
||||||
Call_StartForward(gH_Forwards_OnPause);
|
Call_StartForward(gH_Forwards_OnPause);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,6 +1279,7 @@ void ResumeTimer(int client)
|
|||||||
|
|
||||||
Call_StartForward(gH_Forwards_OnResume);
|
Call_StartForward(gH_Forwards_OnResume);
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish();
|
Call_Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,6 +1353,7 @@ public void OnClientPutInServer(int client)
|
|||||||
gBS_Style[client] = 0;
|
gBS_Style[client] = 0;
|
||||||
gB_PracticeMode[client] = false;
|
gB_PracticeMode[client] = false;
|
||||||
gI_SHSW_FirstCombination[client] = -1;
|
gI_SHSW_FirstCombination[client] = -1;
|
||||||
|
gI_Track[client] = 0;
|
||||||
UpdateAutoBhop(client);
|
UpdateAutoBhop(client);
|
||||||
|
|
||||||
if(AreClientCookiesCached(client))
|
if(AreClientCookiesCached(client))
|
||||||
@ -1639,6 +1727,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
|||||||
Call_PushArrayEx(vel, 3, SM_PARAM_COPYBACK);
|
Call_PushArrayEx(vel, 3, SM_PARAM_COPYBACK);
|
||||||
Call_PushArrayEx(angles, 3, SM_PARAM_COPYBACK);
|
Call_PushArrayEx(angles, 3, SM_PARAM_COPYBACK);
|
||||||
Call_PushCell(GetTimerStatus(client));
|
Call_PushCell(GetTimerStatus(client));
|
||||||
|
Call_PushCell(gI_Track[client]);
|
||||||
Call_Finish(result);
|
Call_Finish(result);
|
||||||
|
|
||||||
if(result != Plugin_Continue && result != Plugin_Changed)
|
if(result != Plugin_Continue && result != Plugin_Changed)
|
||||||
|
|||||||
@ -92,6 +92,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
|
LoadTranslations("shavit-common.phrases");
|
||||||
LoadTranslations("shavit-hud.phrases");
|
LoadTranslations("shavit-hud.phrases");
|
||||||
|
|
||||||
// game-specific
|
// game-specific
|
||||||
@ -659,6 +660,17 @@ void UpdateHUD(int client)
|
|||||||
{
|
{
|
||||||
FormatEx(sHintText, 16, "%T", "HudPaused", client);
|
FormatEx(sHintText, 16, "%T", "HudPaused", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: If you're contributing a CS:GO version of the track part in the HUD, make sure to move this up somewhere so it's visible by both the CS:S/CS:GO scopes.
|
||||||
|
int track = Shavit_GetClientTrack(target);
|
||||||
|
|
||||||
|
if(track != Track_Main)
|
||||||
|
{
|
||||||
|
char[] sTrack = new char[32];
|
||||||
|
GetTrackName(client, track, sTrack, 32);
|
||||||
|
|
||||||
|
Format(sHintText, 512, "%s\n%s", sHintText, sTrack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -1081,3 +1093,17 @@ public int Native_GetHUDSettings(Handle handler, int numParams)
|
|||||||
|
|
||||||
return gI_HUDSettings[client];
|
return gI_HUDSettings[client];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetTrackName(int client, int track, char[] output, int size)
|
||||||
|
{
|
||||||
|
if(track < 0 || track >= TRACKS_SIZE)
|
||||||
|
{
|
||||||
|
FormatEx(output, size, "%T", "Track_Unknown", client);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char sTrack[16];
|
||||||
|
FormatEx(sTrack, 16, "Track_%d", track);
|
||||||
|
FormatEx(output, size, "%T", sTrack, client);
|
||||||
|
}
|
||||||
|
|||||||
@ -176,6 +176,7 @@ public void OnAllPluginsLoaded()
|
|||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
|
LoadTranslations("shavit-common.phrases");
|
||||||
LoadTranslations("shavit-misc.phrases");
|
LoadTranslations("shavit-misc.phrases");
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
@ -790,7 +791,7 @@ void RemoveRagdoll(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status)
|
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track)
|
||||||
{
|
{
|
||||||
bool bNoclip = (GetEntityMoveType(client) == MOVETYPE_NOCLIP);
|
bool bNoclip = (GetEntityMoveType(client) == MOVETYPE_NOCLIP);
|
||||||
|
|
||||||
@ -802,7 +803,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
|||||||
int iGroundEntity = GetEntPropEnt(client, Prop_Send, "m_hGroundEntity");
|
int iGroundEntity = GetEntPropEnt(client, Prop_Send, "m_hGroundEntity");
|
||||||
|
|
||||||
// prespeed
|
// prespeed
|
||||||
if(!gA_StyleSettings[gBS_Style[client]][bPrespeed] && Shavit_InsideZone(client, Zone_Start, -1))
|
if(!gA_StyleSettings[gBS_Style[client]][bPrespeed] && Shavit_InsideZone(client, Zone_Start, track))
|
||||||
{
|
{
|
||||||
if((gI_PreSpeed == 2 || gI_PreSpeed == 3) && gI_GroundEntity[client] == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
|
if((gI_PreSpeed == 2 || gI_PreSpeed == 3) && gI_GroundEntity[client] == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
|
||||||
{
|
{
|
||||||
@ -1680,7 +1681,21 @@ public Action Shavit_OnStart(int client)
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps)
|
void GetTrackName(int client, int track, char[] output, int size)
|
||||||
|
{
|
||||||
|
if(track < 0 || track >= TRACKS_SIZE)
|
||||||
|
{
|
||||||
|
FormatEx(output, size, "%T", "Track_Unknown", client);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char sTrack[16];
|
||||||
|
FormatEx(sTrack, 16, "Track_%d", track);
|
||||||
|
FormatEx(output, size, "%T", sTrack, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int track)
|
||||||
{
|
{
|
||||||
char[] sUpperCase = new char[64];
|
char[] sUpperCase = new char[64];
|
||||||
strcopy(sUpperCase, 64, gS_StyleStrings[style][sStyleName]);
|
strcopy(sUpperCase, 64, gS_StyleStrings[style][sStyleName]);
|
||||||
@ -1693,9 +1708,28 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 1; i <= 3; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
Shavit_PrintToChatAll("%T", "WRNotice", client, gS_ChatStrings[sMessageWarning], sUpperCase);
|
if(!IsValidClient(i))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] sTrack = new char[32];
|
||||||
|
GetTrackName(i, track, sTrack, 32);
|
||||||
|
|
||||||
|
for(int j = 1; j <= 3; j++)
|
||||||
|
{
|
||||||
|
if(track == Track_Main)
|
||||||
|
{
|
||||||
|
Shavit_PrintToChat(i, "%T", "WRNotice", i, gS_ChatStrings[sMessageWarning], sUpperCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shavit_PrintToChat(i, "%s[%s]%s %T", gS_ChatStrings[sMessageVariable], gS_ChatStrings[sMessageText], "WRNotice", i, gS_ChatStrings[sMessageWarning], sUpperCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1743,7 +1777,7 @@ void RestartTimer(int client)
|
|||||||
{
|
{
|
||||||
if(Shavit_ZoneExists(Zone_Start, Track_Main))
|
if(Shavit_ZoneExists(Zone_Start, Track_Main))
|
||||||
{
|
{
|
||||||
Shavit_RestartTimer(client);
|
Shavit_RestartTimer(client, Track_Main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,12 +96,12 @@ 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)
|
||||||
{
|
{
|
||||||
// natives
|
// natives
|
||||||
CreateNative("Shavit_GetWRTime", Native_GetWRTime);
|
|
||||||
CreateNative("Shavit_GetWRRecordID", Native_GetWRRecordID);
|
|
||||||
CreateNative("Shavit_GetWRName", Native_GetWRName);
|
|
||||||
CreateNative("Shavit_GetPlayerPB", Native_GetPlayerPB);
|
CreateNative("Shavit_GetPlayerPB", Native_GetPlayerPB);
|
||||||
CreateNative("Shavit_GetRankForTime", Native_GetRankForTime);
|
CreateNative("Shavit_GetRankForTime", Native_GetRankForTime);
|
||||||
CreateNative("Shavit_GetRecordAmount", Native_GetRecordAmount);
|
CreateNative("Shavit_GetRecordAmount", Native_GetRecordAmount);
|
||||||
|
CreateNative("Shavit_GetWRName", Native_GetWRName);
|
||||||
|
CreateNative("Shavit_GetWRRecordID", Native_GetWRRecordID);
|
||||||
|
CreateNative("Shavit_GetWRTime", Native_GetWRTime);
|
||||||
|
|
||||||
// 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
|
||||||
RegPluginLibrary("shavit-wr");
|
RegPluginLibrary("shavit-wr");
|
||||||
@ -1695,7 +1695,7 @@ void SQL_DBConnect()
|
|||||||
gB_MySQL = StrEqual(sDriver, "mysql", false);
|
gB_MySQL = StrEqual(sDriver, "mysql", false);
|
||||||
|
|
||||||
char[] sQuery = new char[512];
|
char[] sQuery = new char[512];
|
||||||
FormatEx(sQuery, 512, "CREATE TABLE IF NOT EXISTS `%splayertimes` (`id` %s, `auth` VARCHAR(32), `map` VARCHAR(192), `time` FLOAT, `jumps` INT, `style` INT, `date` VARCHAR(32), `strafes` INT, `sync` FLOAT, `points` FLOAT NOT NULL DEFAULT 0%s);", gS_MySQLPrefix, gB_MySQL? "INT NOT NULL AUTO_INCREMENT":"INTEGER PRIMARY KEY", gB_MySQL? ", PRIMARY KEY (`id`)":"");
|
FormatEx(sQuery, 512, "CREATE TABLE IF NOT EXISTS `%splayertimes` (`id` %s, `auth` VARCHAR(32), `map` VARCHAR(192), `time` FLOAT, `jumps` INT, `style` INT, `date` VARCHAR(32), `strafes` INT, `sync` FLOAT, `points` FLOAT NOT NULL DEFAULT 0, `track` INT NOT NULL DEFAULT 0%s);", gS_MySQLPrefix, gB_MySQL? "INT NOT NULL AUTO_INCREMENT":"INTEGER PRIMARY KEY", gB_MySQL? ", PRIMARY KEY (`id`)":"");
|
||||||
|
|
||||||
gH_SQL.Query(SQL_CreateTable_Callback, sQuery, 0, DBPrio_High);
|
gH_SQL.Query(SQL_CreateTable_Callback, sQuery, 0, DBPrio_High);
|
||||||
}
|
}
|
||||||
@ -1732,6 +1732,9 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
|
|
||||||
FormatEx(sQuery, 64, "SELECT points FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
FormatEx(sQuery, 64, "SELECT points FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
||||||
gH_SQL.Query(SQL_TableMigration3_Callback, sQuery);
|
gH_SQL.Query(SQL_TableMigration3_Callback, sQuery);
|
||||||
|
|
||||||
|
FormatEx(sQuery, 64, "SELECT track FROM %splayertimes LIMIT 1;", gS_MySQLPrefix);
|
||||||
|
gH_SQL.Query(SQL_TableMigration4_Callback, sQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_TableMigration1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
public void SQL_TableMigration1_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||||
@ -1782,7 +1785,7 @@ public void SQL_TableMigration3_Callback(Database db, DBResultSet results, const
|
|||||||
if(results == null)
|
if(results == null)
|
||||||
{
|
{
|
||||||
char[] sQuery = new char[256];
|
char[] sQuery = new char[256];
|
||||||
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD %s;", gS_MySQLPrefix, gB_MySQL? "(`points` FLOAT NOT NULL DEFAULT 0)":"COLUMN `points` FLOAT NOT NULL DEFAULT 0");
|
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`points` FLOAT NOT NULL DEFAULT 0)":"COLUMN `points` FLOAT NOT NULL DEFAULT 0");
|
||||||
gH_SQL.Query(SQL_AlterTable3_Callback, sQuery);
|
gH_SQL.Query(SQL_AlterTable3_Callback, sQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1797,6 +1800,26 @@ public void SQL_AlterTable3_Callback(Database db, DBResultSet results, const cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SQL_TableMigration4_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||||
|
{
|
||||||
|
if(results == null)
|
||||||
|
{
|
||||||
|
char[] sQuery = new char[256];
|
||||||
|
FormatEx(sQuery, 256, "ALTER TABLE `%splayertimes` ADD %s;", gS_MySQLPrefix, (gB_MySQL)? "(`track` INT NOT NULL DEFAULT 0)":"COLUMN `track` INT NOT NULL DEFAULT 0");
|
||||||
|
gH_SQL.Query(SQL_AlterTable4_Callback, sQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SQL_AlterTable4_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||||
|
{
|
||||||
|
if(results == null)
|
||||||
|
{
|
||||||
|
LogError("Timer (WR module) error! Times' table migration (4) failed. Reason: %s", error);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync)
|
public void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync)
|
||||||
{
|
{
|
||||||
char[] sTime = new char[32];
|
char[] sTime = new char[32];
|
||||||
|
|||||||
@ -1503,7 +1503,7 @@ void GetTrackName(int client, int track, char[] output, int size)
|
|||||||
|
|
||||||
static char sTrack[16];
|
static char sTrack[16];
|
||||||
FormatEx(sTrack, 16, "Track_%d", track);
|
FormatEx(sTrack, 16, "Track_%d", track);
|
||||||
FormatEx(output, size, "%s", "%T", sTrack, client);
|
FormatEx(output, size, "%T", sTrack, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTeleportZone(int client)
|
void UpdateTeleportZone(int client)
|
||||||
@ -2016,11 +2016,11 @@ public void SQL_AlterTable2_Callback(Database db, DBResultSet results, const cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shavit_OnRestart(int client)
|
public void Shavit_OnRestart(int client, int track)
|
||||||
{
|
{
|
||||||
if(gB_TeleportToStart)
|
if(gB_TeleportToStart)
|
||||||
{
|
{
|
||||||
Shavit_StartTimer(client);
|
Shavit_StartTimer(client, track);
|
||||||
|
|
||||||
if(!EmptyVector(gF_CustomSpawn))
|
if(!EmptyVector(gF_CustomSpawn))
|
||||||
{
|
{
|
||||||
@ -2029,7 +2029,7 @@ public void Shavit_OnRestart(int client)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int index = GetZoneIndex(Zone_Start, Track_Main);
|
int index = GetZoneIndex(Zone_Start, track);
|
||||||
|
|
||||||
if(index == -1)
|
if(index == -1)
|
||||||
{
|
{
|
||||||
@ -2046,11 +2046,11 @@ public void Shavit_OnRestart(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shavit_OnEnd(int client)
|
public void Shavit_OnEnd(int client, int track)
|
||||||
{
|
{
|
||||||
if(gB_TeleportToEnd)
|
if(gB_TeleportToEnd)
|
||||||
{
|
{
|
||||||
int index = GetZoneIndex(Zone_End, Track_Main);
|
int index = GetZoneIndex(Zone_End, track);
|
||||||
|
|
||||||
if(index == -1)
|
if(index == -1)
|
||||||
{
|
{
|
||||||
@ -2226,9 +2226,9 @@ public void StartTouchPost(int entity, int other)
|
|||||||
|
|
||||||
case Zone_End:
|
case Zone_End:
|
||||||
{
|
{
|
||||||
if(status != Timer_Stopped && gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack] == Track_Main)
|
if(status != Timer_Stopped && Shavit_GetClientTrack(other) == gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack])
|
||||||
{
|
{
|
||||||
Shavit_FinishMap(other);
|
Shavit_FinishMap(other, gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2276,9 +2276,16 @@ public void TouchPost(int entity, int other)
|
|||||||
{
|
{
|
||||||
case Zone_Start:
|
case Zone_Start:
|
||||||
{
|
{
|
||||||
if(gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack] == Track_Main)
|
// start timer instantly for main track, but require bonuses to have the current timer stopped
|
||||||
|
// so you don't accidentally step on those while running
|
||||||
|
if(Shavit_GetTimerStatus(other) == Timer_Stopped || Shavit_GetClientTrack(other) != Track_Main)
|
||||||
{
|
{
|
||||||
Shavit_StartTimer(other);
|
Shavit_StartTimer(other, gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack] == Track_Main)
|
||||||
|
{
|
||||||
|
Shavit_StartTimer(other, Track_Main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +0,0 @@
|
|||||||
"Phrases"
|
|
||||||
{
|
|
||||||
// ---------- Chat ---------- //
|
|
||||||
"ChatRankList"
|
|
||||||
{
|
|
||||||
"en" "List of chat ranks:"
|
|
||||||
}
|
|
||||||
"ExampleMessage"
|
|
||||||
{
|
|
||||||
"en" "Example."
|
|
||||||
}
|
|
||||||
"ReloadChat"
|
|
||||||
{
|
|
||||||
"en" "Config reloaded."
|
|
||||||
}
|
|
||||||
// ---------- Teams ---------- //
|
|
||||||
"TeamSpec"
|
|
||||||
{
|
|
||||||
"en" "*SPEC* "
|
|
||||||
}
|
|
||||||
"TeamSpectator"
|
|
||||||
{
|
|
||||||
"en" "(Spectator) "
|
|
||||||
}
|
|
||||||
"TeamT"
|
|
||||||
{
|
|
||||||
"en" "(Terrorist) "
|
|
||||||
}
|
|
||||||
"TeamCT"
|
|
||||||
{
|
|
||||||
"en" "(Counter-Terrorist) "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,10 @@
|
|||||||
"Phrases"
|
"Phrases"
|
||||||
{
|
{
|
||||||
// ---------- Tracks ---------- //
|
// ---------- Tracks ---------- //
|
||||||
|
"Track"
|
||||||
|
{
|
||||||
|
"en" "Track"
|
||||||
|
}
|
||||||
"Track_Unknown"
|
"Track_Unknown"
|
||||||
{
|
{
|
||||||
"en" "UNKNOWN TRACK"
|
"en" "UNKNOWN TRACK"
|
||||||
|
|||||||
@ -1,71 +0,0 @@
|
|||||||
"Phrases"
|
|
||||||
{
|
|
||||||
// ---------- Commands ---------- //
|
|
||||||
"TierCommand"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Usage: {1} <tier>"
|
|
||||||
}
|
|
||||||
"TierInvalid"
|
|
||||||
{
|
|
||||||
"#format" "{1:i}"
|
|
||||||
"en" "Invalid map tier ({1})"
|
|
||||||
}
|
|
||||||
"TierSet"
|
|
||||||
{
|
|
||||||
"#format" "{1:.01f}"
|
|
||||||
"en" "Map tier is now {1}."
|
|
||||||
}
|
|
||||||
// ---------- Menus ---------- //
|
|
||||||
"TopMenuClients"
|
|
||||||
{
|
|
||||||
"#format" "{1:d},{2:s},{3:s}"
|
|
||||||
"en" "#{1} - {2} ({3} points)"
|
|
||||||
}
|
|
||||||
"TopMenuClients2"
|
|
||||||
{
|
|
||||||
"#format" "{1:d},{2:s},{3:.02f}"
|
|
||||||
"en" "#{1} - {2} ({3} points)"
|
|
||||||
}
|
|
||||||
"TopMenuTitle"
|
|
||||||
{
|
|
||||||
"#format" "{1:d}"
|
|
||||||
"en" "Top {1} Players"
|
|
||||||
}
|
|
||||||
"TopNoResults"
|
|
||||||
{
|
|
||||||
"en" "No results found."
|
|
||||||
}
|
|
||||||
// ---------- Points ---------- //
|
|
||||||
"ApproximatePoints"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:s},{3:s},{4:s},{5:.01f},{6:s},{7:s},{8:i},{9:s}"
|
|
||||||
"en" "{1}{2}{3}: Around {4}{5}{6} points for a time of {7}{8}{9}."
|
|
||||||
}
|
|
||||||
"Rank"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:N},{3:s},{4:s},{5:i},{6:s},{7:s},{8:i},{9:s},{10:s},{11:.02f},{12:s}"
|
|
||||||
"en" "{1}{2}{3} is ranked {4}{5}{6} out of {7}{8}{9} with {10}{11} points {12}."
|
|
||||||
}
|
|
||||||
"UnknownPoints"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:s},{3:s}"
|
|
||||||
"en" "{1}{2}{3}: Unknown points, no records on map."
|
|
||||||
}
|
|
||||||
"Unranked"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:N},{3:s},{4:s},{5:s}"
|
|
||||||
"en" "{1}{2}{3} is {4}unranked{5}."
|
|
||||||
}
|
|
||||||
// ---------- Tiers ---------- //
|
|
||||||
"Tier"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:s},{3:s},{4:s},{5:.01f},{6:s}"
|
|
||||||
"en" "{1}{2}{3} is rated as {4}Tier {5}{6}."
|
|
||||||
}
|
|
||||||
"TierUnset"
|
|
||||||
{
|
|
||||||
"#format" "{1:s},{2:s},{3:s}"
|
|
||||||
"en" "{1}{2}{3} is not rated."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user