mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 11:28:26 +00:00
add chat messages for tas commands
This commit is contained in:
parent
58dbd6d1c3
commit
a115632b7b
@ -44,7 +44,7 @@ float g_flOldYawAngle[MAXPLAYERS + 1];
|
|||||||
int g_iSurfaceFrictionOffset;
|
int g_iSurfaceFrictionOffset;
|
||||||
float g_fMaxMove = 400.0;
|
float g_fMaxMove = 400.0;
|
||||||
|
|
||||||
bool g_bEnabled[MAXPLAYERS + 1];
|
bool gB_Autostrafer[MAXPLAYERS + 1];
|
||||||
TASType gI_Type[MAXPLAYERS + 1];
|
TASType gI_Type[MAXPLAYERS + 1];
|
||||||
TASOverride gI_Override[MAXPLAYERS + 1];
|
TASOverride gI_Override[MAXPLAYERS + 1];
|
||||||
bool gB_Prestrafe[MAXPLAYERS + 1];
|
bool gB_Prestrafe[MAXPLAYERS + 1];
|
||||||
@ -60,9 +60,11 @@ ConVar sv_accelerate = null;
|
|||||||
ConVar sv_friction = null;
|
ConVar sv_friction = null;
|
||||||
ConVar sv_stopspeed = null;
|
ConVar sv_stopspeed = null;
|
||||||
|
|
||||||
|
chatstrings_t gS_ChatStrings;
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
{
|
{
|
||||||
name = "[shavit] TAS (XutaxKamay)",
|
name = "[shavit] TAS",
|
||||||
author = "xutaxkamay, oblivious, KiD Fearless, rtldg",
|
author = "xutaxkamay, oblivious, KiD Fearless, rtldg",
|
||||||
description = "TAS module for shavit's bhop timer featuring xutaxkamay's autostrafer and oblivious's autogain.",
|
description = "TAS module for shavit's bhop timer featuring xutaxkamay's autostrafer and oblivious's autogain.",
|
||||||
version = SHAVIT_VERSION,
|
version = SHAVIT_VERSION,
|
||||||
@ -155,6 +157,8 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
if (gB_Late)
|
if (gB_Late)
|
||||||
{
|
{
|
||||||
|
Shavit_OnChatConfigLoaded();
|
||||||
|
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
if (IsClientConnected(i))
|
if (IsClientConnected(i))
|
||||||
@ -178,7 +182,7 @@ public void OnWishSpeedChanged(ConVar convar, const char[] oldValue, const char[
|
|||||||
|
|
||||||
public void OnClientConnected(int client)
|
public void OnClientConnected(int client)
|
||||||
{
|
{
|
||||||
g_bEnabled[client] = true;
|
gB_Autostrafer[client] = true;
|
||||||
gI_Override[client] = TASOverride_Surf;
|
gI_Override[client] = TASOverride_Surf;
|
||||||
gI_Type[client] = TASType_1Tick;
|
gI_Type[client] = TASType_1Tick;
|
||||||
gB_AutoJumpOnStart[client] = true;
|
gB_AutoJumpOnStart[client] = true;
|
||||||
@ -195,6 +199,11 @@ public void OnClientPutInServer(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Shavit_OnChatConfigLoaded()
|
||||||
|
{
|
||||||
|
Shavit_GetChatStringsStruct(gS_ChatStrings);
|
||||||
|
}
|
||||||
|
|
||||||
public Action Shavit_OnStart(int client, int track)
|
public Action Shavit_OnStart(int client, int track)
|
||||||
{
|
{
|
||||||
gB_ForceJump[client] = false;
|
gB_ForceJump[client] = false;
|
||||||
@ -448,7 +457,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
|||||||
|
|
||||||
if (s_iOnGroundCount[client] <= 1)
|
if (s_iOnGroundCount[client] <= 1)
|
||||||
{
|
{
|
||||||
if (!g_bEnabled[client] || IsSurfing(client))
|
if (!gB_Autostrafer[client] || IsSurfing(client))
|
||||||
{
|
{
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
@ -558,7 +567,7 @@ void OpenTasSettingsMenu(int client, int pos=0)
|
|||||||
Menu menu = new Menu(MenuHandler_TasSettings, MENU_ACTIONS_DEFAULT);
|
Menu menu = new Menu(MenuHandler_TasSettings, MENU_ACTIONS_DEFAULT);
|
||||||
menu.SetTitle("%T\n ", "TasSettings", client);
|
menu.SetTitle("%T\n ", "TasSettings", client);
|
||||||
|
|
||||||
FormatEx(display, sizeof(display), "[%s] %T", g_bEnabled[client] ? "+":"-", "Autostrafer", client);
|
FormatEx(display, sizeof(display), "[%s] %T", gB_Autostrafer[client] ? "+":"-", "Autostrafer", client);
|
||||||
menu.AddItem("toggle", display);
|
menu.AddItem("toggle", display);
|
||||||
|
|
||||||
FormatEx(display, sizeof(display), "[%s] %T", gB_AutoJumpOnStart[client] ? "+":"-", "JumpOnStart", client);
|
FormatEx(display, sizeof(display), "[%s] %T", gB_AutoJumpOnStart[client] ? "+":"-", "JumpOnStart", client);
|
||||||
@ -614,7 +623,7 @@ public int MenuHandler_TasSettings(Menu menu, MenuAction action, int param1, int
|
|||||||
|
|
||||||
if (StrEqual(info, "toggle"))
|
if (StrEqual(info, "toggle"))
|
||||||
{
|
{
|
||||||
g_bEnabled[param1] = !g_bEnabled[param1];
|
gB_Autostrafer[param1] = !gB_Autostrafer[param1];
|
||||||
}
|
}
|
||||||
else if (StrEqual(info, "autojump"))
|
else if (StrEqual(info, "autojump"))
|
||||||
{
|
{
|
||||||
@ -689,24 +698,32 @@ public Action CommandListener_Toggler(int client, const char[] command, int args
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool set = (command[0] == '+');
|
bool set = (command[0] == '+');
|
||||||
|
char translation[32];
|
||||||
|
|
||||||
if (StrEqual(command[1], "autostrafe"))
|
if (StrEqual(command[1], "autostrafe"))
|
||||||
{
|
{
|
||||||
g_bEnabled[client] = set;
|
gB_Autostrafer[client] = set;
|
||||||
|
translation = "Autostrafer";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command[1], "prestrafe"))
|
else if (StrEqual(command[1], "prestrafe"))
|
||||||
{
|
{
|
||||||
gB_Prestrafe[client] = set;
|
gB_Prestrafe[client] = set;
|
||||||
|
translation = "AutoPrestrafe";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command[1], "jumponstart"))
|
else if (StrEqual(command[1], "jumponstart"))
|
||||||
{
|
{
|
||||||
gB_AutoJumpOnStart[client] = set;
|
gB_AutoJumpOnStart[client] = set;
|
||||||
|
translation = "JumpOnStart";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command[1], "edgejump"))
|
else if (StrEqual(command[1], "edgejump"))
|
||||||
{
|
{
|
||||||
gB_EdgeJump[client] = set;
|
gB_EdgeJump[client] = set;
|
||||||
|
translation = "EdgeJump";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Shavit_StopChatSound();
|
||||||
|
Shavit_PrintToChat(client, "%T: %s%T", translation, client, (set ? gS_ChatStrings.sVariable : gS_ChatStrings.sWarning), (set ? "TASEnabled" : "TASDisabled"), client);
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,23 +746,33 @@ public Action Command_Toggler(int client, int args)
|
|||||||
x = StringToInt(arg);
|
x = StringToInt(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool set;
|
||||||
|
char translation[32];
|
||||||
|
|
||||||
if (StrEqual(command, "sm_autostrafe"))
|
if (StrEqual(command, "sm_autostrafe"))
|
||||||
{
|
{
|
||||||
g_bEnabled[client] = (x == -1) ? !g_bEnabled[client] : (x != 0);
|
set = gB_Autostrafer[client] = (x == -1) ? !gB_Autostrafer[client] : (x != 0);
|
||||||
|
translation = "Autostrafer";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command, "sm_prestrafe"))
|
else if (StrEqual(command, "sm_prestrafe"))
|
||||||
{
|
{
|
||||||
gB_Prestrafe[client] = (x == -1) ? !gB_Prestrafe[client] : (x != 0);
|
set = gB_Prestrafe[client] = (x == -1) ? !gB_Prestrafe[client] : (x != 0);
|
||||||
|
translation = "AutoPrestrafe";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command, "sm_jumponstart"))
|
else if (StrEqual(command, "sm_jumponstart"))
|
||||||
{
|
{
|
||||||
gB_AutoJumpOnStart[client] = (x == -1) ? !gB_AutoJumpOnStart[client] : (x != 0);
|
set = gB_AutoJumpOnStart[client] = (x == -1) ? !gB_AutoJumpOnStart[client] : (x != 0);
|
||||||
|
translation = "JumpOnStart";
|
||||||
}
|
}
|
||||||
else if (StrEqual(command, "sm_edgejump"))
|
else if (StrEqual(command, "sm_edgejump"))
|
||||||
{
|
{
|
||||||
gB_EdgeJump[client] = (x == -1) ? !gB_EdgeJump[client] : (x != 0);
|
set = gB_EdgeJump[client] = (x == -1) ? !gB_EdgeJump[client] : (x != 0);
|
||||||
|
translation = "EdgeJump";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Shavit_StopChatSound();
|
||||||
|
Shavit_PrintToChat(client, "%T: %s%T", translation, client, (set ? gS_ChatStrings.sVariable : gS_ChatStrings.sWarning), (set ? "TASEnabled" : "TASDisabled"), client);
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,14 +798,14 @@ public any Native_SetAutostrafeEnabled(Handle plugin, int numParams)
|
|||||||
{
|
{
|
||||||
int client = GetNativeCell(1);
|
int client = GetNativeCell(1);
|
||||||
bool value = GetNativeCell(2);
|
bool value = GetNativeCell(2);
|
||||||
g_bEnabled[client] = value;
|
gB_Autostrafer[client] = value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public any Native_GetAutostrafeEnabled(Handle plugin, int numParams)
|
public any Native_GetAutostrafeEnabled(Handle plugin, int numParams)
|
||||||
{
|
{
|
||||||
int client = GetNativeCell(1);
|
int client = GetNativeCell(1);
|
||||||
return g_bEnabled[client];
|
return gB_Autostrafer[client];
|
||||||
}
|
}
|
||||||
|
|
||||||
public any Native_SetAutostrafeType(Handle plugin, int numParams)
|
public any Native_SetAutostrafeType(Handle plugin, int numParams)
|
||||||
|
|||||||
@ -224,6 +224,14 @@
|
|||||||
{
|
{
|
||||||
"en" "Velocity (No speed loss) (oblivious)"
|
"en" "Velocity (No speed loss) (oblivious)"
|
||||||
}
|
}
|
||||||
|
"TASEnabled"
|
||||||
|
{
|
||||||
|
"en" "Enabled"
|
||||||
|
}
|
||||||
|
"TASDisabled"
|
||||||
|
{
|
||||||
|
"en" "Disabled"
|
||||||
|
}
|
||||||
"TASOverride"
|
"TASOverride"
|
||||||
{
|
{
|
||||||
"en" "Key Override"
|
"en" "Key Override"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user