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

[L4D & Dev] OnClientChanged


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 10-21-2022 , 16:39   [L4D & Dev] OnClientChanged
Reply With Quote #1

a dev support utility plugin just for sharing
im hate so many client change event

to use
PHP Code:
forward void OnClientChanged(int clientint teamint changes)

enum {
    
TEAM_CHANGED =    (<< 0),
    
IS_DEATH =        (<< 1),
    
IS_BOT =        (<< 2),
    
IS_RESPAWNING =    (<< 3),
    
IS_TAKEOVER =    (<< 4),
    
IS_DISCONNECT = (<< 5),

Attached Files
File Type: sp Get Plugin or Get Source (OnClientChanged.sp - 129 views - 3.3 KB)
__________________
NoroHime is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 10-21-2022 , 16:44   Re: [L4D & Dev] OnClientChanged
Reply With Quote #2

2 snippet to use

PHP Code:
public void OnClientChanged(int clientint teamint changes) {

    
//1
    
int alives 0;
    for (
int i 1<= MaxClientsi++)
        if (
isAliveHumanSurvivor(i))
            
alives++;

    
AlivedHumanSurvivor alives//a global var

    //2

    
if (changes IS_DEATH) {
        
PrintToChatAll("%N is died lol"client);
    }

__________________
NoroHime is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 10-21-2022 , 19:59   Re: [L4D & Dev] OnClientChanged
Reply With Quote #3

I think it's better for individual plugins to hook the events they need. This is causing extra overhead, dependencies and possibly hooking events that won't be used by a plugin. It's a nice idea and the code looks good though. If a plugin needs all those events then maybe but still that plugin then requires something extra to install.
__________________
Silvers is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 11-15-2022 , 13:04   Re: [L4D & Dev] OnClientChanged
Reply With Quote #4

Thinking about it or update it, today suddenly found that the use of Defibrillator does not trigger IS_SPAWN


v1.1 now using defibrillator will trigger IS_SPAWN; 16-November-2022
PHP Code:
HookEvent("defibrillator_used"OnDefibrillatorUsed); 
Attached Files
File Type: sp Get Plugin or Get Source (OnClientChanged.sp - 127 views - 3.7 KB)
__________________

Last edited by NoroHime; 11-15-2022 at 13:06.
NoroHime 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 05:22.


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