diff --git a/ZombieRiot/gamedata/zombieriot.txt b/ZombieRiot/gamedata/zombieriot.txt deleted file mode 100644 index 316d7528..00000000 --- a/ZombieRiot/gamedata/zombieriot.txt +++ /dev/null @@ -1,14 +0,0 @@ -"Games" -{ - "csgo" - { - "Offsets" - { - "GetPlayerMaxSpeed" - { - "windows" "498" - "linux" "499" - } - } - } -} \ No newline at end of file diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index eb6c655d..1e5a25bc 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -12,6 +12,7 @@ #include #include #include + #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,108 +87,109 @@ 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_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 - RegConsoleCmd("sm_zmarket", Cmd_zmarket, "weapon Prefferences"); //named like zombiereloaded for ease of use - RegAdminCmd("sm_LoadClasses", Cmd_LoadManually, ADMFLAG_RCON); - RegAdminCmd("sm_wave", Cmd_ChangeWave, ADMFLAG_RCON); - RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); - RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN); + //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", 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 + RegConsoleCmd("sm_zmarket", Cmd_zmarket, "weapon Prefferences"); //named like zombiereloaded for ease of use + RegAdminCmd("sm_LoadClasses", Cmd_LoadManually, ADMFLAG_RCON); + RegAdminCmd("sm_wave", Cmd_ChangeWave, ADMFLAG_RCON); + RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); + RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_LoadManually(int client, int args) { - //LoadClasses(); - AddDownloadContent(); + //LoadClasses(); + AddDownloadContent(); + return Plugin_Handled; } + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_zmarket(int client, int args) { - Zmarket(client); + Zmarket(client); + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_Humanize(int client, int args) { - InfectionSlashHumanHandling(client, args, 0); + InfectionSlashHumanHandling(client, args, 0); + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_Zombienize(int client, int args) { - InfectionSlashHumanHandling(client, args, 1); + InfectionSlashHumanHandling(client, args, 1); + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_Zclass(int client, int args) { - Zclass(client); + Zclass(client); + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_ChangeWave(int client, int args) { - char l_cChangeWave[4]; - int l_iWave; - GetCmdArg(1, l_cChangeWave, sizeof(l_cChangeWave)); - l_iWave = StringToInt(l_cChangeWave); - if (l_iWave > 0) - { - g_iWave = l_iWave; - PrintToChatAll("Admin %N Changing wave to: %i", client, g_iWave); - CS_TerminateRound(4.0, CSRoundEnd_Draw, false); - } - else - { - ReplyToCommand(client, "Incorrect input"); - } + char l_cChangeWave[4]; + int l_iWave; + GetCmdArg(1, l_cChangeWave, sizeof(l_cChangeWave)); + l_iWave = StringToInt(l_cChangeWave); + if (l_iWave > 0) + { + g_iWave = l_iWave; + PrintToChatAll("Admin %N Changing wave to: %i", client, g_iWave); + CS_TerminateRound(4.0, CSRoundEnd_Draw, false); + } + else + { + ReplyToCommand(client, "Incorrect input"); + } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -328,33 +334,36 @@ static void Zclass(int client) ZclassMenu.ExitBackButton = true; ZclassMenu.Display(client, 0); } + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public int Zmarket_menu(Menu menu, MenuAction action, int client, int selection) { - if (action == MenuAction_Select && IsValidClient(client)) - { - ZmarketGetWeapon(client, selection); - } - else if (action == MenuAction_End) - { - delete(menu); - } + if (action == MenuAction_Select && IsValidClient(client)) + { + ZmarketGetWeapon(client, selection); + } + else if (action == MenuAction_End) + { + delete(menu); + } + return 0; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public int Zclass_Menu(Menu menu, MenuAction action, int client, int selection) { - if (action == MenuAction_Select && IsValidClient(client)) - { - ZclassTeamMenu(client, selection); - } - else if (action == MenuAction_End) - { - delete(menu); - } + if (action == MenuAction_Select && IsValidClient(client)) + { + ZclassTeamMenu(client, selection); + } + else if (action == MenuAction_End) + { + delete(menu); + } + return 0; } //---------------------------------------------------------------------------------------------------- // Purpose: //https://forums.alliedmods.net/showthread.php?t=305092 @@ -504,42 +513,44 @@ static void ZclassTeamMenu(int client, int state) //---------------------------------------------------------------------------------------------------- public int Zombieclass_Menu(Menu menu, MenuAction action, int client, int selection) { - if (action == MenuAction_Select && IsValidClient(client)) - { - char l_cInfo[4]; - g_iClientZMClasses[client] = selection + g_iZMBeginindex; - IntToString(g_iClientZMClasses[client], l_cInfo, sizeof(l_cInfo)); - SetClientCookie(client, g_hClientZMCookie, l_cInfo); - if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_T) - { - SelectWaveBasedZM(client, 1); - } - } - else if (action == MenuAction_End) - { - delete(menu); - } + if (action == MenuAction_Select && IsValidClient(client)) + { + char l_cInfo[4]; + g_iClientZMClasses[client] = selection + g_iZMBeginindex; + IntToString(g_iClientZMClasses[client], l_cInfo, sizeof(l_cInfo)); + SetClientCookie(client, g_hClientZMCookie, l_cInfo); + if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_T) + { + SelectWaveBasedZM(client, 1); + } + } + else if (action == MenuAction_End) + { + delete(menu); + } + return 0; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public int Humanclass_Menu(Menu menu, MenuAction action, int client, int selection) { - if (action == MenuAction_Select && IsValidClient(client)) - { - char l_cInfo[4]; - IntToString(selection, l_cInfo, sizeof(l_cInfo)); - SetClientCookie(client, g_hClientHumanCookie, l_cInfo); - g_iClientHumanClasses[client] = selection; - if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_CT) - { - SelectWavebasedHuman(client); - } - } - else if (action == MenuAction_End) - { - delete(menu); - } + if (action == MenuAction_Select && IsValidClient(client)) + { + char l_cInfo[4]; + IntToString(selection, l_cInfo, sizeof(l_cInfo)); + SetClientCookie(client, g_hClientHumanCookie, l_cInfo); + g_iClientHumanClasses[client] = selection; + if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_CT) + { + SelectWavebasedHuman(client); + } + } + else if (action == MenuAction_End) + { + 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: @@ -876,7 +885,8 @@ public Action RetrieveWaveSettings(int wave) //---------------------------------------------------------------------------------------------------- public Action Timer_switchingModel(Handle timer, any data) { - g_bSwitchingIndex = false; + 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"); } @@ -1338,8 +1348,9 @@ public Action Event_OnFullConnect(Event event, const char[] name, bool dontBroad //---------------------------------------------------------------------------------------------------- public Action ApplySettings(Event event, const char[] name, bool dontBroadcast) { - int client = GetClientOfUserId(event.GetInt("userid")); - ApplySettingsEvent(client); + int client = GetClientOfUserId(event.GetInt("userid")); + ApplySettingsEvent(client); + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -1459,149 +1470,151 @@ public Action SelectWaveBasedZM(int client, int state) //---------------------------------------------------------------------------------------------------- public Action ModelSelection(int client, int state, int modelIndex) { - //state 0 = zombie bots, state 1 = zombie players, state 2 = human players - char l_cUniqueModel[g_dLength]; - int l_iModelIndex; - l_iModelIndex = modelIndex; - if (state < 2) - { - Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cZMRoundClasses[l_iModelIndex][g_iLength]); - } - else if (state == 2) - { - Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cHumanClasses[l_iModelIndex][g_iLength]); - } - for (int i = 0; i < g_dIndexes; i++) - { - if (strlen(g_cUniqueName[i][g_iLength]) < 1) - { - continue; - } - if (StrContains(g_cUniqueName[i][g_iLength], l_cUniqueModel, false) > -1) - { - if (StrContains(g_cModelPath[i][g_iLength], "mdl") == -1) - { - //incorrect modelpaths crash at SetEntityModel - LoadClasses(); - ForcePlayerSuicide(client); - return Plugin_Continue; - } - SetEntityModel(client, g_cModelPath[i][g_iLength]); - SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage); - SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); - g_bClientProtection[client] = true; - if (StrContains(g_cNoFallDmg[i][g_iLength], "YES") > -1) - g_bFallDamage[client] = true; - else - g_bFallDamage[client] = false; - if (state < 2) - { - CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, client); - Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 2)); - } - else - { - CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, client); - Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1)); - } - if (state < 2 && RoundFloat(g_fZMHealthScaleability * 10.0) > 0.0) - SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]) * RoundFloat(g_fZMHealthScaleability * 10.0) / 10); - 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]); - return Plugin_Handled; - } - } - return Plugin_Handled; + //state 0 = zombie bots, state 1 = zombie players, state 2 = human players + char l_cUniqueModel[g_dLength]; + int l_iModelIndex; + l_iModelIndex = modelIndex; + if (state < 2) + { + Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cZMRoundClasses[l_iModelIndex][g_iLength]); + } + else if (state == 2) + { + Format(l_cUniqueModel, sizeof(l_cUniqueModel), g_cHumanClasses[l_iModelIndex][g_iLength]); + } + for (int i = 0; i < g_dIndexes; i++) + { + if (strlen(g_cUniqueName[i][g_iLength]) < 1) + { + continue; + } + if (StrContains(g_cUniqueName[i][g_iLength], l_cUniqueModel, false) > -1) + { + if (StrContains(g_cModelPath[i][g_iLength], "mdl") == -1) + { + //incorrect modelpaths crash at SetEntityModel + LoadClasses(); + ForcePlayerSuicide(client); + return Plugin_Continue; + } + SetEntityModel(client, g_cModelPath[i][g_iLength]); + SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage); + SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); + g_bClientProtection[client] = true; + if (StrContains(g_cNoFallDmg[i][g_iLength], "YES") > -1) + g_bFallDamage[client] = true; + else + g_bFallDamage[client] = false; + if (state < 2) + { + CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, client); + Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 2)); + } + else + { + CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, client); + Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1)); + } + if (state < 2 && RoundFloat(g_fZMHealthScaleability * 10.0) > 0.0) + SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength]) * RoundFloat(g_fZMHealthScaleability * 10.0) / 10); + else + SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength])); + g_iSpeedIndex[client] = i; + 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]); + return Plugin_Handled; + } + } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Timer_restrictWeapons(Handle timer, any userid) { - int l_iWeapon; - for(int j = 1; j <= MaxClients; j++) - { - if (IsValidClient(j) && GetClientTeam(j) == CS_TEAM_T) - { - for (int i = 0; i < 5; i++) - { - l_iWeapon = GetPlayerWeaponSlot(j, i); - if (l_iWeapon != -1 && i != 2) - { - RemovePlayerItem(j, l_iWeapon); - } - } - } - } + int l_iWeapon; + for(int j = 1; j <= MaxClients; j++) + { + if (IsValidClient(j) && GetClientTeam(j) == CS_TEAM_T) + { + for (int i = 0; i < 5; i++) + { + l_iWeapon = GetPlayerWeaponSlot(j, i); + if (l_iWeapon != -1 && i != 2) + { + RemovePlayerItem(j, l_iWeapon); + } + } + } + } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Timer_CheckIfBotsStuck(Handle timer, any userid) { - float l_fClientVelocity[3]; - for (int i = 1; i < MaxClients; i++) - { - if (IsValidClient(i) && IsFakeClient(i) && IsPlayerAlive(i)) - { - GetEntPropVector(i, Prop_Data, "m_vecAbsVelocity", l_fClientVelocity); - if (l_fClientVelocity[0] < 30.0 && l_fClientVelocity[0] > -30.0 && - l_fClientVelocity[1] < 30.0 && l_fClientVelocity[1] > -30.0) - { - g_iBotStuckindex[i]++; - } - else - { - g_iBotStuckindex[i] = 0; - } - if (g_iBotStuckindex[i] > g_iBotStuckCounts) - { - l_fClientVelocity[0] -= GetRandomInt(50, 250); - l_fClientVelocity[1] -= GetRandomInt(50, 250); - l_fClientVelocity[2] = g_fBotStuckPush * 5; - Entity_SetAbsVelocity(i, l_fClientVelocity); - g_iBotStuckindex[i] = 0; - } - } - } + float l_fClientVelocity[3]; + for (int i = 1; i < MaxClients; i++) + { + if (IsValidClient(i) && IsFakeClient(i) && IsPlayerAlive(i)) + { + GetEntPropVector(i, Prop_Data, "m_vecAbsVelocity", l_fClientVelocity); + if (l_fClientVelocity[0] < 30.0 && l_fClientVelocity[0] > -30.0 && + l_fClientVelocity[1] < 30.0 && l_fClientVelocity[1] > -30.0) + { + g_iBotStuckindex[i]++; + } + else + { + g_iBotStuckindex[i] = 0; + } + if (g_iBotStuckindex[i] > g_iBotStuckCounts) + { + l_fClientVelocity[0] -= GetRandomInt(50, 250); + l_fClientVelocity[1] -= GetRandomInt(50, 250); + l_fClientVelocity[2] = g_fBotStuckPush * 5; + Entity_SetAbsVelocity(i, l_fClientVelocity); + g_iBotStuckindex[i] = 0; + } + } + } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Timer_zombieSounds(Handle timer, any userid) { - int[] l_clients = new int[MaxClients + 1]; - int l_client; - int l_iclientCount; - int l_iSoundIndexes; - for (int i = 1; i < MaxClients; i++) - { - if (IsValidClient(i) && GetClientTeam(i) == CS_TEAM_T) - { - l_clients[l_iclientCount++] = i; - } - } - l_client = l_clients[GetRandomInt(0, l_iclientCount - 1)]; - l_iSoundIndexes = GetRandomInt(0, g_iSoundIndexes - 1); - /* - PrintToChatAll("emitting sound from client: %N", l_client); - PrintToChatAll("with l_iSoundIndexes: %i", l_iSoundIndexes); - PrintToChatAll("g_cZMSounds[l_iSoundIndexes][g_iLength]: %s", g_cZMSounds[l_iSoundIndexes][g_iLength]); - EmitSound(l_clients, l_iclientCount, g_cZMSounds[l_iSoundIndexes][g_iLength], l_client, SNDCHAN_BODY, SNDLEVEL_NORMAL, SND_NOFLAGS, 0.45, SNDPITCH_NORMAL); - EmitSoundToAll(g_cZMSounds[l_iSoundIndexes][g_iLength]); - */ - for (int i = 1; i < MaxClients; i++) - { - if (IsValidClient(i) && !IsFakeClient(i)) - { - EmitSoundToClient(i, g_cZMSounds[l_iSoundIndexes][g_iLength], l_client); - } - } + int[] l_clients = new int[MaxClients + 1]; + int l_client; + int l_iclientCount; + int l_iSoundIndexes; + for (int i = 1; i < MaxClients; i++) + { + if (IsValidClient(i) && GetClientTeam(i) == CS_TEAM_T) + { + l_clients[l_iclientCount++] = i; + } + } + l_client = l_clients[GetRandomInt(0, l_iclientCount - 1)]; + l_iSoundIndexes = GetRandomInt(0, g_iSoundIndexes - 1); + /* + PrintToChatAll("emitting sound from client: %N", l_client); + PrintToChatAll("with l_iSoundIndexes: %i", l_iSoundIndexes); + PrintToChatAll("g_cZMSounds[l_iSoundIndexes][g_iLength]: %s", g_cZMSounds[l_iSoundIndexes][g_iLength]); + EmitSound(l_clients, l_iclientCount, g_cZMSounds[l_iSoundIndexes][g_iLength], l_client, SNDCHAN_BODY, SNDLEVEL_NORMAL, SND_NOFLAGS, 0.45, SNDPITCH_NORMAL); + EmitSoundToAll(g_cZMSounds[l_iSoundIndexes][g_iLength]); + */ + for (int i = 1; i < MaxClients; i++) + { + if (IsValidClient(i) && !IsFakeClient(i)) + { + EmitSoundToClient(i, g_cZMSounds[l_iSoundIndexes][g_iLength], l_client); + } + } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -1637,8 +1650,9 @@ public Action Timer_Respawn(Handle timer, any userid) //---------------------------------------------------------------------------------------------------- public Action Timer_StopProtection(Handle timer, int client) { - if (IsValidClient(client)) - g_bClientProtection[client] = false; + 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); @@ -1930,4 +1945,4 @@ stock void ReplaceStrings(char[] str, char[] strReplace) stock void FakePrecacheSound(const char[] szPath) { AddToStringTable(FindStringTable("soundprecache"), szPath); -} \ No newline at end of file +}