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

[L4D1/2] bebop - additional coop players (20+ players possible)


Post New Thread Reply   
 
Thread Tools Display Modes
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 10-15-2014 , 16:44   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #181

Ok, I'll check this out.

And also it would've been great to keep the HookConVarChange since OnPluginStart is only fired once.

I made a plugin checking OnMapStart which gametype is selected so that my plugins are loade/unloaded if necessary.

I might share that later.

++
__________________

*** *** ***
-My plugins-
St00ne is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 10-20-2014 , 23:26   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #182

Don't know why we would have to set flags to protected, and then reset them... so I removed this part.
It could've been nice to keep the log part of the author too. I might re-add this stuff later.
Anyway I'm using this and no pb so far.

PS: this does work on survival and coop modes. I haven't tested it on realism mode yet.
On helms_deep_r21, the 8th player spawns outside, surely because of the 3 bots integrated in this map.

++
Attached Files
File Type: sp Get Plugin or Get Source (bebop_den3ea.sp - 536 views - 5.0 KB)

Last edited by St00ne; 10-31-2014 at 21:11.
St00ne is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 10-23-2014 , 18:39   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #183

when The 5th player joins he dead is there fix for that ?
Krufftys Killers is online now
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 10-24-2014 , 04:31   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #184

It's true that he spawns dead, and has to wait for the next safe room, or sometimes he can be woken up by other players.

For the moment I don't know any fix for that.

But I'll have a look.

++

St00ne
__________________

*** *** ***
-My plugins-
St00ne is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 10-25-2014 , 10:27   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #185

Quote:
Originally Posted by Krufftys Killers View Post
when The 5th player joins he dead is there fix for that ?
Sorry because it's not exactly what you asked, but finally I think I'll stick to this lugin for my server: https://forums.alliedmods.net/showthread.php?p=862618

If you want to edit bebop so that it respawns new players, feel free to edit the script.

++
__________________

*** *** ***
-My plugins-
St00ne is offline
Den_Marko
Junior Member
Join Date: Jul 2013
Old 10-25-2014 , 19:24   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #186

Try this, I corrected)
Attached Files
File Type: smx bebop_den3e.smx (5.8 KB, 252 views)
File Type: sp Get Plugin or Get Source (bebop_den3e.sp - 673 views - 5.2 KB)
__________________

Last edited by Den_Marko; 10-25-2014 at 19:25.
Den_Marko is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 10-26-2014 , 00:01   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #187

Thanks going to test
Krufftys Killers is online now
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 10-26-2014 , 02:23   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #188

Sweet no of the 5th player dead when joining.
Thanks Again Den_Marko works great now.
Krufftys Killers is online now
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 10-26-2014 , 12:28   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #189

Are you serious Den_Marko? >< You just posted my e3 version in which I fixed the timers syntax and game_mode detection!

Nevermind, I also used your simplified version to make it, so... yeah nvm it's open source.

++
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 10-26-2014 at 13:06.
St00ne is offline
Den_Marko
Junior Member
Join Date: Jul 2013
Old 10-28-2014 , 21:56   Re: [L4D1/2] bebop - additional coop players (20+ players possible)
Reply With Quote #190

Quote:
Originally Posted by St00ne View Post
Are you serious Den_Marko? >< You just posted my e3 version in which I fixed the timers syntax and game_mode detection!

Nevermind, I also used your simplified version to make it, so... yeah nvm it's open source.

++
I'm sorry but I just deleted some extra time, you can check out and test their

PHP Code:
#include <sourcemod>
#include <sdktools>

#define TEAM_SPECTATORS    1
#define TEAM_SURVIVORS    2
#define BEBOP_VERSION    "0.3e beta"

new newMapActivatedPlayers;
new 
bool:g_GameMode true;
new 
Handle:gamemodes;
new 
Handle:hGameConf INVALID_HANDLE;
new 
Handle:hSpec INVALID_HANDLE;
new 
Handle:hSwitch INVALID_HANDLE;

public 
Plugin:MyInfo 
{
    
name "bebop",
    
author "frool, Den Marko, St00ne",
    
description "allows \"unlimited\" additional players in coop mode",
    
version BEBOP_VERSION,
    
url "http://forums.alliedmods.net/showthread.php?t=110210"
};

public 
OnPluginStart()
{
    
hGameConf LoadGameConfigFile("bebop");

    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(hGameConfSDKConf_Signature"SetHumanSpec");
    
PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
    
hSpec EndPrepSDKCall();

    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(hGameConfSDKConf_Signature"TakeOverBot");
    
PrepSDKCall_AddParameter(SDKType_BoolSDKPass_Plain);
    
hSwitch EndPrepSDKCall();

    
//GameMode();
    
gamemodes FindConVar("mp_gamemode");
    
HookConVarChange(gamemodes,  Event_GameModeChanges);
    
HookEvent("player_activate"Event_PlayerActivateEventHookMode_Pre);
}

public 
Event_GameModeChanges(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if (
strcmp(oldValuenewValue) != 0)
    {
        
GameMode();
    }
}

GameMode()
{
    
decl String:GameName[64];
    
GetConVarString(gamemodesGameNamesizeof(GameName));
    if((
StrEqual(GameName"coop") == true)
    || (
StrEqual(GameName"realism") == true)
    || (
StrEqual(GameName"survival") == true))
    {
        
g_GameMode true;
    }
    else if((
StrEqual(GameName"versus") == true)
    || (
StrEqual(GameName"teamversus") == true)
    || (
StrEqual(GameName"scavenge") == true)
    || (
StrEqual(GameName"teamscavenge") == true))
    {
        
g_GameMode false;
    }
}

public 
OnMapEnd()
{    
    
newMapActivatedPlayers 0;
}

public 
OnClientDisconnect(client)
{    
    if(
g_GameMode)
    {
        if(
newMapActivatedPlayers 4)
        {
            if (!
IsFakeClient(client))
            {
                new 
count GetHumanInGamePlayerCount() - 1;
                if(
count >= 4)
                {
                    
CreateTimer(1.0Timer_KickNoMoreNeededBot0TIMER_REPEAT);
                }
            }
        }
    }
}

public 
Event_PlayerActivate(Handleevent, const String:name[], bool:dontBroadcast)
{    
    if(
g_GameMode)
    {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        if (!
IsFakeClient(client))
        {
            
newMapActivatedPlayers++;
            new 
count GetHumanInGamePlayerCount();
            if (
count && newMapActivatedPlayers && (GetClientTeam(client) != TEAM_SURVIVORS || GetClientTeam(client) == TEAM_SPECTATORS))
            {
                
SpawnFakeClient();
                
CreateTimer(10.0Timer_PutClientToSurvivorTeamGetClientSerial(client), TIMER_REPEAT);
            }
        }
    }
}

public 
Action:Timer_PutClientToSurvivorTeam(Handle:timerany:serial)
{
    new 
client GetClientFromSerial(serial);
    if (
client && IsClientInGame(client) && !IsFakeClient(client))
    {
        if (
GetClientTeam(client) == TEAM_SPECTATORS)
        {
            new 
bot GetABot();
            if(
bot)
            {
                
SDKCall(hSpecbotclient);
                
SDKCall(hSwitchclienttrue);
            }
        }
    }
    return 
Plugin_Stop;
}

GetABot()
{
    new 
r=0;
    new 
bots=0;
    for(new 
i=1i<MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == TEAM_SURVIVORS
        {
            if( 
IsFakeClient(i) ) r=i;
            
bots++;
        }
    }
    return 
r;
}

public 
Action:Timer_KickNoMoreNeededBot(Handle:timerany:data)
{
    new 
String:    clientname[256];
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientConnected(i))
        {
            if (
IsFakeClient(i) && (GetClientTeam(i) == TEAM_SURVIVORS))
            {
                if(
HasIdlePlayer(i))
                {
                    
GetClientName(iclientnamesizeof(clientname));
                    if (
StrEqual(clientname"NewBot"true))
                    {
                        continue;
                    }
                    
KickClient(i"client_is_NewBot");
                    break;
                }
            }
        }
    }
    return 
Plugin_Stop;
}

public 
Action:Timer_KickFakeClient(Handle:timerany:serial)
{
    new 
client GetClientFromSerial(serial);
    if (
IsClientConnected(client))
    {
        
KickClient(client"client_is_NewBot");
    }
    return 
Plugin_Stop;
}

GetHumanInGamePlayerCount()
{
    new 
count 0;
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientConnected(i))
        {
            if (!
IsFakeClient(i))
            {
                if (
IsClientInGame(i))
                {
                    
count++;
                }
            }
        }
    }
    return 
count;
}

bool:SpawnFakeClient()
{
    new 
bool:ret false;
    new 
client 0;
    
client CreateFakeClient("NewBot");
    if (
client != 0)
    {
        
ChangeClientTeam(client2);
        if (
DispatchKeyValue(client"classname""survivorbot") == true)
        {
            if (
DispatchSpawn(client) == true)
            {
                
CreateTimer(1.0Timer_KickFakeClientGetClientSerial(client), TIMER_REPEAT);
                
ret true;
            }
        }
        if (
ret == false)
        {
            
KickClient(client"");
        }
    }
    return 
ret;
}

stock bool:HasIdlePlayer(bot)
{
    if(
IsValidEntity(bot))
    {
        
decl String:sNetClass[12];
        
GetEntityNetClass(botsNetClasssizeof(sNetClass));
        if(
strcmp(sNetClass"SurvivorBot") == 0)
        {
            if(
GetEntProp(botProp_Send"m_humanSpectatorUserID") == 0)
            {
                return 
true;
            }
            else return 
false;        
        }
        else return 
false
    
}
    return 
false;
}

//***END***/// 
__________________

Last edited by Den_Marko; 10-28-2014 at 21:58.
Den_Marko 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 17:54.


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