AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   PLAY a .wav file to all users... (https://forums.alliedmods.net/showthread.php?t=25975)

SweatyBanana 03-24-2006 21:10

PLAY a .wav file to all users...
 
How would I do this...

sorry..im stupid..wish i had v3x's brain..or i wish i was a seamstress...hmmm..hard decision.

M4Maniac 03-24-2006 21:16

Im pretty sure you have to create a precatch plugin

SweatyBanana 03-24-2006 21:17

its called precache...and that is just so people download the sound :?

Xanimos 03-24-2006 21:26

client_cmd( 0 , "spk path/to/my.wav")

path starts in sound directory so if the sound was in sound/misc/my.wav it would be spk misc/my.wav

SweatyBanana 03-24-2006 21:45

So is this good?

Code:
#include <amxmodx>   #include <amxmisc>   #define PLUGIN "start_sound"   #define VERSION "0.1"   #define AUTHOR "SweatyBanana"   public plugin_init()   {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_event("HLTV", "new_round", "a", "1=0", "2=0") }   public plugin_precache() {     precache_sound("begin_sound/begin_sound.wav")     return PLUGIN_CONTINUE }   public new_round()   {       client_cmd( 0 , "begin_sound/begin_sound.wav") }

v3x 03-24-2006 21:57

Code:
client_cmd( 0 , "speak begin_sound/begin_sound.wav")

Twilight Suzuka 03-24-2006 22:00

I'd use play. Its better.

VEN 03-25-2006 02:54

What's the diff.?

SweatyBanana 03-25-2006 09:03

doesnt work.

graczu 03-25-2006 12:21

here have this my script:

Code:

#include <amxmod>
#include <amxmisc>

public plugin_init(){
  register_plugin("Play added Sounds Managment","0.9.9","graczu")
  register_concmd("amx_play","cmdPlay",ADMIN_CHAT,"- play sound: amx_play soundfilename from sound/misc/")
  register_concmd("amx_playshow","cmdDzwieki",0,"- show list of added sounds")

}

public cmdPlay(id,level,cid){
  if (!cmd_access(id,level,cid,2))
    return PLUGIN_HANDLED
  new message[192], name[32],authid[32],forma[128]
  read_args(message,191)
  remove_quotes(message)
  get_user_authid(id,authid,31)
  get_user_name(id,name,31)
  format(forma, 127, "sound/misc/%s.wav", message)
  if (file_exists(forma)){   
  client_cmd(0,"spk misc/%s.wav",message)
  client_print(0,print_chat,"[Play: %s :  %s ]",name,message)
  } else {
  client_print(0,print_chat,"[Play: %s : %s - brak pliku ]",name,forma)
}
  return PLUGIN_HANDLED

}

public cmdDzwieki(id) {
 new motdfile[64], motd[128]
 new nextline=0
 new txtlen
 while((nextline = read_file("addons/amxmodx/configs/sound.txt",nextline,motdfile,63,txtlen))){
 format(motd, 127, "- amx_play %s", motdfile)
 console_print(id,motd)
 }
}

public plugin_precache() {
 new soundfile[64], sound[128]
 new nextline=0
 new txtlen
 while((nextline = read_file("addons/amxmodx/configs/sound.txt",nextline,soundfile,63,txtlen))){
 format(sound, 127, "misc/%s.wav", soundfile)
 precache_sound(sound)   
 }
}

insert sound files to upload and be able to play in:

addons/amxmodx/configs/sound.txt

just names of files without .wav

insert files in: sound/misc/ (serverside)

when game:

amx_play soundname << to play sound
amx_playshow to see files in sound.txt


All times are GMT -4. The time now is 16:45.

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