Raised This Month: $ Target: $400
 0% 

[REQ] Hibernate and Allow bots


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
jgbc3d
Junior Member
Join Date: Apr 2011
Old 01-21-2017 , 14:57   Re: [REQ] Hibernate and Allow bots
Reply With Quote #22

Quote:
Originally Posted by Kolapsicle View Post
In the code I gave you, OnClientAuthorized will turn bots on if a player joins, and OnClientDisconnect will turn bots off when everyone has left. I don't know when you want bots, change the cvars around if you want the inverse.

I added fake client checks which were missing.

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

int g_iPlayerCount 0;

public 
void OnClientAuthorized(int client, const char[] auth)
{
    if (
client && client <= MaxClients && !IsFakeClient(client)) {
        
g_iPlayerCount++;
        
SetConVarInt(FindConVar("sb_all_bot_game"), 1);
    }
}

public 
void OnClientDisconnect(int client)
{
    if (
client && client <= MaxClients && !IsFakeClient(client)) {
        if (--
g_iPlayerCount == 0)
            
SetConVarInt(FindConVar("sb_all_bot_game"), 0);
    }

this code is working so far, and in a better way
jgbc3d is offline
 



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 01:29.


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