Raised This Month: $ Target: $400
 0% 

[L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)


Post New Thread Reply   
 
Thread Tools Display Modes
Iciaria
Member
Join Date: Aug 2022
Old 11-05-2022 , 08:59   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #261

Quote:
Originally Posted by kissdjmax View Post
Great, l4d2_spawn_props_autoload "1" works normally. But there is still a slight flaw. An error log is generated when the server is started for the first time. Sorry for not knowing English.

HTML Code:
L 10/07/2020 - 13:34:11: Error log file session closed.
L 10/07/2020 - 13:34:13: SourceMod error session started
L 10/07/2020 - 13:34:13: Info (map "c2m2_fairgrounds") (file "E:\Game\Server_L4D2\L4D2\left4dead2\addons\sourcemod\logs\errors_20201007.log")
L 10/07/2020 - 13:34:13: [l4d2_spawn_props.smx] Attempted to load an object file which does not exist (addons\sourcemod\..\stripper\plugin_cache\.txt)
L 10/07/2020 - 13:34:16: Error log file session closed.
Quote:
Originally Posted by Hawkins View Post
Put the timer in "public void OnMapStart()" instead of in "round_start" event
This will not solve the problem I mentioned
Now, changing the map will not load the configuration and will throw an error
Maybe I did something wrong?
Code:
L 11/05/2022 - 20:54:06: SourceMod error session started
L 11/05/2022 - 20:54:06: Info (map "c9m1_alleys") (file "XX/left4dead2/addons/sourcemod/logs/errors_20221105.log")
L 11/05/2022 - 20:54:06: [l4d2_spawn_props.smx] Attempted to load an object file which does not exist (addons/sourcemod/../stripper/plugin_cache/.txt)
L 11/05/2022 - 20:54:59: Error log file session closed.
L 11/05/2022 - 20:55:00: SourceMod error session started
L 11/05/2022 - 20:55:00: Info (map "c9m1_alleys") (file "XX/left4dead2/addons/sourcemod/logs/errors_20221105.log")
L 11/05/2022 - 20:55:00: [SM] Exception reported: Cannot create new entity when no map is running
L 11/05/2022 - 20:55:00: [SM] Blaming: l4d2_spawn_props.smx
L 11/05/2022 - 20:55:00: [SM] Call stack trace:
L 11/05/2022 - 20:55:00: [SM]   [0] CreateEntityByName
L 11/05/2022 - 20:55:00: [SM]   [1] Line 4068, l4d2_spawn_props.sp::SpawnObjects
L 11/05/2022 - 20:55:00: [SM]   [2] Line 438, l4d2_spawn_props.sp::Event_RoundStart
PHP Code:
public Action tOnMapStart(Handle timer)
{
        
PrintToServer("------------------------Load Plugin Cache----------------------");
        return 
Plugin_Continue;
}

public 
void OnMapStart()
{
        
CreateTimer(2.0,tOnMapStart);
        for(
int i=MaxClientsMAX_ENTITYi++)
        {
                
g_bSpawned[i] = false;
                
g_bUnsolid[i] = false;
                
g_vecEntityAngles[i][0] = 0.0;
                
g_vecEntityAngles[i][1] = 0.0;
                
g_vecEntityAngles[i][2] = 0.0;
        }
        if(
g_cvarAutoload.BoolValue && !g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }

        
int max MAX_WEAPONS;
        if( 
g_bLeft4Dead2 max MAX_WEAPONS2;
        for( 
int i 0maxi++ )
        {
                
PrecacheModel(g_bLeft4Dead2 g_sWeaponModels2[i] : g_sWeaponModels[i], true);
        }

        
PrecacheModel(MODEL_AMMO_L4Dtrue);
        
PrecacheModel(MODEL_AMMO_L4D2true);
        
PrecacheModel(MODEL_AMMO_L4D3true);
        if( 
g_bLeft4Dead2 PrecacheModel(MODEL_LASERtrue);

        if( 
g_bLeft4Dead2 )
        {
                
PrecacheModel("models/weapons/melee/v_bat.mdl"true);
                
PrecacheModel("models/weapons/melee/v_cricket_bat.mdl"true);
                
PrecacheModel("models/weapons/melee/v_crowbar.mdl"true);
                
PrecacheModel("models/weapons/melee/v_electric_guitar.mdl"true);
                
PrecacheModel("models/weapons/melee/v_fireaxe.mdl"true);
                
PrecacheModel("models/weapons/melee/v_frying_pan.mdl"true);
                
PrecacheModel("models/weapons/melee/v_golfclub.mdl"true);
                
PrecacheModel("models/weapons/melee/v_katana.mdl"true);
                
PrecacheModel("models/weapons/melee/v_machete.mdl"true);
                
PrecacheModel("models/weapons/melee/v_tonfa.mdl"true);
                
PrecacheModel("models/weapons/melee/v_pitchfork.mdl"true);
                
PrecacheModel("models/weapons/melee/v_shovel.mdl"true);

                
PrecacheModel("models/weapons/melee/w_bat.mdl"true);
                
PrecacheModel("models/weapons/melee/w_cricket_bat.mdl"true);
                
PrecacheModel("models/weapons/melee/w_crowbar.mdl"true);
                
PrecacheModel("models/weapons/melee/w_electric_guitar.mdl"true);
                
PrecacheModel("models/weapons/melee/w_fireaxe.mdl"true);
                
PrecacheModel("models/weapons/melee/w_frying_pan.mdl"true);
                
PrecacheModel("models/weapons/melee/w_golfclub.mdl"true);
                
PrecacheModel("models/weapons/melee/w_katana.mdl"true);
                
PrecacheModel("models/weapons/melee/w_machete.mdl"true);
                
PrecacheModel("models/weapons/melee/w_tonfa.mdl"true);
                
PrecacheModel("models/weapons/melee/w_pitchfork.mdl"true);
                
PrecacheModel("models/weapons/melee/w_shovel.mdl"true);

                
PrecacheGeneric("scripts/melee/baseball_bat.txt"true);
                
PrecacheGeneric("scripts/melee/cricket_bat.txt"true);
                
PrecacheGeneric("scripts/melee/crowbar.txt"true);
                
PrecacheGeneric("scripts/melee/electric_guitar.txt"true);
                
PrecacheGeneric("scripts/melee/fireaxe.txt"true);
                
PrecacheGeneric("scripts/melee/frying_pan.txt"true);
                
PrecacheGeneric("scripts/melee/golfclub.txt"true);
                
PrecacheGeneric("scripts/melee/katana.txt"true);
                
PrecacheGeneric("scripts/melee/machete.txt"true);
                
PrecacheGeneric("scripts/melee/tonfa.txt"true);
                
PrecacheGeneric("scripts/melee/pitchfork.txt"true);
                
PrecacheGeneric("scripts/melee/shovel.txt"true);
        }

My English is not good.
Iciaria is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 11-05-2022 , 09:52   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #262

You only have a Print message in timer callback from OnMapStart(). You need "tSpawnObjects()" function there.
Hawkins is offline
Iciaria
Member
Join Date: Aug 2022
Old 11-06-2022 , 06:22   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #263

Quote:
Originally Posted by Hawkins View Post
You only have a Print message in timer callback from OnMapStart(). You need "tSpawnObjects()" function there.
This still does not solve the problem. The first map started by the server still does not load the configuration and throws an error.
Code:
 11/06/2022 - 19:16:11: SourceMod error session started
L 11/06/2022 - 19:16:11: Info (map "c9m1_alleys") (file "XXXX/left4dead2/addons/sourcemod/logs/errors_20221106.log")
L 11/06/2022 - 19:16:11: [l4d2_spawn_props.smx] Attempted to load an object file which does not exist (addons/sourcemod/../stripper/plugin_cache/.txt)
Unless all survivors die and start again

The code looks like this:
PHP Code:
public Action tSpawnObjects(Handle timer)
{
        
SpawnObjects();
        return 
Plugin_Continue;
}

public 
void OnMapStart()
{

        
CreateTimer(2.0,tSpawnObjects);
......
......

Iciaria is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 11-06-2022 , 06:47   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #264

Download Left 4 DHooks Direct

implement this code in your plugin:

PHP Code:
#include <left4dhooks>

bool g_bFirst_Map_Objects_Spawned;

public 
void OnMapStart()
{
    
g_bFirst_Map_Objects_Spawned false;
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client) && L4D_IsFirstMapInScenario() && !g_bFirst_Map_Objects_Spawned)
    {
        
g_bFirst_Map_Objects_Spawned true;
        
SpawnObjects();
    }

Hawkins is offline
Iciaria
Member
Join Date: Aug 2022
Old 11-06-2022 , 06:48   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #265

Quote:
Originally Posted by HarryPotter View Post
PHP Code:
public void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    if(
g_cvarAutoload.BoolValue && g_cvarAutoloadType.BoolValue)
    {
        
GetRandomMapPath(g_sPathsizeof(g_sPath));
    }
}

public 
void OnMapStart()
{

    if(
g_cvarAutoload.BoolValue && !g_cvarAutoloadType.BoolValue)
    {
        
GetRandomMapPath(g_sPathsizeof(g_sPath));
    }

    if(
g_cvarAutoload.BoolValue && !g_bLoaded)
    {
        
g_bLoaded true;
        
CreateTimer(2.0,tSpawnObjects);
    }

    ...
    ...
}

public 
Action tSpawnObjects(Handle timer)
{
        
SpawnObjects();
        return 
Plugin_Continue;

and done
Thank you for helping me, but it still doesn't seem to work
Code:
L 11/06/2022 - 18:53:32: SourceMod error session started
L 11/06/2022 - 18:53:32: Info (map "c9m1_alleys") (file "XXX/left4dead2/addons/sourcemod/logs/errors_20221106.log")
L 11/06/2022 - 18:53:32: [l4d2_spawn_props.smx] Attempted to load an object file which does not exist (addons/sourcemod/../stripper/plugin_cache/.txt)
L 11/06/2022 - 18:55:57: Error log file session closed.
I tried the following codes,They will throw the above error logs.
Unless the map is changed, the configuration will not be loaded even if all survivors die (restart)

Even if the map is switched, it will only be loaded in the first game
If all survivors die (restart), the configuration will no longer be loaded and no errors will be thrown

PHP Code:
public void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        if(
g_cvarAutoload.BoolValue && g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }
}

public 
Action tSpawnObjects(Handle timer)
{
        
SpawnObjects();
        return 
Plugin_Continue;
}

public 
void OnMapStart()
{
        if(
g_cvarAutoload.BoolValue && !g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }

        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
                
CreateTimer(2.0,tSpawnObjects);
        }
......
......

PHP Code:
public void Event_SurvivalRoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
                
SpawnObjects();
//              CreateTimer(2.0,tSpawnObjects);
        
}
}

public 
void Event_ScavengeRoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        
LogSpawn("Scavenge Round Has Started");
        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
                
SpawnObjects();
//              CreateTimer(2.0,tSpawnObjects);
        
}
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        if(
g_cvarAutoload.BoolValue && g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }
}

public 
Action tSpawnObjects(Handle timer)
{
        
SpawnObjects();
        return 
Plugin_Continue;
}

public 
void OnMapStart()
{
        if(
g_cvarAutoload.BoolValue && !g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }

        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
                
CreateTimer(2.0,tSpawnObjects);
        }
......
......

PHP Code:
public void Event_SurvivalRoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
//              SpawnObjects();
//              CreateTimer(2.0,tSpawnObjects);
        
}
}

public 
void Event_ScavengeRoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        
LogSpawn("Scavenge Round Has Started");
        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
//              SpawnObjects();
//              CreateTimer(2.0,tSpawnObjects);
        
}
}

public 
void Event_RoundStart(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
        if(
g_cvarAutoload.BoolValue && g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }
}

public 
Action tSpawnObjects(Handle timer)
{
        
SpawnObjects();
        return 
Plugin_Continue;
}

public 
void OnMapStart()
{
        if(
g_cvarAutoload.BoolValue && !g_cvarAutoloadType.BoolValue)
        {
                
GetRandomMapPath(g_sPathsizeof(g_sPath));
        }

        if(
g_cvarAutoload.BoolValue && !g_bLoaded)
        {
                
g_bLoaded true;
                
CreateTimer(2.0,tSpawnObjects);
        }
......
......

My English is not good.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_spawn_props.sp - 35 views - 131.6 KB)
Iciaria is offline
Iciaria
Member
Join Date: Aug 2022
Old 11-06-2022 , 06:59   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #266

Quote:
Originally Posted by Hawkins View Post
Download Left 4 DHooks Direct

implement this code in your plugin:

PHP Code:
#include <left4dhooks>

bool g_bFirst_Map_Objects_Spawned;

public 
void OnMapStart()
{
    
g_bFirst_Map_Objects_Spawned false;
}

public 
void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client) && L4D_IsFirstMapInScenario() && !g_bFirst_Map_Objects_Spawned)
    {
        
g_bFirst_Map_Objects_Spawned true;
        
SpawnObjects();
    }

Code:
L 11/06/2022 - 19:54:56: SourceMod error session started
L 11/06/2022 - 19:54:56: Info (map "c9m1_alleys") (file "XXX/left4dead2/addons/sourcemod/logs/errors_20221106.log")
L 11/06/2022 - 19:54:56: [l4d2_spawn_props.smx] Attempted to load an object file which does not exist (addons/sourcemod/../stripper/plugin_cache/.txt)
L 11/06/2022 - 19:56:07: Error log file session closed.
L 11/06/2022 - 19:56:08: SourceMod error session started
L 11/06/2022 - 19:56:08: Info (map "c9m1_alleys") (file "XXX/left4dead2/addons/sourcemod/logs/errors_20221106.log")
L 11/06/2022 - 19:56:08: [SM] Exception reported: Cannot create new entity when no map is running
L 11/06/2022 - 19:56:08: [SM] Blaming: l4d2_spawn_props.smx
L 11/06/2022 - 19:56:08: [SM] Call stack trace:
L 11/06/2022 - 19:56:08: [SM]   [0] CreateEntityByName
L 11/06/2022 - 19:56:08: [SM]   [1] Line 4085, l4d2_spawn_props.sp::SpawnObjects
L 11/06/2022 - 19:56:08: [SM]   [2] Line 451, l4d2_spawn_props.sp::Event_RoundStart
The first map launched by the server will not be loaded unless all survivors die (restart)
After changing the map, the configuration will be loaded, but an error will be thrown (19:56:08
Iciaria is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 11-06-2022 , 07:38   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #267

What version are you using? Can you provider the sp.file?
Hawkins is offline
Iciaria
Member
Join Date: Aug 2022
Old 11-06-2022 , 07:49   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #268

Quote:
Originally Posted by Hawkins View Post
What version are you using? Can you provider the sp.file?
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_spawn_props.sp - 33 views - 132.0 KB)
Iciaria is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 11-06-2022 , 08:18   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #269

Try this one
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_spawn_props.sp - 40 views - 132.4 KB)
Hawkins is offline
Iciaria
Member
Join Date: Aug 2022
Old 11-07-2022 , 08:41   Re: [L4D2] Objects Spawner [2.0 Reloaded] v2.0.6 (Save Objects Supported)
Reply With Quote #270

Quote:
Originally Posted by Hawkins View Post
Try this one
Code:
Compiling l4d2_spawn_props.sp...
SourcePawn Compiler 1.11.0.6906
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2021 AlliedModders LLC

l4d2_spawn_props.sp(3549) : error 037: invalid string (possibly non-terminated string)
l4d2_spawn_props.sp(3550) : warning 217: inconsistent indentation (did you mix tabs and spaces?)
l4d2_spawn_props.sp(3550) : error 001: expected token: ";", but found "\"
l4d2_spawn_props.sp(3550) : error 029: invalid expression, assumed zero
l4d2_spawn_props.sp(3550) : error 001: expected token: ";", but found ")"

4 Errors.
Iciaria 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 03:36.


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