AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound not worked (https://forums.alliedmods.net/showthread.php?t=204881)

pewex 01-04-2013 11:36

Sound not worked
 
Code:

#include <amxmodx>


    set_task(600.0,"PlaySound", 0)

new const yoursound1[] = "sound/misc/czs.wav"
new const yoursound2[] = "sound/misc/czd.wav"
new const yoursound3[] = "sound/misc/cze.wav"

public plugin_precache()
{
    precache_sound(yoursound1)
    precache_sound(yoursound2)
    precache_sound(yoursound3)
}

public plugin_init()
{
    register_plugin("Press", "1.0.0", "")
   
    register_clcmd("+voicerecord", "PlaySound")
}

public PlaySound()
{
switch(random_num(1, 3))
{
case 1:
{
    client_cmd(0, "spk ^"%s^"", yoursound1)
}
case 2:
{
    client_cmd(0, "spk ^"%s^"", yoursound2)
}
case 3:
{
    client_cmd(0, "spk ^"%s^"", yoursound3)
}
}

    return PLUGIN_HANDLED
}

Plugin not work well...

Please help

YamiKaitou 01-04-2013 11:39

Re: Sound not worked
 
Any errors?

micapat 01-04-2013 11:44

Re: Sound not worked
 
PHP Code:

#include <amxmodx>


    
set_task(600.0,"PlaySound"0

->
PHP Code:

public plugin_init() 
{
    
register_plugin("Press""1.0.0""")
    
    
set_task600.0"PlaySound"54685465, .flags "b" )


Check if your sounds are in the good format too.

simanovich 01-04-2013 16:54

Re: Sound not worked
 
PHP Code:

register_clcmd("+voicerecord""PlaySound"); 

You cann't hook Half Life In-Game Commands (command that starts with "+"), only not exist command

pewex 01-04-2013 17:13

Re: Sound not worked
 
Quote:

Originally Posted by micapat (Post 1866929)
PHP Code:

#include <amxmodx>


    
set_task(600.0,"PlaySound"0

->
PHP Code:

public plugin_init() 
{
    
register_plugin("Press""1.0.0""")
    
    
set_task600.0"PlaySound"54685465, .flags "b" )


Check if your sounds are in the good format too.


ps. my task:

Quote:

set_task( 52.0, "PlaySound", 54685465, .flags = "b" )

alonelive 01-05-2013 06:53

Re: Sound not worked
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

new const g_songs_names[][] = {
    
"czs.wav",
    
"czd.wav",
    
"cze.wav"
}

public 
plugin_init() {
    
register_plugin("Press""1.0.0""pewex")
    
register_logevent"EventRoundStart"2"1=Round_Start" );
}

public 
plugin_precache() { 
    
precache_sound("misc/czs.wav"
    
precache_sound("misc/czd.wav"
    
precache_sound("misc/cze.wav"


public 
EventRoundStart() {
    
set_task(60.0,"PlaySound")
}

public 
PlaySound() {
    
client_cmd(0"spk misc/%s"g_songs_names[random(sizeof(g_songs_names))]);    


I set 60 secons instead 600.
600 seconds = 10 MIN. Max default round time is 9 min (without special hacks).


All times are GMT -4. The time now is 13:39.

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