PDA

View Full Version : help plz


Nick
04-23-2004, 03:15
How would you make a plugin where you say a word like hello or something and a wav plays?

Itryed but only got errors

DFA-Haplo
04-23-2004, 04:11
The people around here are great, but it really helps if you could post the code that you have and then allow people to point out mistakes or show you how, using your code. This helps you beome a better coder and it helps others like me learn in the process too :)

Nick
04-23-2004, 20:47
would it look something like this?

/*
say_sounds, v1.0
NicK
*/

#include <amxmodx>
#include <amxmisc>

public plugin_init() {
register_plugin("Say Sounds","1.0","NicK")
register_clcmd("say","say_event")
}

public plugin_precache()
{
precache_sound("misc/spank.wav")
}

new phrase[1][] = { "oneandonly" }

public say_event(id)
{
new sid[10]
num_to_str(id,sid,10)
new said[192]
read_args(said,191)

for(new i = 0 ;i < 1; i += 1)
if(containi(said,phrase[i]) != -1) {
set_hudmessage(225, 25, 25, -1.0, 0.32, 0, 2.0, 9.0, 0.8, 0.8, 2)
show_hudmessage(0,"I am the one and only!")
set_task(1.0,"client",0,sid,10)
break
}
}

public client(sid[])
{
new id = str_to_num(sid)
client_cmd(0,"spk misc/oneandonly")

}

QwertyAccess
04-23-2004, 23:00
"spk" isnt a command

Nick
04-23-2004, 23:14
what should it be?

AssKicR
04-23-2004, 23:19
"spk" isnt a command

Ur wrong..

"spk" is a clientside command to play sounds....

Nick
04-24-2004, 00:28
yea its right cuz I just got it to work thanks alot :)

FlyingMongoose
04-24-2004, 00:30
well, spk will only execute on the client side, not throughout the server unless you tell it to output to everyone

Nick
04-24-2004, 00:39
How would I do that? Whats the code?

I thought

client_cmd(0,"spk misc/oneandonly")

plays wav to all
and

client_cmd(ids[0], "spk misc/oneandonly")

played wav to only one client

AssKicR
04-24-2004, 03:34
client_cmd(IDOFFPLAYER,"command goes here")

IDOFPLAYER is a value between 1 and 32.... if you enter 0 it executes on everyone

Nick
04-24-2004, 03:46
So
client_cmd(IDOFFPLAYER,"0")

???

AssKicR
04-24-2004, 03:49
no...

like this
client_cmd(0,"command")

Nick
04-24-2004, 03:53
ok ty
thats what I had already :)

QwertyAccess
04-24-2004, 04:55
ah im used to using "speak" :x

Nick
04-24-2004, 14:13
spk works