AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hud is not displaying and sound is not playing... (https://forums.alliedmods.net/showthread.php?t=46196)

k007 10-21-2006 00:29

hud is not displaying and sound is not playing...
 
could someone help me with this the hud msg is not showing up and no sound is playing..
Code:
new g_szHeSound[]= "misc/nade_kill.wav" public Death() {         if(get_pcvar_num(enabled) == 1)         {                 new id = read_data(2)                 new iWeapon                 new iAttacker = get_user_attacker(id, iWeapon)                   if(iWeapon == CSW_HEGRENADE && hasSomething[iAttacker])                 {                                         new VictimName[33]                         new AttackerName[33]                                         get_user_name(iAttacker, AttackerName, 32)                         get_user_name(id,VictimName,32)                                         new iRed   = random_num(1,255)                         new iGreen = random_num(1,255)                         new iBlue  = random_num(1,255)                         new Float:X = random_float(0.9, 0.98)                         new Float:Y = random_float(0.9, 0.98)                           set_hudmessage(iRed, iGreen, iBlue, X, Y, 0, 3.0, 6.0, 0.1, 0.2, 4)                         show_hudmessage(0,"%s Was naded! by %s Grenade!!!!",VictimName, AttackerName)                                         new Str[64]                         format(Str,63,"spk %s",g_szHeSound)                         client_cmd(0,Str)                                                         client_print(id,print_console,"%s has just Naded you with a  Grenade!!!", AttackerName)                 }                                                         }         return PLUGIN_CONTINUE   }

Silencer123 10-21-2006 06:57

Re: hud is not displaying and sound is not playing...
 
Use:
play %s
not
spk %s
If that does still not work, try removing the ".wav".
If there is still no sound there is a Problem with the .wav it self.

0.85 or above is probably showing the Message out of screen. (under Bottom)
Use values between 0.01 and 0.8 for Y.
For X use small Values or -1.
(Note: 0.5 != -1, -1 will Center the Message on that axis,
0.5 will make Message start at the Center of that axis.)


:up:

Zenith77 10-21-2006 10:29

Re: hud is not displaying and sound is not playing...
 
1) Using the spk command is perfectly ok, but try doing it this way.
Code:
new const testSound[] = "misc/test.wav"; client_cmd(id, "spk ^"%s^"", testSound);
2) Try using a hud generator to make sure your coords are right and/or make sure no other plugin is using that channel (disable all third party plugins).

Silencer123 10-21-2006 11:28

Re: hud is not displaying and sound is not playing...
 
spk is not "perfectly ok" because it will print you an error message.

Zenith77 10-21-2006 12:08

Re: hud is not displaying and sound is not playing...
 
Only in console, which really doesn't do anything.

organizedKaoS 10-21-2006 12:56

Re: hud is not displaying and sound is not playing...
 
Quote:

Originally Posted by Silencer123 (Post 393521)
spk is not "perfectly ok" because it will print you an error message.

Spk will only print an error message if the wav format is not pcm.

The audio format must be exactly what is accepted by the hl engine.

If your using spk and it gives you an error message....check your sound file and learn to alter it accordingly.

And then this:
Code:
new Str[64] format(Str,63,"spk %s",g_szHeSound) client_cmd(0,Str)

Should work better like this
Code:
new Str[64] format(Str,63,"%s", g_szHeSound) client_cmd(0, "spk %s", Str)

k007 10-21-2006 13:08

Re: hud is not displaying and sound is not playing...
 
ok guys will do and ill tell u if it works

anssik 10-21-2006 13:21

Re: hud is not displaying and sound is not playing...
 
You should change
Code:

if(get_pcvar_num(enabled) == 1)
to
Code:

if(get_pcvar_num(enabled))
Doesn't really matter, but makes the code cleaner.

Zenith77 10-21-2006 13:41

Re: hud is not displaying and sound is not playing...
 
It does matter, if the value you are checking is used with different values other than zero.

The second way you posted is acutally equal to this:

Code:
if (someVar != 0) {      // Code... } //Same way as: if (someVar) {     // Code... }

It will work in this case, but I just wanted to clarify that.

[ --<-@ ] Black Rose 10-22-2006 06:28

Re: hud is not displaying and sound is not playing...
 
Quote:

Originally Posted by organizedKaoS (Post 393560)
Should work better like this
Code:
new Str[64] format(Str,63,"%s", g_szHeSound) client_cmd(0, "spk %s", Str)

No. It's the same thing as client_cmd(0, "spk %s", g_szHeSound) only way more complicated.

you SHOULD use client_cmd(0, "spk ^"%s^"", g_szHeSound) like Zenith said.

the resuft with X: 0.9 and y: 0.9 is...
http://roseclan.dajoob.com/images/hudmsg.jpg


All times are GMT -4. The time now is 04:46.

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