Raised This Month: $32 Target: $400
 8% 

[L4D2] Weapon Remove


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-27-2023 , 08:36   Re: [L4D2] Weapon Remove
Reply With Quote #31

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;
        }

It's much faster to use
PHP Code:
int entity = -1;
while( (
entity FindEntityByClassname(entity"weapon_*") != INVALID_ENT_REFERENCE) ) 
instead of a loop like this.
__________________
Silvers is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-27-2023 , 12:02   Re: [L4D2] Weapon Remove
Reply With Quote #32

Quote:
Originally Posted by Silvers View Post
PHP Code:
FindEntityByClassname(entity"weapon_*"
Is this function able to search by incomplete class name?
__________________
Grey83 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 01-27-2023 , 12:06   Re: [L4D2] Weapon Remove
Reply With Quote #33

Yes, this function can do that.
https://github.com/alliedmodders/sou....cpp#L912-L917
__________________
Grey83 is offline
Mika Misori
Senior Member
Join Date: Sep 2022
Old 01-31-2023 , 05:37   Re: [L4D2] Weapon Remove
Reply With Quote #34

3 more crashes lately. Rolling back to the old version of the plugin.

Accelerator crash links:
https://crash.limetech.org/l365jsgdvi7h
https://crash.limetech.org/fvihdvgopxww
https://crash.limetech.org/bbq5dydcypl4
Attached Files
File Type: log errors_20230123.log (324 Bytes, 14 views)
File Type: log errors_20230125.log (324 Bytes, 25 views)
File Type: log errors_20230129.log (324 Bytes, 19 views)
File Type: log crash-2023-01-23_15-09-09.log (36.8 KB, 21 views)
File Type: log crash-2023-01-25_16-10-51.log (39.7 KB, 22 views)
File Type: log crash-2023-01-29_21-23-52.log (47.7 KB, 18 views)
Mika Misori 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 08:29.


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