Raised This Month: $51 Target: $400
 12% 

[L4D/L4D2] VS Bug Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Tank Rush
Senior Member
Join Date: May 2019
Location: Argentina
Old 02-03-2021 , 19:56   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #21

Can anyone remove god mode from this plugin?
__________________
Sorry i don't speak english very well

--->My name is Source and I'm on Steam<---
Discord: Source#9382
Tank Rush is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-03-2021 , 20:38   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #22

Just do this in the God call.

PHP Code:
public God(clientbool:value)
{
    return;

__________________
Marttt is offline
Tank Rush
Senior Member
Join Date: May 2019
Location: Argentina
Old 02-07-2021 , 08:05   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #23

Quote:
Originally Posted by Marttt View Post
Just do this in the God call.

PHP Code:
public God(clientbool:value)
{
    return;

This works, but bots must be unfrozen when a player joins the survivors
What should i change?

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "2.9.3"
#define SURVIVOR 2
#define INFECTED 3

new LeftSafe 0;
new 
Started[MAXPLAYERS 1];
new 
HumanMoved 0;
new 
Handle:g_hGameMode INVALID_HANDLE;

new 
sb_all_bot_type 1;

// Plugin info
public Plugin:myinfo 
{
    
name "[L4D/L4D2] VS Bug Fix",
    
author "Pescoxa",
    
description "Fix for Versus Server shutting down and Bots starting without players",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=126940"
};

public 
OnPluginStart()
{

    
decl String:gameMod[32];
    
GetGameFolderName(gameModsizeof(gameMod));
    if((!
StrEqual(gameMod"left4dead"false)) && (!StrEqual(gameMod"left4dead2"false)))
    {
        
SetFailState("VS Bug Fix supports L4D and L4D2 only.");
    }

    if((
StrEqual(gameMod"left4dead"false)))
    {
        
sb_all_bot_type 1;
    }
    else
    {
        
sb_all_bot_type 2;
    }

    
CreateConVar("sm_vsbugfix_version"PLUGIN_VERSION"[L4D/L4D2] VS Bug Fix"FCVAR_PLUGIN FCVAR_SPONLY FCVAR_NOTIFY);

    
LeftSafe 0;
    
SetStarted(0);

    
LoadTranslations("l4d_sm_vsbugfix.phrases");

    
RegAdminCmd("sm_unfreezebots"Command_UnfreezeBotsADMFLAG_CUSTOM1);
    
    
HookEvent("round_start"Event_Round_StartEventHookMode_Post);
    
HookEvent("round_end",Event_Round_EndEventHookMode_Post);
    
HookEvent("player_team"Event_Join_TeamEventHookMode_Post);
    
HookEvent("player_left_checkpoint"Event_Left_CheckPointEventHookMode_Post);
    
    
g_hGameMode FindConVar("mp_gamemode");
    
HookConVarChange(g_hGameMode,CvarChanged_GameMode);
        
}

public 
Init()
{
    if (
IsValidMode())
    {
        if (
sb_all_bot_type == 2)
        { 
            
SetConVarInt(FindConVar("sb_all_bot_game"), 1);
        }
        else
        {
            
SetConVarInt(FindConVar("sb_all_bot_team"), 1);
        }

        if (
LeftSafe == 0)
        {
            
SetConVarInt(FindConVar("sb_stop"), 1);
            
SetConVarInt(FindConVar("director_ready_duration"), 0);
            
SetConVarInt(FindConVar("director_no_mobs"), 1);
        }
        else
        {
            
SetConVarInt(FindConVar("sb_stop"), 0);
            
ResetConVar(FindConVar("director_ready_duration"));
            
ResetConVar(FindConVar("director_no_mobs"));
        }
    }
    else
    {
        if (
sb_all_bot_type == 2)
        { 
            
SetConVarInt(FindConVar("sb_all_bot_game"), 0);
        }
        else
        {
            
SetConVarInt(FindConVar("sb_all_bot_team"), 0);
        }
        
SetConVarInt(FindConVar("sb_stop"), 0);
        
ResetConVar(FindConVar("director_ready_duration"));
        
ResetConVar(FindConVar("director_no_mobs"));
    }
}

public 
SetStarted(Value)
{
  new 
maxplayers GetMaxClients();
  for (new 
1<= maxplayersi++)
      
Started[i] = Value;
}

public 
IsValidMode()
{
    new 
String:gmode[32];
    
GetConVarString(FindConVar("mp_gamemode"), gmodesizeof(gmode));

    if ((
strcmp(gmode"versus"false) == 0) || (strcmp(gmode"teamversus"false) == 0) || (strcmp(gmode"scavenge"false) == 0) || (strcmp(gmode"teamscavenge"false) == 0) || (strcmp(gmode"mutation12"false) == 0))
    {
        return 
true;
    }
    else
    {
        return 
false;
    }
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// BEGIN: COMMANDS
///////////////////////////////////////////////////////////////////////////////////////////////////
public Action:Command_UnfreezeBots(clientargs)
{

    
RunUnfreeze(client);
    
ReplyToCommand(client"\x04[VBF] \x01%T""BOTsAreUnfrozen."client);

}
///////////////////////////////////////////////////////////////////////////////////////////////////
// END: COMMANDS
///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
// BEGIN: GOD FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////
public God(clientbool:value)
{
    return;


public 
Action:TimerGod(Handle:timerany:client)
{
    if (
LeftSafe == 0)
        
God(clienttrue);
    else
        
God(clientfalse);
}

public 
Action:TimerUnGod(Handle:timerany:client)
{
    
God(clientfalse);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// END: GOD FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
// BEGIN: FREEZE AND UNFREEZE FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////
public FreezeAllSurvivorBOT()
{
    for (new 
1<= GetMaxClients(); i++)
    {
    
        if (!
IsValidEntity(i))
        {
            continue;
        }
        
        if (!
IsClientConnected(i) || IsClientInKickQueue(i))
        {
            continue;
        }
        
        if (!
IsClientInGame(i))
        {
            continue;
        }
        
        if (!
IsFakeClient(i))
        {
            continue;
        }
        
        if (
GetClientTeam(i) != SURVIVOR)
        {
            continue;
        }
        
        
Freeze(i);
    }
    
    if (
LeftSafe == 0)
    {
        
SetConVarInt(FindConVar("sb_stop"), 1);
    }
}

public 
UnFreezeAll()
{
    for (new 
1<= GetMaxClients(); i++)
    {
    
        if (!
IsValidEntity(i))
        {
            continue;
        }
        
        if (!
IsClientConnected(i) || IsClientInKickQueue(i))
        {
            continue;
        }
        
        if (!
IsClientInGame(i))
        {
            continue;
        }
        
        if (
GetClientTeam(i) == 1)
        {
            continue;
        }
        
        
UnFreeze(i);
        
God(ifalse);
    }
    
    
SetConVarInt(FindConVar("sb_stop"), 0);
}

public 
FreezeUnFreezeClient(clientclientTeam)
{
    
    if(
client == 0)
        return;
    
    if(!
IsValidEntity(client))
        return;
    
    if(!
IsClientConnected(client))
        return;
    
    if(
IsFakeClient(client))
    {
        if(
clientTeam == SURVIVOR)
        {
            if(
LeftSafe != 1)
            {
                
CreateTimer(0.5TimerFreezeclient);
            }
        }
        return;
    }
    else
    {
        
CreateTimer(0.5TimerUnFreezeclient);
        return;
    }
}

public 
Freeze(client)
{
    if((
client 0) &&IsValidEntity(client) && IsClientConnected(client) && IsClientInGame(client))
        
SetEntityMoveType(clientMOVETYPE_NONE);
}

public 
UnFreeze(client)
{
    if((
client 0) && IsValidEntity(client) && IsClientConnected(client) && IsClientInGame(client))
        
SetEntityMoveType(clientMOVETYPE_WALK);
}

public 
Action:TimerFreeze(Handle:timerany:client)
{
    
FreezeAllSurvivorBOT();
}

public 
Action:TimerUnFreeze(Handle:timerany:client)
{
    
UnFreeze(client);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// END: FREEZE AND UNFREEZE FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
// BEGIN: EVENTS THAT CONTROLS THE PLUGIN
///////////////////////////////////////////////////////////////////////////////////////////////////
public CvarChanged_GameMode(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
Init();
}

public 
Action:Event_Round_Start(Handle:event, const String:name[], bool:dontBroadcast)
{
    
LeftSafe 0;
    
SetStarted(0);
    
HumanMoved 0;
    
    
Init();
    
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
buttons IN_MOVELEFT || buttons IN_BACK || buttons IN_FORWARD || buttons IN_MOVERIGHT || buttons IN_USE)
    {
        if ((
client 0) && IsValidEntity(client) && IsClientConnected(client) && IsClientInGame(client) && (GetClientTeam(client) == SURVIVOR))
        {
            if (!
IsFakeClient(client))
                
HumanMoved 1;
            if (
HumanMoved == 1)
            {
                
Started[client] = 1;
            }
        }
    }
    return 
Plugin_Continue;
}

public 
Event_Left_CheckPoint(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
entity GetEventInt(event"entityid");
    
//new area = GetEventInt(event, "area");
    
new client GetClientOfUserId(GetEventInt(event"userid"));
    
    if ((
Started[client] > 0) && (client 0) && (entity == 0) && (LeftSafe == 0))
    {
        
CreateTimer(0.5OnLeftSafeAreaclient);
    }
}

public 
Action:OnLeftSafeArea(Handle:timerany:client)
{

    if (
client == || !IsClientInGame(client))
        return;

    if (
GetClientTeam(client) != SURVIVOR)
    {
        
Started[client] = 0;
        return;
    }

    
RunUnfreeze(client);
        
}

public 
RunUnfreeze(client)
{
    
LeftSafe 1;
    
SetStarted(1);
    
    
UnFreezeAll();
    
SetConVarInt(FindConVar("sb_stop"), 0);
    
ResetConVar(FindConVar("director_ready_duration"));
    
ResetConVar(FindConVar("director_no_mobs"));
}

public 
Event_Join_Team(Handle:eventString:event_name[], bool:dontBroadcast)
{
    new 
userid GetEventInt(event"userid");
    new 
client GetClientOfUserId(userid);
    new 
clientTeam GetEventInt(event"team");
    
FreezeUnFreezeClient(clientclientTeam);
    
    if (
LeftSafe == 0)
    {
        if (
clientTeam == SURVIVOR)
            
CreateTimer(0.5TimerGodclient);
        else if (
clientTeam == INFECTED)
            
CreateTimer(0.5TimerUnGodclient);

        
SetStarted(0);
    }
}

public 
Action:Event_Round_End(Handle:event, const String:name[], bool:dontBroadcast)
{
    
LeftSafe 0;
    
SetStarted(0);
    
HumanMoved 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// END: EVENTS THAT CONTROLS THE PLUGIN
/////////////////////////////////////////////////////////////////////////////////////////////////// 
__________________
Sorry i don't speak english very well

--->My name is Source and I'm on Steam<---
Discord: Source#9382
Tank Rush is offline
leaffan
Senior Member
Join Date: Jan 2013
Old 03-02-2021 , 10:17   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #24

When will the update come? --> https://forums.alliedmods.net/showthread.php?t=321696

I am writing with (Google Translate).
leaffan is offline
in2002
Member
Join Date: Apr 2021
Location: Taiwan
Old 07-19-2021 , 08:42   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #25

Is there a newer version
in2002 is offline
leaffan
Senior Member
Join Date: Jan 2013
Old 04-21-2023 , 17:56   Re: [L4D/L4D2] VS Bug Fix
Reply With Quote #26

Is there a more recent version?
leaffan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode