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

[ANY] Speaking List (fork)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Plugin ID:
8240
Plugin Version:
1.4.4
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Voice Announce. Print To Center Message who's Speaking
    Old 10-10-2022 , 11:08   [ANY] Speaking List (fork)
    Reply With Quote #1

    Description:
    Prints on center screen who's speaking. Original work done by Accelerator.

    Optimized for the best performance.
    Settings (ConVars):
    None
    Requirements:
    - SourceMod v1.11+
    ChangeLog


    Credits:
    - @Accelerator - for the original work and contribution to SourceMod core, made opportunity this plugin to be so simple
    - @Grey83 - for optimizations.
    Attached Files
    File Type: sp Get Plugin or Get Source (SpeakingList_SM1.11.sp - 259 views - 1.6 KB)
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

    Last edited by Dragokas; 10-10-2022 at 15:20.
    Dragokas is offline
    Grey83
    Veteran Member
    Join Date: Dec 2014
    Location: Ukraine
    Old 10-10-2022 , 14:00   Re: [ANY] Speaking List (fork)
    Reply With Quote #2

    Maybe it's better like this?
    PHP Code:
    /*
        ChangeLog:
        
         * 1.4.1 (26-Jan-2020) (Dragokas)
          - Client in game check fixed
          - Code is simplified
          - New syntax
          
         * 1.4.2 (23-Dec-2020) (Dragokas)
          - Updated to use with SM 1.11
          - Timer is increased 0.7 => 1.0
    */
    #pragma semicolon 1
    #pragma newdecls required

    bool bSpeaking[MAXPLAYERS+1];
    char sPlayers[PLATFORM_MAX_PATH];

    public 
    Plugin myinfo 
    {
        
    name        "SpeakingList",
        
    author        "Accelerator (Fork by Dragokas)",
        
    description    "Voice Announce. Print To Center Message who Speaking",
        
    version        "1.4.2",
        
    url            "https://forums.alliedmods.net/showthread.php?t=339934"
    }

    public 
    void OnMapStart()
    {
        for(
    int i 1<= MaxClientsi++) bSpeaking[i] = false;

        
    CreateTimer(1.0Timer_List_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
    }

    public 
    void OnClientSpeaking(int client)
    {
        
    bSpeaking[client] = true;
    }
    /*
    public void OnClientSpeakingEnd(int client)
    {
        bSpeaking[client] = false;
    }
    */
    public Action Timer_List(Handle timer)
    {
        static 
    bool show;
        static 
    int i;
        for(
    1sPlayers[0] = 0show false<= MaxClientsi++) if(bSpeaking[i])
        {
            
    bSpeaking[i] = false;
            if(!
    IsClientInGame(i)) continue;

            
    show true;
            if(
    Format(sPlayerssizeof(sPlayers), "%s\n%N"sPlayersi) == (sizeof(sPlayers) - 1)) break;    // buffer full
        
    }

        if(
    showPrintCenterTextAll(sPlayers);

        return 
    Plugin_Continue;

    __________________

    Last edited by Grey83; 10-10-2022 at 14:57.
    Grey83 is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 10-10-2022 , 14:26   Re: [ANY] Speaking List (fork)
    Reply With Quote #3

    In such case, it's better to check the return value of Format().
    For performance purposes.
    AFAIK, strlen counting each character again, before returning the length.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Grey83
    Veteran Member
    Join Date: Dec 2014
    Location: Ukraine
    Old 10-10-2022 , 14:58   Re: [ANY] Speaking List (fork)
    Reply With Quote #4

    Quote:
    Originally Posted by Dragokas View Post
    AFAIK, strlen counting each character again, before returning the length.
    fixed
    __________________
    Grey83 is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 10-10-2022 , 15:20   Re: [ANY] Speaking List (fork)
    Reply With Quote #5

    Thanks, updated.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    101
    Member
    Join Date: Nov 2023
    Old 12-08-2023 , 09:40   Re: [ANY] Speaking List (fork)
    Reply With Quote #6

    Quote:
    Originally Posted by Grey83 View Post
    Maybe it's better like this?
    PHP Code:
    /*
        ChangeLog:
        
         * 1.4.1 (26-Jan-2020) (Dragokas)
          - Client in game check fixed
          - Code is simplified
          - New syntax
          
         * 1.4.2 (23-Dec-2020) (Dragokas)
          - Updated to use with SM 1.11
          - Timer is increased 0.7 => 1.0
    */
    #pragma semicolon 1
    #pragma newdecls required

    bool bSpeaking[MAXPLAYERS+1];
    char sPlayers[PLATFORM_MAX_PATH];

    public 
    Plugin myinfo 
    {
        
    name        "SpeakingList",
        
    author        "Accelerator (Fork by Dragokas)",
        
    description    "Voice Announce. Print To Center Message who Speaking",
        
    version        "1.4.2",
        
    url            "https://forums.alliedmods.net/showthread.php?t=339934"
    }

    public 
    void OnMapStart()
    {
        for(
    int i 1<= MaxClientsi++) bSpeaking[i] = false;

        
    CreateTimer(1.0Timer_List_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
    }

    public 
    void OnClientSpeaking(int client)
    {
        
    bSpeaking[client] = true;
    }
    /*
    public void OnClientSpeakingEnd(int client)
    {
        bSpeaking[client] = false;
    }
    */
    public Action Timer_List(Handle timer)
    {
        static 
    bool show;
        static 
    int i;
        for(
    1sPlayers[0] = 0show false<= MaxClientsi++) if(bSpeaking[i])
        {
            
    bSpeaking[i] = false;
            if(!
    IsClientInGame(i)) continue;

            
    show true;
            if(
    Format(sPlayerssizeof(sPlayers), "%s\n%N"sPlayersi) == (sizeof(sPlayers) - 1)) break;    // buffer full
        
    }

        if(
    showPrintCenterTextAll(sPlayers);

        return 
    Plugin_Continue;

    Why ?
    there is no need to use repeated timers While there is two forwards (SpkStart,SpkEnd)!
    101 is offline
    101
    Member
    Join Date: Nov 2023
    Old 12-08-2023 , 09:50   Re: [ANY] Speaking List (fork)
    Reply With Quote #7

    Updated .
    Multiple choices of displayment (author can edit script-if he need)
    *Centermsg life time is about 2 secends and it need timer to be revived, so"i was wrong" .
    *panel and Consolemsg can handle the msg 4 long time and don't need timers .
    * Msg is instantly refreshed and doesn't wait for timer , TIMER's main mission is: reviving Centermsg
    * Mute fix included
    Attached Files
    File Type: sp Get Plugin or Get Source ([ANY]SpeakersList.sp - 40 views - 2.1 KB)

    Last edited by 101; 12-11-2023 at 00:21. Reason: updated
    101 is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 12-08-2023 , 10:32   Re: [ANY] Speaking List (fork)
    Reply With Quote #8

    @101, looks good.
    Also I would add IsClientInGame() check in OnClientDisconnect.

    Original is written at times when SM engine didn't have those forwards. OnClientSpeaking is covered by separate extension at that moment, until @Accelerator finally added it to SM.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Accelerator
    Senior Member
    Join Date: Dec 2010
    Location: Russia
    Old 12-08-2023 , 11:03   Re: [ANY] Speaking List (fork)
    Reply With Quote #9

    Updated version with EMS Hud support: https://github.com/accelerator74/sp-...peakingList.sp
    __________________

    Last edited by Accelerator; 12-08-2023 at 11:11.
    Accelerator is online now
    101
    Member
    Join Date: Nov 2023
    Old 12-08-2023 , 23:50   Re: [ANY] Speaking List (fork)
    Reply With Quote #10

    Quote:
    Originally Posted by Dragokas View Post
    @101, looks good.
    Also I would add IsClientInGame() check in OnClientDisconnect.

    Original is written at times when SM engine didn't have those forwards. OnClientSpeaking is covered by separate extension at that moment, until @Accelerator finally added it to SM.
    yes , i have read that .
    luckily , these forwards were added in the last version of sourcemod .
    101 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 15:26.


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