Raised This Month: $ Target: $400
 0% 

random sounds ===> need help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
-=*HQz=-=mAster nOob=-
Junior Member
Join Date: Mar 2006
Old 03-27-2006 , 20:45   random sounds ===> need help
Reply With Quote #1

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]
Attached Files
File Type: sma Get Plugin or Get Source (ultimate_sound2.sma - 145 views - 9.6 KB)
-=*HQz=-=mAster nOob=- is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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