mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
parent
a9b0a08f9f
commit
43a5285b15
26
gamedata/shavit.games.txt
Normal file
26
gamedata/shavit.games.txt
Normal file
@ -0,0 +1,26 @@
|
||||
"Games"
|
||||
{
|
||||
"cstrike"
|
||||
{
|
||||
"Offsets"
|
||||
{
|
||||
"GetMaxPlayerSpeed"
|
||||
{
|
||||
"windows" "437"
|
||||
"linux" "438"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"csgo"
|
||||
{
|
||||
"Offsets"
|
||||
{
|
||||
"GetMaxPlayerSpeed"
|
||||
{
|
||||
"windows" "494"
|
||||
"linux" "495"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,11 +23,11 @@
|
||||
#endif
|
||||
#define _shavit_included
|
||||
|
||||
#define SHAVIT_VERSION "1.1b"
|
||||
#define SHAVIT_VERSION "1.2b"
|
||||
#define PREFIX " \x04[Timer]\x01"
|
||||
|
||||
#define MAX_STYLES 2 // I could probably do sizeof(BhopStyle) but I suck
|
||||
#define MAX_ZONES 4
|
||||
#define MAX_ZONES 5
|
||||
|
||||
// game types
|
||||
enum ServerGame(+=1)
|
||||
@ -45,12 +45,13 @@ enum BhopStyle(+=1)
|
||||
};
|
||||
|
||||
// map zones
|
||||
enum MapZones
|
||||
enum MapZones(+=1)
|
||||
{
|
||||
Zone_Start = 0,
|
||||
Zone_End = 1,
|
||||
Zone_Respawn = 2,
|
||||
Zone_Stop = 3
|
||||
Zone_End,
|
||||
Zone_Respawn,
|
||||
Zone_Stop,
|
||||
Zone_Slay
|
||||
};
|
||||
|
||||
// let's not throw errors k?
|
||||
@ -24,6 +24,9 @@
|
||||
#include <sdkhooks>
|
||||
#include <shavit>
|
||||
|
||||
#undef REQUIRE_EXTENSIONS
|
||||
#include <dhooks>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma dynamic 131072 // let's make stuff faster
|
||||
#pragma newdecls required // We're at 2015 :D
|
||||
@ -31,6 +34,13 @@
|
||||
bool gB_Hide[MAXPLAYERS+1];
|
||||
bool gB_Late;
|
||||
|
||||
// cvars
|
||||
ConVar gCV_GodMode = null;
|
||||
int gI_GodMode = 3;
|
||||
|
||||
// dhooks
|
||||
Handle gH_GetMaxPlayerSpeed = null;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "[shavit] Miscellaneous",
|
||||
@ -83,7 +93,27 @@ public void OnPluginStart()
|
||||
LogError("idk what's wrong but for some reason, your CS:GO server is missing the \"mp_death_drop_gun\" cvar. go find what's causing it because I dunno");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cvars and stuff
|
||||
gCV_GodMode = CreateConVar("shavit_misc_godmode", "3", "Enable godmode for players? \n0 - Disabled\n1 - Only prevent fall/world damage.\n2 - Only prevent damage from other players.\n3 - Full godmode.");
|
||||
HookConVarChange(gCV_GodMode, OnConVarChanged);
|
||||
|
||||
AutoExecConfig();
|
||||
gI_GodMode = GetConVarInt(gCV_GodMode);
|
||||
|
||||
if(LibraryExists("dhooks"))
|
||||
{
|
||||
Handle hGameData = LoadGameConfigFile("shavit.games");
|
||||
|
||||
if(hGameData != null)
|
||||
{
|
||||
int iOffset = GameConfGetOffset(hGameData, "GetMaxPlayerSpeed");
|
||||
gH_GetMaxPlayerSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, DHook_GetMaxPlayerSpeed);
|
||||
}
|
||||
|
||||
CloseHandle(hGameData);
|
||||
}
|
||||
|
||||
// late load
|
||||
if(gB_Late)
|
||||
{
|
||||
@ -97,6 +127,27 @@ public void OnPluginStart()
|
||||
}
|
||||
}
|
||||
|
||||
public void OnConVarChanged(ConVar cvar, const char[] sOld, const char[] sNew)
|
||||
{
|
||||
// using an if() statement just incase I'll add more cvars.
|
||||
if(cvar == gCV_GodMode)
|
||||
{
|
||||
gI_GodMode = StringToInt(sNew);
|
||||
}
|
||||
}
|
||||
|
||||
public MRESReturn DHook_GetMaxPlayerSpeed(int pThis, Handle hReturn)
|
||||
{
|
||||
if(IsValidClient(pThis, true))
|
||||
{
|
||||
DHookSetReturn(hReturn, 250.000);
|
||||
|
||||
return MRES_Override;
|
||||
}
|
||||
|
||||
return MRES_Ignored;
|
||||
}
|
||||
|
||||
public Action Timer_Message(Handle Timer)
|
||||
{
|
||||
PrintToChatAll("%s You may write !hide to hide other players.", PREFIX);
|
||||
@ -154,11 +205,44 @@ public void OnClientPutInServer(int client)
|
||||
|
||||
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
|
||||
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
||||
|
||||
if(gH_GetMaxPlayerSpeed != null)
|
||||
{
|
||||
DHookEntity(gH_GetMaxPlayerSpeed, true, client);
|
||||
}
|
||||
}
|
||||
|
||||
public Action OnTakeDamage(int victim)
|
||||
public Action OnTakeDamage(int victim, int attacker)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
switch(gI_GodMode)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
// 0 - world/fall damage
|
||||
if(attacker == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if(IsValidClient(attacker, true))
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
// else
|
||||
default: return Plugin_Handled;
|
||||
}
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// hide
|
||||
@ -39,7 +39,8 @@ char gS_ZoneNames[MAX_ZONES][] =
|
||||
"Start Zone",
|
||||
"End Zone",
|
||||
"Glitch Zone (Respawn Player)",
|
||||
"Glitch Zone (Stop Timer)"
|
||||
"Glitch Zone (Stop Timer)",
|
||||
"Slay Player"
|
||||
};
|
||||
|
||||
MapZones gMZ_Type[MAXPLAYERS+1];
|
||||
@ -67,6 +68,10 @@ Handle gH_AdminMenu = INVALID_HANDLE;
|
||||
|
||||
bool gB_Late;
|
||||
|
||||
// cvars
|
||||
ConVar gCV_ZoneStyle = null;
|
||||
bool gB_ZoneStyle = false;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "[shavit] Map Zones",
|
||||
@ -117,6 +122,22 @@ public void OnPluginStart()
|
||||
{
|
||||
OnAdminMenuReady(null);
|
||||
}
|
||||
|
||||
// cvars and stuff
|
||||
gCV_ZoneStyle = CreateConVar("shavit_zones_style", "0", "Style for mapzone drawing.\n0 - 3D box\n1 - 2D box");
|
||||
HookConVarChange(gCV_ZoneStyle, OnConVarChanged);
|
||||
|
||||
AutoExecConfig();
|
||||
gB_ZoneStyle = GetConVarBool(gCV_ZoneStyle);
|
||||
}
|
||||
|
||||
public void OnConVarChanged(ConVar cvar, const char[] sOld, const char[] sNew)
|
||||
{
|
||||
// using an if() statement just incase I'll add more cvars.
|
||||
if(cvar == gCV_ZoneStyle)
|
||||
{
|
||||
gB_ZoneStyle = view_as<bool>StringToInt(sNew);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAdminMenuReady(Handle topmenu)
|
||||
@ -212,6 +233,7 @@ public void SetupColors()
|
||||
// glitches - invisible but orange for placement
|
||||
gI_Colors[Zone_Respawn] = {255, 200, 0, 255};
|
||||
gI_Colors[Zone_Stop] = {255, 200, 0, 255};
|
||||
gI_Colors[Zone_Slay] = {255, 200, 0, 255};
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
@ -618,6 +640,13 @@ public Action OnPlayerRunCmd(int client, int &buttons)
|
||||
|
||||
if(bStarted)
|
||||
{
|
||||
if(InsideZone(client, gV_MapZones[Zone_Slay][0], gV_MapZones[Zone_Slay][1]))
|
||||
{
|
||||
Shavit_StopTimer(client);
|
||||
|
||||
ForcePlayerSuicide(client);
|
||||
}
|
||||
|
||||
if(InsideZone(client, gV_MapZones[Zone_Stop][0], gV_MapZones[Zone_Stop][1]))
|
||||
{
|
||||
Shavit_StopTimer(client);
|
||||
@ -715,6 +744,11 @@ public Action Timer_DrawEverything(Handle Timer, any data)
|
||||
vPoints[0] = gV_MapZones[i][0];
|
||||
vPoints[7] = gV_MapZones[i][1];
|
||||
|
||||
if(gB_ZoneStyle)
|
||||
{
|
||||
vPoints[7][2] = vPoints[0][2];
|
||||
}
|
||||
|
||||
CreateZonePoints(vPoints);
|
||||
|
||||
DrawZone(0, vPoints, gI_BeamSprite, 0, gI_Colors[i], 0.10);
|
||||
Loading…
Reference in New Issue
Block a user