Minor improvements

This commit is contained in:
Jackz 2022-06-27 18:04:39 -05:00
parent 13ac15f942
commit 3eab1a8fa4
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
2 changed files with 19 additions and 28 deletions

Binary file not shown.

View file

@ -684,9 +684,10 @@ public void OnConfigsExecuted() {
public void OnSceneStageChanged(int scene, SceneStages stage) {
if(stage == SceneStage_Started) {
char sceneFile[64];
static char sceneFile[64];
GetSceneFile(scene, sceneFile, sizeof(sceneFile));
int activator = GetSceneInitiator(scene);
if(activator == 0) {
if(StrContains(sceneFile, "scenes/mechanic/dlc1_c6m1_initialmeeting") > -1 || StrEqual(sceneFile, "scenes/teengirl/dlc1_c6m1_initialmeeting07.vcd")) {
CancelScene(scene);
}else if(StrEqual(sceneFile, "scenes/teengirl/dlc1_c6m1_initialmeeting13.vcd") && activator == 0) {
@ -694,6 +695,7 @@ public void OnSceneStageChanged(int scene, SceneStages stage) {
}
}
}
}
///AFK BOT WEAPON FIX
public Action Event_BotPlayerSwap(Event event, const char[] name, bool dontBroadcast) {
int bot = GetClientOfUserId(event.GetInt("bot"));
@ -720,7 +722,7 @@ public Action Event_OnWeaponDrop(int client, int weapon) {
static char wpn[32];
GetEdictClassname(weapon, wpn, sizeof(wpn));
if(StrEqual(wpn, "weapon_melee") && GetEntProp(client, Prop_Send, "m_humanSpectatorUserID") > 0) {
#if defined DEBUG 0
#if defined DEBUG
PrintToServer("Bot %N dropped melee weapon %s", client, wpn);
#endif
RequestFrame(Frame_HideEntity, weapon);
@ -743,7 +745,7 @@ public Action Event_OnTakeDamage(int victim, int& attacker, int& inflictor, floa
bool attackerVisible = IsEntityInSightRange(victim, attacker, 130.0, 100.0);
if(!attackerVisible) {
//Zombie is behind the bot, reduce damage taken and slowly kill zombie (1/10 of default hp per hit)
damage = damage / 2.0;
damage /= 2.0;
SDKHooks_TakeDamage(attacker, victim, victim, 10.0);
return Plugin_Changed;
}
@ -753,6 +755,7 @@ public Action Event_OnTakeDamage(int victim, int& attacker, int& inflictor, floa
//MINOR FIXES
public void EntityOutput_OnStartTouchSaferoom(const char[] output, int caller, int client, float time) {
if(client > 0 && client <= MaxClients && IsValidClient(client) && GetClientTeam(client) == 2) {
if(StrEqual(gamemode, "coop", false)) {
if(botDropMeleeWeapon[client] > 0) {
PrintToServer("Giving melee weapon back to %N", client);
float pos[3];
@ -761,7 +764,7 @@ public void EntityOutput_OnStartTouchSaferoom(const char[] output, int caller, i
EquipPlayerWeapon(client, botDropMeleeWeapon[client]);
botDropMeleeWeapon[client] = -1;
}
if(StrEqual(gamemode, "tankrun", false)) {
} else if(StrEqual(gamemode, "tankrun", false)) {
if(!IsFakeClient(client)) {
CreateTimer(1.0, Timer_TPBots, client, TIMER_FLAG_NO_MAPCHANGE);
}
@ -877,15 +880,3 @@ stock int GetAnyValidClient() {
}
return -1;
}
stock int GetIdleBot(int client) {
for(int i = 1; i <= MaxClients; i++ ) {
if(IsClientConnected(i) && HasEntProp(i, Prop_Send, "m_humanSpectatorUserID")) {
int realPlayer = GetClientOfUserId(GetEntProp(i, Prop_Send, "m_humanSpectatorUserID"));
if(realPlayer == client) {
return i;
}
}
}
return -1;
}