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

Message sound for all


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
R.1
Member
Join Date: Jan 2014
Location: Poland
Old 01-02-2024 , 18:02   Message sound for all
Reply With Quote #1

Hello. I am looking for a plugin that will work on the principle that everyone who writes something in the chat or on say_team will play a sound on the server. PS, you can exclude commands with a slash, e.g. /roulette
R.1 is offline
quil
Junior Member
Join Date: Dec 2023
Old 01-02-2024 , 18:08   Re: Message sound for all
Reply With Quote #2

Quote:
Originally Posted by R.1 View Post
Hello. I am looking for a plugin that will work on the principle that everyone who writes something in the chat or on say_team will play a sound on the server. PS, you can exclude commands with a slash, e.g. /roulette
https://hlmod.hu/viewtopic.php?f=101&t=12011
quil is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-02-2024 , 19:53   Re: Message sound for all
Reply With Quote #3

PHP Code:
#include <amxmodx>

public plugin_init() {

    new 
listCmd[][] =
    {
        
"say",
        
"say_team"
    
}
    
    for(new 
isizeof listCmdi++)
    {
        
register_clcmd(listCmd[i], "set_sound")
    }
}

public 
set_sound(id)
{
    if( !
is_user_connected(id) )
        return 
PLUGIN_CONTINUE
        
    
new message[191]
    
    
read_args(messagecharsmax(message))
    
    
remove_quotes(message)
    
    if(
message[0] == '/' || equal(message""))
        return 
PLUGIN_HANDLED_MAIN
    
    client_cmd
(0"spk vox/hello")
    
    return 
PLUGIN_CONTINUE

__________________

Last edited by mlibre; 01-04-2024 at 17:24. Reason: fixed
mlibre is offline
R.1
Member
Join Date: Jan 2014
Location: Poland
Old 01-04-2024 , 11:05   Re: Message sound for all
Reply With Quote #4

Quote:
Originally Posted by mlibre View Post
PHP Code:
#include <amxmodx>

public plugin_init() {

    new 
listCmd[][] =
    {
        
"say",
        
"say_team"
    
}
    
    for(new 
isizeof listCmdi++)
    {
        
register_clcmd(listCmd[i], "set_sound")
    }
}

public 
set_sound(id)
{
    if( !
is_user_connected(id) )
        return 
PLUGIN_CONTINUE
        
    
new message[191]
    
    
read_args(messagecharsmax(message))
    
    
remove_quotes(message)
    
    if(
message[0] == '/' || equal(message""))
        return 
PLUGIN_HANDLED_MAIN
    
    client_cmd
(0"spk vox/hello")
    
    return 
PLUGIN_HANDLED_MAIN

the plugin works, but you can't see who is writing what in the chat
R.1 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-04-2024 , 12:04   Re: Message sound for all
Reply With Quote #5

Code:
#include <amxmodx>

public plugin_init()
{
	register_plugin("New Plug-In", "0.0.1", "Author")
	
	register_clcmd("say", "say_cmd")
	register_clcmd("say_team", "say_cmd")
}

public say_cmd(id)
{
	new szMsg[254]
	read_args(szMsg, charsmax(szMsg))
	remove_quotes(szMsg)
	if(szMsg[0] != '/')
		client_cmd(0, "spk vox/hello")
}
__________________
Jhob94 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-04-2024 , 17:27   Re: Message sound for all
Reply With Quote #6

Quote:
Originally Posted by R.1 View Post
the plugin works, but you can't see who is writing what in the chat
sorry change the last PLUGIN_HANDLED_MAIN to PLUGIN_CONTINUE
__________________
mlibre is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-05-2024 , 05:38   Re: Message sound for all
Reply With Quote #8

You guys really like to complicate what is simple xD

@milbre that loop and returns are a bad code habit btw. Plus how can a client send a chat command if he is not connected?
__________________
Jhob94 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-05-2024 , 09:23   Re: Message sound for all
Reply With Quote #9

Quote:
Originally Posted by Jhob94 View Post
You guys really like to complicate what is simple xD
a little for fun, It's what boredom does

Quote:
Originally Posted by Jhob94 View Post
@milbre that loop and returns are a bad code habit btw. Plus how can a client send a chat command if he is not connected?
at some point in my life I received a warning there, better safe than sorry!
__________________
mlibre is offline
R.1
Member
Join Date: Jan 2014
Location: Poland
Old 01-06-2024 , 08:34   Re: Message sound for all
Reply With Quote #10

Quote:
Originally Posted by Jhob94 View Post
Code:
#include <amxmodx>

public plugin_init()
{
	register_plugin("New Plug-In", "0.0.1", "Author")
	
	register_clcmd("say", "say_cmd")
	register_clcmd("say_team", "say_cmd")
}

public say_cmd(id)
{
	new szMsg[254]
	read_args(szMsg, charsmax(szMsg))
	remove_quotes(szMsg)
	if(szMsg[0] != '/')
		client_cmd(0, "spk vox/hello")
}
it works, but when I want to add a wav file, it doesn't work, I don't want the sound from the vox folder, only my own sound
R.1 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 03:52.


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