Raised This Month: $7 Target: $400
 1% 

Solved Can a coder help me fix this bug in this Plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SEGA EMPRESS ERIS
Senior Member
Join Date: Sep 2010
Location: THE-MILKY-WAY-GALAXY
Old 08-14-2020 , 18:59   Can a coder help me fix this bug in this Plugin?
Reply With Quote #1

OK there is a bug in this L4D2 Plugin basically it updates the entity counts in the maps on load and on map change well when u transition to the next map it doesnt update ent counts in safe room unless u die and restart then the ent counts are updated. i was wondering if a coder with some spare time could code in this plugin a fix that makes it update the ent counts on every map transition as opposed to it only updating ent counts on map restart or on first map load.

thank you!

here is the plugin code:

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

#define PLUGIN_VERSION "1.0.0"

new Handle:double_item_on;

public 
Plugin:myinfo =
{
    
name "l4d2additemsbots",
    
author "sonnzy",
    
description "add survivor bots increase item count",
    
version PLUGIN_VERSION,
    
url "sourcemod.net"
};

public 
OnPluginStart()
{
    
double_item_on CreateConVar("double_item_on""1","double item supply is on|off",FCVAR_PLUGIN|FCVAR_NOTIFY);
    
RegAdminCmd("sm_addbot"CmdAddBotADMFLAG_ROOT);

    
AutoExecConfig(true"l4d2additemsbots")

    
HookEvent("round_start"RoundStartEventHookMode_Post);
}

public 
Action:CmdAddBot(clientargs)
{
    new 
Handle:menu CreateMenu(addbotmenu);
    
SetMenuTitle(menu"l4d2 clientaddbots menu");
    
AddMenuItem(menu"option0""add survivor bot");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
    
//return;
}

public 
addbotmenu(Handle:menuMenuAction:actionclientitemNum)
{
    if(
action == MenuAction_Select)
    {
        switch (
itemNum)
        {
            case 
0//adding a survivor bot
            
{
                new 
survivorbot CreateFakeClient("survivor bot");
                
ChangeClientTeam(survivorbot,2);
                
DispatchKeyValue(survivorbot,"classname","SurvivorBot");
                
DispatchSpawn(survivorbot);
                
//now to make a timer to kick the client
                
CreateTimer(1.0SurvivorKicker,survivorbot);
            }
        }
    }
}

public 
Action:SurvivorKicker(Handle:timerany:value)
{
    
KickClient(value,"survivor bot");
    return 
Plugin_Continue;
}

public 
RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(
GetConVarInt(double_item_on) == 1)
    {
        
CreateTimer(3.0UpdateCounts0);
    }    
}

public 
Action:UpdateCounts(Handle:timer)
{

    
// Increases map spawned entity count.
    
UpdateEntCount("weapon_autoshotgun_spawn","17");
    
UpdateEntCount("weapon_hunting_rifle_spawn","17");
    
UpdateEntCount("weapon_pistol_spawn","17");
    
UpdateEntCount("weapon_pistol_magnum_spawn","17");
    
UpdateEntCount("weapon_pumpshotgun_spawn","17");
    
UpdateEntCount("weapon_rifle_spawn","17");
    
UpdateEntCount("weapon_rifle_ak47_spawn","17");
    
UpdateEntCount("weapon_rifle_desert_spawn","17");
    
UpdateEntCount("weapon_rifle_sg552_spawn","17");
    
UpdateEntCount("weapon_shotgun_chrome_spawn","17");
    
UpdateEntCount("weapon_shotgun_spas_spawn","17");
    
UpdateEntCount("weapon_smg_spawn","17");
    
UpdateEntCount("weapon_smg_mp5_spawn","17");
    
UpdateEntCount("weapon_smg_silenced_spawn","17");
    
UpdateEntCount("weapon_sniper_awp_spawn","17");
    
UpdateEntCount("weapon_sniper_military_spawn","17");
    
UpdateEntCount("weapon_sniper_scout_spawn","17");
    
UpdateEntCount("weapon_rifle_m60_spawn""8");
    
UpdateEntCount("weapon_grenade_launcher_spawn""8");
    
UpdateEntCount("weapon_spawn""17");    //random new l4d2 weapon

    
UpdateEntCount("weapon_chainsaw_spawn""8");
    
UpdateEntCount("weapon_defibrillator_spawn""8")
    
UpdateEntCount("weapon_first_aid_kit_spawn""8");
    
UpdateEntCount("weapon_melee_spawn""8");


    
    
// pistol spawns come in two flavors stacks of 5, or multiple singles props
    
UpdateEntCount("weapon_pistol_spawn""16"); // defaults 1/4/5
    
    // StripAndChangeServerConVarInt("director_pain_pill_density", 12);  // default 6
    
return Plugin_Handled;
    
}

public 
UpdateEntCount(const String:entname[], const String:count[])
{
    
// LogAction(0, -1, "DEBUG:updateentcount");
    
new edict_index FindEntityByClassname(-1entname);
    while(
edict_index != -1)
    {
        
DispatchKeyValue(edict_index"count"count);
        
edict_index FindEntityByClassname(edict_indexentname);
    }

Attached Files
File Type: smx l4d2additemsbots.smx (5.8 KB, 23 views)
File Type: sp Get Plugin or Get Source (l4d2additemsbots.sp - 78 views - 3.5 KB)
__________________

Last edited by SEGA EMPRESS ERIS; 01-31-2021 at 21:54. Reason: put plugin up to download so problem can be easily addressed in the code.
SEGA EMPRESS ERIS is offline
SEGA EMPRESS ERIS
Senior Member
Join Date: Sep 2010
Location: THE-MILKY-WAY-GALAXY
Old 08-22-2020 , 20:08   Re: Can a coder help me fix this bug in this Plugin?
Reply With Quote #2

Can anyone help with this? Basically it doesnt update ent counts in Left 4 Dead 2 safe room on first transition to the 2nd map and so on was wondering if somoene knew how to fix that. However they are updated after u die on the map in saferoom.

Thank you.
__________________

Last edited by SEGA EMPRESS ERIS; 08-22-2020 at 20:45.
SEGA EMPRESS ERIS is offline
Reply


Thread Tools
Display Modes

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 22:14.


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