remade for CSS zr. csgo is no more anyways. dont need the gamedata over here

This commit is contained in:
jenz 2024-01-28 00:49:36 +01:00
parent e8dcfb5048
commit de83c59171
2 changed files with 267 additions and 266 deletions

View File

@ -1,14 +0,0 @@
"Games"
{
"csgo"
{
"Offsets"
{
"GetPlayerMaxSpeed"
{
"windows" "498"
"linux" "499"
}
}
}
}

View File

@ -12,6 +12,7 @@
#include <dhooks>
#include <clientprefs>
#include <smlib>
#pragma newdecls required
//#pragma dynamic 131072
static char g_cPathsClassHuman[PLATFORM_MAX_PATH];
@ -38,6 +39,7 @@ char g_cZMSounds[g_dIndexes][g_dLength];
char g_cWeaponEntity[g_dIndexes][g_dLength];
char g_cWeaponNames[g_dIndexes][g_dLength];
char g_cWeaponCommand[g_dIndexes][g_dLength];
int g_iLength = g_dLength - 1;
int g_iWave;
int g_iZMScaleability;
@ -56,6 +58,7 @@ int g_iZMBeginindex;
int g_iSoundIndexes;
int g_iWeaponIndex;
int g_iBotStuckCounts;
float g_fKnockBackIndex[g_dIndexes];
float g_fJumpHeightIndex[g_dIndexes];
float g_fJumpDistanceIndex[g_dIndexes];
@ -66,15 +69,17 @@ float g_fZMHealthScaleability;
float g_fRespawnTimer;
float g_fZMSounds;
float g_fBotStuckPush;
bool g_bSwitchingIndex;
bool g_bRoundInProgress;
bool g_bShouldBeHuman[g_dIndexes];
bool g_bShouldBeZM[g_dIndexes];
bool g_bFallDamage[g_dIndexes];
bool g_bClientProtection[g_dIndexes];
Handle g_hGetPlayerMaxSpeed = INVALID_HANDLE;
Handle g_hClientZMCookie;
Handle g_hClientHumanCookie;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -82,44 +87,38 @@ public Plugin myinfo =
{
name = "Unloze Zombie Riot",
author = PLUGIN_AUTHOR,
description = "Zombie Riot mod for CSGO",
description = "Zombie Riot mod. originally for csgo but remade for css",
version = PLUGIN_VERSION,
url = "www.unloze.com"
};
public void OnPluginStart()
{
//gamedata
if (LibraryExists("dhooks"))
{
Handle hGameData = LoadGameConfigFile("zombieriot");
if (hGameData != null)
{
int iOffset = GameConfGetOffset(hGameData, "GetPlayerMaxSpeed");
if (iOffset != -1)
g_hGetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, DHook_GetPlayerMaxSpeed);
delete hGameData;
}
}
//processstring
LoadTranslations("common.phrases.txt");
//cookies
if (g_hClientZMCookie == null)
g_hClientZMCookie = RegClientCookie("unloze_zr_classprefZM", "Cookie for ZM classes", CookieAccess_Protected);
if (g_hClientHumanCookie == null)
g_hClientHumanCookie = RegClientCookie("unloze_zr_classprefHuman", "Cookie for Human classes", CookieAccess_Protected);
BuildPath(Path_SM, g_cPathsClassZM, sizeof(g_cPathsClassZM), "configs/unloze_zr/classeszm.txt");
BuildPath(Path_SM, g_cPathsClassHuman, sizeof(g_cPathsClassHuman), "configs/unloze_zr/classeshuman.txt");
BuildPath(Path_SM, g_cPathsExtra, sizeof(g_cPathsExtra), "configs/unloze_zr/extra.txt");
BuildPath(Path_SM, g_cPathsDownload, sizeof(g_cPathsDownload), "configs/unloze_zr/download.txt");
BuildPath(Path_SM, g_cPathsWaveSettings, sizeof(g_cPathsWaveSettings), "configs/unloze_zr/wavesettings.txt");
BuildPath(Path_SM, g_cPathsWeapons, sizeof(g_cPathsWeapons), "configs/unloze_zr/weapons.txt");
//hooks
HookEvent("player_spawn", ApplySettings, EventHookMode_Post);
HookEvent("round_start", Event_roundStart, EventHookMode_Post);
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Post);
HookEvent("player_connect_full", Event_OnFullConnect, EventHookMode_Pre);
HookEvent("player_connect", Event_OnFullConnect, EventHookMode_Pre);
HookEvent("player_hurt", EventPlayerHurt, EventHookMode_Pre);
HookEvent("player_jump", EventPlayerJump, EventHookMode_Post);
//commands
RegConsoleCmd("say", Cmd_Say);
RegConsoleCmd("sm_zclass", Cmd_Zclass, "Class Prefferences"); //named like zombiereloaded for ease of use
@ -136,13 +135,16 @@ public Action Cmd_LoadManually(int client, int args)
{
//LoadClasses();
AddDownloadContent();
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Cmd_zmarket(int client, int args)
{
Zmarket(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -150,6 +152,7 @@ public Action Cmd_zmarket(int client, int args)
public Action Cmd_Humanize(int client, int args)
{
InfectionSlashHumanHandling(client, args, 0);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -157,6 +160,7 @@ public Action Cmd_Humanize(int client, int args)
public Action Cmd_Zombienize(int client, int args)
{
InfectionSlashHumanHandling(client, args, 1);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -164,6 +168,7 @@ public Action Cmd_Zombienize(int client, int args)
public Action Cmd_Zclass(int client, int args)
{
Zclass(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -184,6 +189,7 @@ public Action Cmd_ChangeWave(int client, int args)
{
ReplyToCommand(client, "Incorrect input");
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -328,6 +334,7 @@ static void Zclass(int client)
ZclassMenu.ExitBackButton = true;
ZclassMenu.Display(client, 0);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -341,6 +348,7 @@ public int Zmarket_menu(Menu menu, MenuAction action, int client, int selection)
{
delete(menu);
}
return 0;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -355,6 +363,7 @@ public int Zclass_Menu(Menu menu, MenuAction action, int client, int selection)
{
delete(menu);
}
return 0;
}
//----------------------------------------------------------------------------------------------------
// Purpose: //https://forums.alliedmods.net/showthread.php?t=305092
@ -519,6 +528,7 @@ public int Zombieclass_Menu(Menu menu, MenuAction action, int client, int select
{
delete(menu);
}
return 0;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -540,6 +550,7 @@ public int Humanclass_Menu(Menu menu, MenuAction action, int client, int selecti
{
delete(menu);
}
return 0;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -850,8 +861,6 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
}
}
}
if (l_iHumanPlayers < 1)
ServerCommand("bot_kick");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -877,6 +886,7 @@ public Action RetrieveWaveSettings(int wave)
public Action Timer_switchingModel(Handle timer, any data)
{
g_bSwitchingIndex = false;
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1064,7 +1074,7 @@ public void SettingBotQoute(int botscale)
int l_iPlayers;
for (int i = 1; i < MaxClients; i++)
{
if (IsValidClient(i) && !IsFakeClient(i))
if (IsValidClient(i) && !IsFakeClient(i) && CS_TEAM_CT == GetClientTeam(i))
{
l_iPlayers++;
}
@ -1076,10 +1086,10 @@ public void SettingBotQoute(int botscale)
//----------------------------------------------------------------------------------------------------
public void addBots(int botcount)
{
ServerCommand("bot_kick");
//ServerCommand("bot_kick");
for (int i = 0; i < botcount; i++)
{
if (i > 32)
if (i > 44) //probably will be turned into a convar somewhen.
continue;
ServerCommand("bot_add_t");
}
@ -1340,6 +1350,7 @@ public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
ApplySettingsEvent(client);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1509,7 +1520,6 @@ public Action ModelSelection(int client, int state, int modelIndex)
else
SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]));
g_iSpeedIndex[client] = i;
DHookEntity(g_hGetPlayerMaxSpeed, true, client);
g_fKnockBackIndex[client] = StringToFloat(g_cKnockback[i][g_iLength]);
g_fJumpHeightIndex[client] = StringToFloat(g_cJumpHeight[i][g_iLength]);
g_fJumpDistanceIndex[client] = StringToFloat(g_cJumpDistance[i][g_iLength]);
@ -1538,6 +1548,7 @@ public Action Timer_restrictWeapons(Handle timer, any userid)
}
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1569,6 +1580,7 @@ public Action Timer_CheckIfBotsStuck(Handle timer, any userid)
}
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1602,6 +1614,7 @@ public Action Timer_zombieSounds(Handle timer, any userid)
EmitSoundToClient(i, g_cZMSounds[l_iSoundIndexes][g_iLength], l_client);
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1639,6 +1652,7 @@ public Action Timer_StopProtection(Handle timer, int client)
{
if (IsValidClient(client))
g_bClientProtection[client] = false;
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@ -1786,7 +1800,7 @@ public void KnockbackSetVelocity(int client, const float startpoint[3], const fl
vector[2] = CSGO_KNOCKBACK_BOOST;
}
}
// ADD the given vector to the client's current velocity. tools_functions.inc
// ADD the given vector to the clients current velocity. tools_functions.inc
ToolsClientVelocity(client, vector);
}
//----------------------------------------------------------------------------------------------------
@ -1815,7 +1829,7 @@ public int KnockbackFindExplodingGrenade(float heLoc[3])
{
continue;
}
// If entity isn't a grenade, then stop.
// If entity isnt a grenade, then stop.
GetEdictClassname(x, l_cClassname, sizeof(l_cClassname));
if (!StrEqual(l_cClassname, "hegrenade_projectile", false))
{
@ -1831,7 +1845,7 @@ public int KnockbackFindExplodingGrenade(float heLoc[3])
return x;
}
}
// Didn't find the grenade.
// Didnt find the grenade.
return -1;
}
//----------------------------------------------------------------------------------------------------
@ -1843,10 +1857,11 @@ public Action EventPlayerJump(Handle event, const char[] name, bool dontBroadcas
int index = GetClientOfUserId(GetEventInt(event, "userid"));
// Fire post player_jump event.
CreateTimer(0.0, EventPlayerJumpPost, index);
return Plugin_Handled;
}
public Action EventPlayerJumpPost(Handle timer, int client)
{
// If client isn't in-game, then stop.
// If client isnt in-game, then stop.
if (!IsClientInGame(client))
{
return Plugin_Handled;
@ -1861,7 +1876,7 @@ public Action EventPlayerJumpPost(Handle timer, int client)
return Plugin_Continue;
}
float vecVelocity[3];
// Get client's current velocity.
// Get clients current velocity.
ToolsClientVelocity(client, vecVelocity, false);
//maybe check JumpBoostIsBHop here
@ -1894,17 +1909,17 @@ stock void ToolsGetClientVelocity(int client, float vecVelocity[3])
//----------------------------------------------------------------------------------------------------
stock void ToolsClientVelocity(int client, float vecVelocity[3], bool apply = true, bool stack = true)
{
// If retrieve is true, then get client's velocity.
// If retrieve is true, then get clients velocity.
if (!apply)
{
ToolsGetClientVelocity(client, vecVelocity);
// Stop here.
return;
}
// If stack is true, then add client's velocity.
// If stack is true, then add clients velocity.
if (stack)
{
// Get client's velocity.
// Get clients velocity.
float vecClientVelocity[3];
ToolsGetClientVelocity(client, vecClientVelocity);
AddVectors(vecClientVelocity, vecVelocity, vecVelocity);