Skip to content

Commit

Permalink
Merge pull request #428 from KZGlobalTeam/dev
Browse files Browse the repository at this point in the history
3.5.0
  • Loading branch information
zealain authored Jan 7, 2023
2 parents 0ffc0b4 + fd334df commit a1267fb
Show file tree
Hide file tree
Showing 81 changed files with 884 additions and 128 deletions.
8 changes: 6 additions & 2 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* `!ncnt` - Toggle noclip-notrigger that ignores triggers.
* `+noclip` - Noclip (bind a key to it).
* `+noclipnt` - Noclip-notrigger that ignores triggers (bind a key to it).
* `!sg`/`!safe`/`!safeguard` - Toggle safeguard.
* `!pro` - Toggle safeguard for PRO runs.

### gokz-hud

Expand All @@ -53,7 +55,7 @@

### gokz-measure

* `!measure` - Open the distance measurement menu.
* `!measure`/`!measuremenu` - Open the distance measurement menu.
* `+measure` - Start measuring (bind to a key)
* `!measureblock` - Measure the gap of a block you're currently aiming at.

Expand All @@ -65,6 +67,8 @@

* `!saveloc` - Save location. Usage: `!saveloc <name>`
* `!loadloc` - Load location. Usage: `!loadloc <#id OR name>`
* `!prevloc` - Go back to the previous location.
* `!nextloc` - Go forward to the next location.
* `!locmenu` - Open location menu.
* `!nameloc` - Name location. Usage: `!nameloc <#id> <name>`

Expand Down Expand Up @@ -106,7 +110,7 @@ Many of these commands return results for your currently selected mode.

* `!top` - Open a menu showing the top record holders
* `!maptop` - Open a menu showing the top main course times of a map. Usage: `!maptop <map>`
* `!bmaptop` - Open a menu showing the top bonus times of a map. Usage: `!btop <#bonus> <map>`
* `!bmaptop`/`!bonustop`/`!btop` - Open a menu showing the top bonus times of a map. Usage: `!btop <#bonus> <map>`
* `!pb` - Show PB main course times and ranks in chat. Usage: `!pb <map> <player>`
* `!bpb` - Show PB bonus times and ranks in chat. Usage: `!bpb <#bonus> <map> <player>`
* `!wr` - Show main course record times in chat. Usage: `!wr <map>`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ For more information about what each plugin does, please see [PLUGINS.md](PLUGIN
### Server Requirements

* 128 Tick (`-tickrate 128`)
* [SourceMod ^1.10](https://www.sourcemod.net/downloads.php?branch=stable)
* [SourceMod ^1.11](https://www.sourcemod.net/downloads.php?branch=stable)
* [DHooks Extension ^2.2.0](https://forums.alliedmods.net/showpost.php?p=2588686&postcount=589)
* [MovementAPI Plugin ^2.2.0](https://github.com/danzayau/MovementAPI)
* [MovementAPI Plugin ^2.4.2](https://github.com/danzayau/MovementAPI)
* Optional - [GlobalAPI Plugin](https://bitbucket.org/kztimerglobalteam/globalapi-smplugin) (required for gokz-globals plugin)
* Optional - A "console cleaner" extension to prevent `Datatable warning` server console spam
* Optional - [Updater Plugin](https://forums.alliedmods.net/showthread.php?t=169095) (automatically install minor GOKZ updates)
Expand Down
31 changes: 31 additions & 0 deletions addons/sourcemod/gamedata/gokz-replays.games.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"Games"
{
"csgo"
{
"Functions"
{
"CCSGameRules::TeamFull"
{
"signature" "CCSGameRules::TeamFull"
"callconv" "thiscall"
"this" "address"
"return" "bool"
"arguments"
{
"teamid"
{
"type" "int"
}
}
}
}
"Signatures"
{
"CCSGameRules::TeamFull"
{
"windows" "\x55\x8B\xEC\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x8B\x45\x08\x83\xE8\x01"
"linux" "\x55\x89\xE5\x83\xEC\x18\x89\x5D\xF8\x8B\x5D\x08\x89\x75\xFC\x8B\x75\x0C\x89\x1C\x24\xE8\x2A\x2A\x2A\x2A\x83\xFE\x02"
}
}
}
}
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-anticheat.sp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Detects basic player movement cheats",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-anticheat.txt"
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-chat.sp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Handles client-triggered chat messages",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-chat.txt"
Expand Down
14 changes: 2 additions & 12 deletions addons/sourcemod/scripting/gokz-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Core plugin of the GOKZ plugin set",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-core.txt"
Expand Down Expand Up @@ -168,6 +168,7 @@ public void OnClientPutInServer(int client)
OnClientPutInServer_MapTriggers(client);
OnClientPutInServer_Triggerfix(client);
OnClientPutInServer_Noclip(client);
OnClientPutInServer_Turnbinds(client);
HookClientEvents(client);
}

Expand Down Expand Up @@ -199,17 +200,6 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
UpdateTrackingVariables(client, cmdnum, buttons); // This should be last
}

public Action OnClientCommandKeyValues(int client, KeyValues kv)
{
// Block clan tag changes - Credit: GoD-Tony (https://forums.alliedmods.net/showpost.php?p=2337679&postcount=6)
char cmd[16];
if (kv.GetSectionName(cmd, sizeof(cmd)) && StrEqual(cmd, "ClanTagChanged", false))
{
return Plugin_Handled;
}
return Plugin_Continue;
}

public void OnClientCookiesCached(int client)
{
OnClientCookiesCached_Options(client);
Expand Down
25 changes: 20 additions & 5 deletions addons/sourcemod/scripting/gokz-core/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ void RegisterCommands()
RegConsoleCmd("sm_ncnt", CommandToggleNoclipNotrigger, "[KZ] Toggle noclip-notrigger.");
RegConsoleCmd("+noclipnt", CommandEnableNoclipNotrigger, "[KZ] Noclip-notrigger on.");
RegConsoleCmd("-noclipnt", CommandDisableNoclipNotrigger, "[KZ] Noclip-notrigger off.");
RegConsoleCmd("sm_sg", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_safe", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_safeguard", CommandSafeGuard, "[KZ] Toggle safeguard.");
RegConsoleCmd("sm_sg", CommandNubSafeGuard, "[KZ] Toggle NUB safeguard.");
RegConsoleCmd("sm_safe", CommandNubSafeGuard, "[KZ] Toggle NUB safeguard.");
RegConsoleCmd("sm_safeguard", CommandNubSafeGuard, "[KZ] Toggle NUB safeguard.");
RegConsoleCmd("sm_pro", CommandProSafeGuard, "[KZ] Toggle PRO safeguard.");
RegConsoleCmd("kill", CommandKill);
RegConsoleCmd("killvector", CommandKill);
RegConsoleCmd("explode", CommandKill);
RegConsoleCmd("explodevector", CommandKill);
}

void AddCommandsListeners()
Expand Down Expand Up @@ -75,6 +79,17 @@ bool SwitchToModeIfAvailable(int client, int mode)
}
}

public Action CommandKill(int client, int args)
{
if (IsPlayerAlive(client) && GOKZ_GetCoreOption(client, Option_Safeguard) > Safeguard_Disabled && GOKZ_GetTimerRunning(client) && GOKZ_GetValidTimer(client))
{
GOKZ_PrintToChat(client, true, "%t", "Safeguard - Blocked");
GOKZ_PlayErrorSound(client);
return Plugin_Handled;
}
return Plugin_Continue;
}

public Action CommandOptions(int client, int args)
{
DisplayOptionsMenu(client);
Expand Down Expand Up @@ -357,9 +372,9 @@ public Action CommandDisableNoclipNotrigger(int client, int args)
return Plugin_Handled;
}

public Action CommandSafeGuard(int client, int args)
public Action CommandNubSafeGuard(int client, int args)
{
ToggleSafeGuard(client);
ToggleNubSafeGuard(client);
return Plugin_Handled;
}

Expand Down
38 changes: 29 additions & 9 deletions addons/sourcemod/scripting/gokz-core/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,31 @@ void OnClientPutInServer_Noclip(int client)

// =====[ TURNBINDS ]=====

int turnbindsLastLeftStart[MAXPLAYERS + 1];
int turnbindsLastRightStart[MAXPLAYERS + 1];
float turnbindsLastValidYaw[MAXPLAYERS + 1];
int turnbindsOldButtons[MAXPLAYERS + 1];
static int turnbindsLastLeftStart[MAXPLAYERS + 1];
static int turnbindsLastRightStart[MAXPLAYERS + 1];
static float turnbindsLastValidYaw[MAXPLAYERS + 1];
static int turnbindsOldButtons[MAXPLAYERS + 1];

void OnClientPutInServer_Turnbinds(int client)
{
turnbindsLastLeftStart[client] = 0;
turnbindsLastRightStart[client] = 0;
}
// Ensures that there is a minimum time between starting to turnbind in one direction
// and then starting to turnbind in the other direction
void OnPlayerRunCmd_Turnbinds(int client, int buttons, int tickcount, float angles[3])
{
if (buttons & IN_LEFT && tickcount < turnbindsLastRightStart[client] + GOKZ_TURNBIND_COOLDOWN)
if (IsFakeClient(client))
{
return;
}
if (buttons & IN_LEFT && tickcount < turnbindsLastRightStart[client] + RoundToNearest(GOKZ_TURNBIND_COOLDOWN / GetTickInterval()))
{
angles[1] = turnbindsLastValidYaw[client];
TeleportEntity(client, NULL_VECTOR, angles, NULL_VECTOR);
buttons = 0;
}
else if (buttons & IN_RIGHT && tickcount < turnbindsLastLeftStart[client] + GOKZ_TURNBIND_COOLDOWN)
else if (buttons & IN_RIGHT && tickcount < turnbindsLastLeftStart[client] + RoundToNearest(GOKZ_TURNBIND_COOLDOWN / GetTickInterval()))
{
angles[1] = turnbindsLastValidYaw[client];
TeleportEntity(client, NULL_VECTOR, angles, NULL_VECTOR);
Expand Down Expand Up @@ -292,7 +301,7 @@ void OnTimerStart_JoinTeam(int client)
hasSavedPosition[client] = false;
}

void JoinTeam(int client, int newTeam, bool restorePos)
void JoinTeam(int client, int newTeam, bool restorePos, bool forceBroadcast = false)
{
KZPlayer player = KZPlayer(client);
int currentTeam = GetClientTeam(client);
Expand Down Expand Up @@ -347,6 +356,10 @@ void JoinTeam(int client, int newTeam, bool restorePos)
hasSavedPosition[client] = false;
Call_GOKZ_OnJoinTeam(client, newTeam);
}
else if (forceBroadcast)
{
Call_GOKZ_OnJoinTeam(client, newTeam);
}
}

void SendFakeTeamEvent(int client)
Expand Down Expand Up @@ -595,9 +608,16 @@ void OnMapStart_FixMissingSpawns()

// =====[ SAFE MODE ]=====

void ToggleSafeGuard(int client)
void ToggleNubSafeGuard(int client)
{
GOKZ_SetCoreOption(client, Option_Safeguard, (GOKZ_GetCoreOption(client, Option_Safeguard) + 1) % SAFEGUARD_COUNT);
if (GOKZ_GetCoreOption(client, Option_Safeguard) == Safeguard_EnabledNUB)
{
GOKZ_SetCoreOption(client, Option_Safeguard, Safeguard_Disabled);
}
else
{
GOKZ_SetCoreOption(client, Option_Safeguard, Safeguard_EnabledNUB);
}
}

void ToggleProSafeGuard(int client)
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public int Native_GetValidJump(Handle plugin, int numParams)

public int Native_JoinTeam(Handle plugin, int numParams)
{
JoinTeam(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3));
JoinTeam(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3), GetNativeCell(4));
return 0;
}

Expand Down
15 changes: 7 additions & 8 deletions addons/sourcemod/scripting/gokz-core/triggerfix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,13 @@ static bool DoTriggerFix(int client, bool filterFix = false)
// Normally this wouldn't happen, because the trigger should be colliding with the player's hull if it gets here.
continue;
}

char className[64];
GetEntityClassname(trigger, className, sizeof(className));
if (StrEqual(className, "trigger_push"))
{
// Completely ignore push triggers.
continue;
}
if (filterFix && SDKCall(passesTriggerFilters, trigger, client))
{
// MarkEntitiesAsTouching always fires the Touch function even if it was already fired this tick.
Expand All @@ -340,13 +346,6 @@ static bool DoTriggerFix(int client, bool filterFix = false)
}
else if (!triggerTouchFired[client][trigger])
{
char className[64];
GetEntityClassname(trigger, className, sizeof(className));
if (StrEqual(className, "trigger_push"))
{
// Completely ignore push triggers.
continue;
}
// If the player is still touching the trigger on this tick, and Touch was not called for whatever reason
// in the last tick, we make sure that it is called now.
SDKCall(markEntitiesAsTouching, serverGameEnts, client, trigger);
Expand Down
25 changes: 24 additions & 1 deletion addons/sourcemod/scripting/gokz-errorboxfixer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public Plugin myinfo =
author = "1NutWunDeR",
description = "Adds missing models for KZ maps",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-errorboxfixer.txt"
Expand Down Expand Up @@ -57,10 +57,33 @@ public void OnMapStart()
AddFileToDownloadsTable("materials/kzmod/starttimersign.vtf");
AddFileToDownloadsTable("materials/kzmod/stoptimersign.vmt");
AddFileToDownloadsTable("materials/kzmod/stoptimersign.vtf");
AddFileToDownloadsTable("models/props/switch001.mdl");
AddFileToDownloadsTable("models/props/switch001.vvd");
AddFileToDownloadsTable("models/props/switch001.phy");
AddFileToDownloadsTable("models/props/switch001.vtx");
AddFileToDownloadsTable("models/props/switch001.dx90.vtx");
AddFileToDownloadsTable("materials/models/props/switch.vmt");
AddFileToDownloadsTable("materials/models/props/switch.vtf");
AddFileToDownloadsTable("materials/models/props/switch001.vmt");
AddFileToDownloadsTable("materials/models/props/switch001.vtf");
AddFileToDownloadsTable("materials/models/props/switch001_normal.vmt");
AddFileToDownloadsTable("materials/models/props/switch001_normal.vtf");
AddFileToDownloadsTable("materials/models/props/switch001_lightwarp.vmt");
AddFileToDownloadsTable("materials/models/props/switch001_lightwarp.vtf");
AddFileToDownloadsTable("materials/models/props/switch001_exponent.vmt");
AddFileToDownloadsTable("materials/models/props/switch001_exponent.vtf");
AddFileToDownloadsTable("materials/models/props/startkztimer.vmt");
AddFileToDownloadsTable("materials/models/props/startkztimer.vtf");
AddFileToDownloadsTable("materials/models/props/stopkztimer.vmt");
AddFileToDownloadsTable("materials/models/props/stopkztimer.vtf");

PrecacheModel("models/kzmod/buttons/stand_button.vmt", true);
PrecacheModel("models/props_wasteland/pipecluster002a.mdl", true);
PrecacheModel("models/kzmod/buttons/standing_button.mdl", true);
PrecacheModel("models/kzmod/buttons/stone_button.mdl", true);
PrecacheModel("materials/kzmod/starttimersign.vmt", true);
PrecacheModel("materials/kzmod/stoptimersign.vmt", true);
PrecacheModel("models/props/switch001.mdl", true);
PrecacheModel("materials/models/props/startkztimer.vmt", true);
PrecacheModel("materials/models/props/stopkztimer.vmt", true);
}
9 changes: 7 additions & 2 deletions addons/sourcemod/scripting/gokz-global.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <sdktools>

#include <SteamWorks>
#include <GlobalAPI>
#include <gokz/anticheat>
#include <gokz/core>
Expand Down Expand Up @@ -30,7 +31,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Provides centralised records and bans via GlobalAPI",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-global.txt"
Expand Down Expand Up @@ -83,7 +84,10 @@ public void OnPluginStart()
{
SetFailState("gokz-global currently only supports 128 tickrate servers.");
}

if (!SteamWorks_IsVACEnabled())
{
SetFailState("gokz-global currently only supports VAC-secured servers.");
}
LoadTranslations("gokz-common.phrases");
LoadTranslations("gokz-global.phrases");

Expand Down Expand Up @@ -239,6 +243,7 @@ Action FPSKickPlayer(Handle timer, int userid)

public void OnClientPutInServer(int client)
{
gB_GloballyVerified[client] = false;
gB_waitingForFPSKick[client] = false;
OnClientPutInServer_PrintRecords(client);
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-goto.sp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Allows players to teleport to another player",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-goto.txt"
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-hud.sp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Plugin myinfo =
author = "DanZay",
description = "Provides HUD and UI features",
version = GOKZ_VERSION,
url = "https://bitbucket.org/kztimerglobalteam/gokz"
url = GOKZ_SOURCE_URL
};

#define UPDATER_URL GOKZ_UPDATER_BASE_URL..."gokz-hud.txt"
Expand Down
Loading

0 comments on commit a1267fb

Please sign in to comment.