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

Replacement of radio commands at the beginning and end of the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drimacus
Member
Join Date: Jun 2011
Old 02-23-2024 , 15:40   Replacement of radio commands at the beginning and end of the round
Reply With Quote #1

Is there a better way to intercept ctwin and terwin radio commands?
PHP Code:
#include <sdktools>
#include <cstrike>

#define MAX_STR_LEN 128

...

public 
OnPluginStart()
{
    
// Um: RadioAudio
    
if ((g_umSendAudio GetUserMessageId("SendAudio")) != INVALID_MESSAGE_ID)
        
HookUserMessage(g_umSendAudioUserMsgSendAudiotrue);
    else
        
SetFailState("GetUserMessageId for SendAudio");

    
HookEvent("round_end"EventRoundEnd);
}

// No sound
public Action UserMsgSendAudio(UserMsg:msg_idHandle:bf, const players[], playersNumbool:reliablebool:init)
{
    if (
GetConVarInt(cvarRoundStartSounds) == 1)
    {
        
char msg_str[MAX_STR_LEN];

        
BfReadString(bfmsg_strsizeof(msg_str));

        if (
StrEqual(msg_str"radio.go"false) || StrEqual(msg_str"radio.locknload"false) || StrEqual(msg_str"radio.moveout"false) || StrEqual(msg_str"radio.letsgo"false))
            return 
Plugin_Handled;
    }
    return 
Plugin_Continue;
}

public 
EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    for (new 
1MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            
StopSound(iSNDCHAN_STATIC"radio/ctwin.wav");
            
StopSound(iSNDCHAN_STATIC"radio/terwin.wav"); 
        }
    }

Drimacus 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 12:49.


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