AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [HELP] Sending Radio Messages (https://forums.alliedmods.net/showthread.php?t=307975)

hellmonja 06-02-2018 01:36

[HELP] Sending Radio Messages
 
Hi guys! Long time no post. Anyway I was wondering if anyone could teach me how to use SendAudio message. I'm trying to utilize the "hostage down" sound clip. I've already hooked the event but I can't produce the sound. I can always use client_cmd(id, "spk %s", whatever.wav) but I have the impression this will not make it a real radio message. Anyway, here's the code:
PHP Code:

new msg_SendAudio;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("TextMsg""Event_Hostage_Killed""b""2=#Killed_Hostage");
//    register_event("SendAudio", "EventSendAudio", "a", "1=0", "2=%!MRAD_hosdown");
    
    
msg_SendAudio get_user_msgid("SendAudio");
}

public 
Event_Hostage_Killed()
{
//    client_print(1, print_chat, "I did?");

    
message_begin(MSG_ONE_UNRELIABLEmsg_SendAudio);
    
write_byte(1);             // Sender ID
    
write_string("%!MRAD_hosdown");    // Audio Code
    
write_short(1<<1);        // Pitch    
    
message_end();


I know the values are messed up. I really don't know what to put exactly...

E1_531G 06-02-2018 12:31

Re: [HELP] Sending Radio Messages
 
Quote:

message_begin(MSG_ONE_UNRELIABLE, msg_SendAudio);
If you are using MSG_ONE you must provide reciever id, like this:
Quote:

message_begin(MSG_ONE_UNRELIABLE, msg_SendAudio, _, id);
or, if you send for all:
Quote:

message_begin(MSG_BROADCAST, msg_SendAudio);
Also, for the pitch, in the amxcost file defined values exist.

hellmonja 06-02-2018 16:09

Re: [HELP] Sending Radio Messages
 
Quote:

Originally Posted by E1_531G (Post 2594952)
...

Good stuff. Thank you! This is most helpful given that I haven't used this before. For pitch, I used PITCH_NORM, which I found where you told it would be...


All times are GMT -4. The time now is 04:33.

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