AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Kick bots plugin issue , source,error code inside. (https://forums.alliedmods.net/showthread.php?t=297839)

wazer 05-25-2017 07:33

Kick bots plugin issue , source,error code inside.
 
2 Attachment(s)
Having an issue, no clue how to fix it.

Code:

L 05/25/2017 - 13:28:43: [SM] Exception reported: Invalid convar handle 0 (error 4)
L 05/25/2017 - 13:28:43: [SM] Blaming: kick_bots.smx
L 05/25/2017 - 13:28:43: [SM] Call stack trace:
L 05/25/2017 - 13:28:43: [SM]  [0] GetConVarInt
L 05/25/2017 - 13:28:43: [SM]  [1] Line 24, kick_bots.sp::OnClientPutInServer


I provided compiled and script.

Script by Sylwester posted in this thread

Peace-Maker 05-26-2017 00:19

Re: Kick bots plugin issue , source,error code inside.
 
Move the bot_quota convar lookup into OnPluginStart like this
PHP Code:

public OnPluginStart(){
    
g_Cvar_bot_quota FindConVar("bot_quota");



wazer 05-26-2017 19:46

Re: Kick bots plugin issue , source,error code inside.
 
Quote:

Originally Posted by Peace-Maker (Post 2523523)
Move the bot_quota convar lookup into OnPluginStart like this
PHP Code:

public OnPluginStart(){
    
g_Cvar_bot_quota FindConVar("bot_quota");




Oh I just noticed its you the creator of the scrds auto complete addon, I made an issue to on github the other night :)..



So Like this?


PHP Code:

#include <sourcemod>

public Plugin:myinfo = {
    
name "Bot Crash Prevention",
    
author "Sylwester, Peace-Maker",
    
description "prevents server from adding too many bots when players switch teams",
    
version "2.0",
    
url "https://forums.alliedmods.net/showthread.php?t=297839"
}


new 
Handle:g_Cvar_bot_quota INVALID_HANDLE;
new 
g_bot_quota
new g_max_players

public OnPluginStart(){
    
g_Cvar_bot_quota FindConVar("bot_quota");


public 
OnConfigsExecuted(){
    
g_bot_quota GetConVarInt(g_Cvar_bot_quota);
    
g_max_players GetMaxClients();
}

public 
OnClientPutInServer(client){
    if(!
IsFakeClient(client))
        return;
        
    if(
g_bot_quota GetConVarInt(g_Cvar_bot_quota))
        
SetConVarInt(g_Cvar_bot_quotag_bot_quota);
    
    new 
icount;
    for(
1i<=g_max_playersi++)
        if(
IsClientInGame(i) && GetClientTeam(i)>1)
            
count++;
            
    if(
count<=g_bot_quota)
        return;
    
    new 
String:name[32]
    if(!
GetClientName(clientname31))
        return;
    
ServerCommand("bot_kick %s"name);



Peace-Maker 05-27-2017 00:14

Re: Kick bots plugin issue , source,error code inside.
 
Yes. You could remove the g_max_players variable too and replace it with the built in MaxClients variable.

wazer 05-27-2017 18:48

Re: Kick bots plugin issue , source,error code inside.
 
Quote:

Originally Posted by Peace-Maker (Post 2523769)
Yes. You could remove the g_max_players variable too and replace it with the built in MaxClients variable.

I dont know how to ;D

fiction 05-28-2017 10:37

Re: Kick bots plugin issue , source,error code inside.
 
Quote:

Originally Posted by wazer (Post 2524010)
I dont know how to ;D

Spoiler

wazer 05-29-2017 12:10

Re: Kick bots plugin issue , source,error code inside.
 
Quote:

Originally Posted by fiction (Post 2524192)
Spoiler



Thanks will test :=)


All times are GMT -4. The time now is 13:04.

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