PDA

View Full Version : sound help


rex
04-28-2004, 08:27
i am trying to add some sound to a plugin, but i can't quite get it working the way i want.
my codes looks like this

public actionKey(id,key){
if ( key == 9 )
show_menu( id , 3, "\yReset or Exit?\w^n^n1. Reset^n2. Exit" )
else {
g_codeEntered[ id ][ g_codePos[ id ]++ ] = '0' + 1 + key
g_codeEntered[ id ][ g_codePos[ id ] ] = 0
if ( g_codePos[ id ] < 5 )
displayKey( id )
else {
new sFlags[32], iFlags
if ( (iFlags = authCode( sFlags, 31, g_codeEntered[ id ] )) ) {
set_user_flags( id, iFlags )
client_cmd(0, "spk misc/accessgranted")
}
else
client_cmd(0, "spk misc/accessdenied")

}
}
return PLUGIN_HANDLED
}
so when i enter a code, if it is right it speaks accessgrated.wav and if it is wrong it speaks accessdenied.wav
what is happending is when i enter a code, it play both wavs.
it plays accessgranted.wav and accessdenied.wav.
hope do i make it only play one if the code is right, and the other if not?
thanks for any help

Isobold
05-07-2004, 20:24
I've seen in some plugins, that in if then else switches they used ";"

so try out this:

if ( (iFlags = authCode( sFlags, 31, g_codeEntered[ id ] )) ) {
set_user_flags( id, iFlags )
client_cmd(0, "spk misc/accessgranted");
}
else
client_cmd(0, "spk misc/accessdenied");





p.s.: I don't know small at all, I just read some sources of some plugins. But it can't be more false than it is now ;)

rex
05-07-2004, 20:36
thanks mate, i will try that out.
8)