AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random sounds ===> need help (https://forums.alliedmods.net/showthread.php?t=26164)

-=*HQz=-=mAster nOob=- 03-27-2006 20:45

random sounds ===> need help
 
1 Attachment(s)
I need help on trying to basically understand the random command. I'm still a newbie in this and the help was confusing me. I'm trying to make it so that for the ultimate_sounds plugin plays randomly 3 sounds instead of just the normal "Headshot" sound. Here is what I ADDED to the plugin (if you want to fix the errors yourself by compiling instead of reading this, I uploaded the plugin):

Code:

#define HSSOUNDS 4

new hssounds[HSSOUNDS][] = {
"spk misc/headshot",
"spk misc/fps_headshot",
"spk misc/headshot3"}

precache_sound( "misc/fps_headshot.wav")
precache_sound( "misc/headshot3.wav")

Then I changed this part of the script (which is at the end in the hs section, above the precache_sound):

Code:

    }
  if (hsmode_bit & 2){
      client_cmd(0,"spk misc/fps_headshot")
  }

to:
Code:

  }
  if (hsmode_bit & 2){
      client_cmd(0,hssounds[ random_num(0,HSSOUNDS-1) ],)
  }

after this, I tried compiling the plugin but this is what I got:
on line 66 (error 008: must be a constant expression; assumed zero)
on line 297 (error 029: invalid expression, assumed zero)


my line 66 was:
client_cmd(0,"spk misc/headshot"),

and my line 297 was:
client_cmd(0,hssounds[ random_num(0,HSSOUNDS-1) ],)

like I said I'm a newbie and I'm totally lost -_-' and I'm sorry for making this really long lol but I thought that everything I did was necessary?[/list]

FatalisDK 03-27-2006 22:23

1 Attachment(s)
This may work..

-=*HQz=-=mAster nOob=- 03-27-2006 23:42

Quote:

Originally Posted by FatalisDK
This may work..

:shock: you did exactly what I wanted to do just that I didnt know how to do it... THANKS A BUNCH MANN U OWNNNNN :D and now I know how to use the random cmd too lol you should get karma all the way =D


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

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