mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-05 20:23:20 +00:00
l4d2_avoid_minigun: fix not working on reload
This commit is contained in:
parent
bbe77244cf
commit
372c4a4019
2 changed files with 22 additions and 2 deletions
Binary file not shown.
|
@ -12,6 +12,7 @@
|
|||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include "jutils.inc"
|
||||
|
||||
//#include <sdkhooks>
|
||||
|
||||
static bool bIsSurvivorClient[MAXPLAYERS+1];
|
||||
|
@ -25,6 +26,7 @@ public Plugin myinfo =
|
|||
url = PLUGIN_URL
|
||||
};
|
||||
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
EngineVersion g_Game = GetEngineVersion();
|
||||
|
@ -36,6 +38,24 @@ public void OnPluginStart()
|
|||
HookEvent("player_team", Event_PlayerTeamSwitch);
|
||||
}
|
||||
|
||||
public void OnMapStart() {
|
||||
for(int i = 1; i < MaxClients; i++) {
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2) {
|
||||
bIsSurvivorClient[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientConnected(int client) {
|
||||
if(GetClientTeam(client) == 2) {
|
||||
bIsSurvivorClient[client] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client) {
|
||||
bIsSurvivorClient[client] = false;
|
||||
}
|
||||
|
||||
public void Event_PlayerTeamSwitch(Event event, const char[] name, bool dontBroadcast) {
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
int team = event.GetInt("team");
|
||||
|
@ -52,7 +72,7 @@ public Action CheckTimer(Handle timer) {
|
|||
static int timer_update_pos;
|
||||
if(GetClientCount(true) == 0) return Plugin_Continue;
|
||||
for(int i = 1; i < MaxClients; i++) {
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) && bIsSurvivorClient[i]) {
|
||||
if(bIsSurvivorClient[i] && IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i)) {
|
||||
bool usingMinigun = GetEntProp(i, Prop_Send, "m_usingMountedGun", 1) == 1;
|
||||
bool usingMountedWeapon = GetEntProp(i, Prop_Send, "m_usingMountedWeapon", 1) == 1;
|
||||
|
||||
|
@ -67,7 +87,7 @@ public Action CheckTimer(Handle timer) {
|
|||
}
|
||||
|
||||
for(int bot = 1; bot < MaxClients; bot++) {
|
||||
if(IsClientConnected(bot) && IsClientInGame(i) && IsFakeClient(bot) && bIsSurvivorClient[bot]) {
|
||||
if(bIsSurvivorClient[bot] && IsClientInGame(bot) && IsFakeClient(bot) && IsPlayerAlive(bot)) {
|
||||
float botPos[3];
|
||||
GetClientAbsOrigin(bot, botPos);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue