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

[L4D2] Weapon Remove


Post New Thread Reply   
 
Thread Tools Display Modes
Ja-Forces
Senior Member
Join Date: Jul 2009
Location: Leningrad
Old 01-15-2023 , 10:23   Re: [L4D2] Weapon Remove
Reply With Quote #21

Сhange line 14 to:

Quote:
int ent_table[128][2];
__________________

Last edited by Ja-Forces; 01-31-2023 at 06:34.
Ja-Forces is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-15-2023 , 12:07   Re: [L4D2] Weapon Remove
Reply With Quote #22

Mika Misori, try this version
Attached Files
File Type: sp Get Plugin or Get Source (l4d_weaponremove 1.3.1.sp - 167 views - 11.8 KB)
__________________
Grey83 is offline
Mika Misori
Senior Member
Join Date: Sep 2022
Old 01-16-2023 , 07:18   Re: [L4D2] Weapon Remove
Reply With Quote #23

Quote:
Originally Posted by Grey83 View Post
Mika Misori, try this version
Thank you so much! Put it on the server and will keep an eye on the errors in logs. I'll report back later.
Mika Misori is offline
Mika Misori
Senior Member
Join Date: Sep 2022
Old 01-23-2023 , 05:43   Re: [L4D2] Weapon Remove
Reply With Quote #24

Quote:
Originally Posted by Grey83 View Post
Mika Misori, try this version
Well, server started crashing after I installed this version of the plugin.
And before that, it worked stably for months without a single crash.

Over the past few days, there have been 3 crashes on different maps, with different errors. Full logs in attachment.

Accelerator crash links:
https://crash.limetech.org/uhrngfenxj4o
https://crash.limetech.org/oy4zdx4lt6ug
https://crash.limetech.org/epfd6x56g37r

I would be glad if someone could help with this.
Attached Files
File Type: log crash-2023-01-17_21-47-45.log (39.0 KB, 129 views)
File Type: log crash-2023-01-18_17-03-17.log (34.5 KB, 93 views)
File Type: log crash-2023-01-22_21-10-59.log (35.9 KB, 94 views)
File Type: log errors_20230117.log (324 Bytes, 106 views)
File Type: log errors_20230118.log (324 Bytes, 101 views)
File Type: log errors_20230122.log (1.3 KB, 97 views)
File Type: log accelerator.log (729 Bytes, 127 views)
Mika Misori is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-23-2023 , 11:54   Re: [L4D2] Weapon Remove
Reply With Quote #25

Quote:
Originally Posted by Grey83 View Post
Mika Misori, try this version
PHP Code:
AcceptEntityInput(entid"Kill"ResetUseCount(entid); 
This won't compile on SM < 10, missing semicolon.

PHP Code:
int ent MaxClients+1
Start at -1 instead.

- Usual things like "public" not required for custom named callbacks.
- Stock shouldn't be used in this context, only if a function isn't use or include files.


Can't see any reason for it to crash, other than round_start can be called before OnMapStart. So you should set a bool to determine if the map has started or not, and only delete in round_start when it has started.
__________________
Silvers is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-23-2023 , 13:06   Re: [L4D2] Weapon Remove
Reply With Quote #26

Quote:
Originally Posted by Silvers View Post
PHP Code:
AcceptEntityInput(entid"Kill"ResetUseCount(entid); 
This won't compile on SM < 10, missing semicolon.
AcceptEntityInput(entid, "Kill") ResetUseCount(entid); ==> if(AcceptEntityInput(entid, "Kill")) ResetUseCount(entid);
Quote:
Originally Posted by Silvers View Post
PHP Code:
int ent MaxClients+1
Start at -1 instead.
PHP Code:
Parameters
int startEnt
The entity index after which to begin searching from
. Use -1 to start from the first entity
We don't need to start with the first entity (world).
Quote:
Originally Posted by Silvers View Post
- Usual things like "public" not required for custom named callbacks.
- Stock shouldn't be used in this context, only if a function isn't use or include files.
Will cause warnings when compiled with SM1.9 or older.
__________________
Grey83 is offline
little_froy
Senior Member
Join Date: May 2021
Old 01-26-2023 , 01:29   Re: [L4D2] Weapon Remove
Reply With Quote #27

Quote:
Originally Posted by Grey83 View Post
AcceptEntityInput(entid, "Kill") ResetUseCount(entid); ==> if(AcceptEntityInput(entid, "Kill")) ResetUseCount(entid);
PHP Code:
Parameters
int startEnt
The entity index after which to begin searching from
. Use -1 to start from the first entity
We don't need to start with the first entity (world).
Will cause warnings when compiled with SM1.9 or older.
FindEntityByClassname Function
Searches for an entity by classname.

int FindEntityByClassname(int startEnt, const char[] classname)
Parameters
int startEnt
A valid entity's index after which to begin searching from. Use -1 to start from the first entity.

const char[] classname
Classname of the entity to find.

Return Value
Entity index >= 0 if found, -1 otherwise.

Errors
Invalid start entity or lack of mod support.

Last edited by little_froy; 01-27-2023 at 09:20.
little_froy is online now
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-26-2023 , 08:42   Re: [L4D2] Weapon Remove
Reply With Quote #28

Quote:
Originally Posted by little_froy View Post
i think it should be "int ent = MaxClients; ".
No, weapon spawners have much larger indexes.
PHP Code:
public void OnMapStart()
{
    
char cls[32];
    for(
int i 1max GetMaxEntities(); <= maxi++)
        if(
IsValidEdict(i) && IsValidEntity(i)
        && 
GetEntityClassname(iclssizeof(cls)) && !strncmp(cls"weapon_"7false))
        {
            
PrintToServer("\n    Entity '%s' (Id: %i, MaxClients: %i)\n"clsiMaxClients);
            break;
        }

__________________
Grey83 is offline
little_froy
Senior Member
Join Date: May 2021
Old 01-26-2023 , 09:00   Re: [L4D2] Weapon Remove
Reply With Quote #29

Quote:
Originally Posted by Grey83 View Post
No, weapon spawners have much larger indexes.
PHP Code:
public void OnMapStart()
{
    
char cls[32];
    for(
int i 1max GetMaxEntities(); <= maxi++)
        if(
IsValidEdict(i) && IsValidEntity(i)
        && 
GetEntityClassname(iclssizeof(cls)) && !strncmp(cls"weapon_"7false))
        {
            
PrintToServer("\n    Entity '%s' (Id: %i, MaxClients: %i)\n"clsiMaxClients);
            break;
        }

sorry, i was stupid.

Last edited by little_froy; 01-27-2023 at 09:20.
little_froy is online now
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-26-2023 , 11:32   Re: [L4D2] Weapon Remove
Reply With Quote #30

Quote:
Originally Posted by little_froy View Post
that's for FindEntityByClassname(), not for the loop.
This is for finding the first entity whose classname starts with "weapon_" (and to compare how much its index is greater than MaxClients).
__________________
Grey83 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 06:36.


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