Add D-Only to default styles, implement CS:GO autobhop in a better way

This commit is contained in:
shavitush 2016-10-19 22:11:32 +03:00
parent a12c1830b2
commit ae58f37ec0
No known key found for this signature in database
GPG Key ID: 0A298F154527B9A4
3 changed files with 58 additions and 29 deletions

View File

@ -132,7 +132,7 @@
"rankingmultiplier" "1.50" "rankingmultiplier" "1.50"
} }
"6" "5"
{ {
"name" "Half-Sideways" "name" "Half-Sideways"
"shortname" "HSW" "shortname" "HSW"
@ -149,6 +149,34 @@
"rankingmultiplier" "1.20" "rankingmultiplier" "1.20"
} }
"6"
{
"name" "D-Only"
"shortname" "D"
"htmlcolor" "9C5BBA"
"command" "d; donly"
"autobhop" "0"
"easybhop" "0"
"airaccelerate" "1000"
"runspeed" "260.00"
"block_pleft" "1"
"block_pright" "1"
"block_pstrafe" "1"
"block_a" "1"
"block_s" "1"
"block_d" "1"
"strafe_count_w" "0"
"strafe_count_a" "0"
"strafe_count_s" "0"
"rankingmultiplier" "1.50"
}
"7" "7"
{ {
"name" "Low Gravity" "name" "Low Gravity"

View File

@ -197,7 +197,7 @@ public void OnPluginStart()
gF_HSW_Requirement = 449.00; gF_HSW_Requirement = 449.00;
sv_autobunnyhopping = FindConVar("sv_autobunnyhopping"); sv_autobunnyhopping = FindConVar("sv_autobunnyhopping");
sv_autobunnyhopping.Flags &= ~FCVAR_NOTIFY; sv_autobunnyhopping.BoolValue = false;
} }
else else
@ -604,6 +604,7 @@ void ChangeClientStyle(int client, BhopStyle style)
Call_Finish(); Call_Finish();
gBS_Style[client] = style; gBS_Style[client] = style;
UpdateAutoBhop(client);
Shavit_PrintToChat(client, "You have selected to play %s%s%s.", gS_ChatStrings[sMessageStyle], gS_StyleStrings[style][sStyleName], gS_ChatStrings[sMessageText]); Shavit_PrintToChat(client, "You have selected to play %s%s%s.", gS_ChatStrings[sMessageStyle], gS_StyleStrings[style][sStyleName], gS_ChatStrings[sMessageText]);
@ -955,6 +956,7 @@ public void OnClientCookiesCached(int client)
GetClientCookie(client, gH_StyleCookie, sCookie, 4); GetClientCookie(client, gH_StyleCookie, sCookie, 4);
gBS_Style[client] = view_as<BhopStyle>(StringToInt(sCookie)); gBS_Style[client] = view_as<BhopStyle>(StringToInt(sCookie));
UpdateAutoBhop(client);
} }
public void OnClientPutInServer(int client) public void OnClientPutInServer(int client)
@ -967,9 +969,10 @@ public void OnClientPutInServer(int client)
} }
gB_Auto[client] = true; gB_Auto[client] = true;
gBS_Style[client] = view_as<BhopStyle>(0);
gB_DoubleSteps[client] = false; gB_DoubleSteps[client] = false;
gF_StrafeWarning[client] = 0.0; gF_StrafeWarning[client] = 0.0;
gBS_Style[client] = view_as<BhopStyle>(0);
UpdateAutoBhop(client);
if(AreClientCookiesCached(client)) if(AreClientCookiesCached(client))
{ {
@ -1092,6 +1095,9 @@ bool LoadStyles()
char[][] sStyleCommands = new char[32][32]; char[][] sStyleCommands = new char[32][32];
int iCommands = ExplodeString(gS_StyleStrings[i][sChangeCommand], ";", sStyleCommands, 32, 32, false); int iCommands = ExplodeString(gS_StyleStrings[i][sChangeCommand], ";", sStyleCommands, 32, 32, false);
char[] sDescription = new char[128];
FormatEx(sDescription, 128, "Change style to %s.", gS_StyleStrings[i][sStyleName]);
for(int x = 0; x < iCommands; x++) for(int x = 0; x < iCommands; x++)
{ {
TrimString(sStyleCommands[x]); TrimString(sStyleCommands[x]);
@ -1102,9 +1108,6 @@ bool LoadStyles()
gSM_StyleCommands.SetValue(sCommand, i); gSM_StyleCommands.SetValue(sCommand, i);
char[] sDescription = new char[128];
FormatEx(sDescription, 128, "Change style to %s.", gS_StyleStrings[i][sStyleName]);
RegConsoleCmd(sCommand, Command_StyleChange, sDescription); RegConsoleCmd(sCommand, Command_StyleChange, sDescription);
} }
} }
@ -1309,11 +1312,6 @@ public void PreThink(int client)
if(IsPlayerAlive(client)) if(IsPlayerAlive(client))
{ {
sv_airaccelerate.IntValue = gA_StyleSettings[gBS_Style[client]][iAiraccelerate]; sv_airaccelerate.IntValue = gA_StyleSettings[gBS_Style[client]][iAiraccelerate];
if(sv_autobunnyhopping != null)
{
sv_autobunnyhopping.BoolValue = (gA_StyleSettings[gBS_Style[client]][bAutobhop] && gB_Autobhop && gB_Auto[client]);
}
} }
} }
@ -1423,32 +1421,27 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
gI_Strafes[client]++; gI_Strafes[client]++;
} }
// autobhop for cs:s if(gA_StyleSettings[gBS_Style[client]][bAutobhop] && gB_Autobhop && gB_Auto[client])
// cs:go has a built-in autobhop cvar
if(gEV_Type == Engine_CSS)
{ {
if(gA_StyleSettings[gBS_Style[client]][bAutobhop] && gB_Autobhop && gB_Auto[client]) bool bInWater = (GetEntProp(client, Prop_Send, "m_nWaterLevel") >= 2);
bool bOnLadder = (GetEntityMoveType(client) == MOVETYPE_LADDER);
if((buttons & IN_JUMP) > 0 && iGroundEntity == -1 && !bOnLadder && !bInWater)
{ {
bool bInWater = (GetEntProp(client, Prop_Send, "m_nWaterLevel") >= 2); buttons &= ~IN_JUMP;
bool bOnLadder = (GetEntityMoveType(client) == MOVETYPE_LADDER);
if((buttons & IN_JUMP) > 0 && iGroundEntity == -1 && !bOnLadder && !bInWater)
{
buttons &= ~IN_JUMP;
}
else if(gB_DoubleSteps[client] && (iGroundEntity != -1 || bOnLadder || bInWater))
{
buttons |= IN_JUMP;
}
} }
else if(gB_DoubleSteps[client]) else if(gB_DoubleSteps[client] && (iGroundEntity != -1 || bOnLadder || bInWater))
{ {
buttons |= IN_JUMP; buttons |= IN_JUMP;
} }
} }
else if(gB_DoubleSteps[client])
{
buttons |= IN_JUMP;
}
if(bInStart && gB_BlockPreJump && !gA_StyleSettings[gBS_Style[client]][bPrespeed] && (vel[2] > 0 || (buttons & IN_JUMP) > 0)) if(bInStart && gB_BlockPreJump && !gA_StyleSettings[gBS_Style[client]][bPrespeed] && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
{ {
vel[2] = 0.0; vel[2] = 0.0;
@ -1544,3 +1537,11 @@ void StopTimer_Cheat(int client, const char[] message)
Shavit_StopTimer(client); Shavit_StopTimer(client);
Shavit_PrintToChat(client, "%sTimer stopped! %s%s", gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText], message); Shavit_PrintToChat(client, "%sTimer stopped! %s%s", gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText], message);
} }
void UpdateAutoBhop(int client)
{
if(sv_autobunnyhopping != null)
{
sv_autobunnyhopping.ReplicateToClient(client, (gA_StyleSettings[gBS_Style[client]][bAutobhop] && gB_Autobhop && gB_Auto[client])? "1":"0");
}
}

View File

@ -582,7 +582,7 @@ void UpdateHUD(int client)
{ {
FormatEx(sHintText, 512, "<font face='Stratum2'>"); FormatEx(sHintText, 512, "<font face='Stratum2'>");
Format(sHintText, 512, "%s\t<u><font color='#%s'>%s Replay</font></u>", sHintText, gS_StyleStrings[bsStyle][sHTMLColor], gS_StyleStrings[bsStyle][sStyleName]); Format(sHintText, 512, "%s\t<u><font color='#%s'>%s Replay</font></u>", sHintText, gS_StyleStrings[bsStyle][sHTMLColor], gS_StyleStrings[bsStyle][sStyleName]);
Format(sHintText, 512, "%s\n\tTime: <font color='#00FF00'>%s</font>%s", sHintText, sTime, sWR); Format(sHintText, 512, "%s\n\tTime: <font color='#00FF00'>%s</font> / %s", sHintText, sTime, sWR);
Format(sHintText, 512, "%s\n\tSpeed: %d", sHintText, iSpeed); Format(sHintText, 512, "%s\n\tSpeed: %d", sHintText, iSpeed);
Format(sHintText, 512, "%s</font>", sHintText); Format(sHintText, 512, "%s</font>", sHintText);
} }