Raised This Month: $ Target: $400
 0% 

[HELP] Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vechta
Veteran Member
Join Date: Jun 2010
Old 08-17-2010 , 08:28   [HELP] Run time error 4: index out of bounds
Reply With Quote #1

Why this error comes?

Code:
 L 08/18/2010 - 14:15:40: [AMXX] Displaying debug trace (plugin "zombie_plague40.amxx")
L 08/18/2010 - 14:15:40: [AMXX] Run time error 4: index out of bounds 
L 08/18/2010 - 14:15:40: [AMXX]    [0] zombie_plague40.sma::countdown (line 11531)
Error line (line 11531):
Code:
	emit_sound( 0, CHAN_VOICE, speak[ countdown ], 1.0, ATTN_NORM, 0, PITCH_NORM )
complete countdown part:
Code:
public countdown(id) 
{  
	new speak[ 10 ][] = { "fvox/one.wav", "fvox/two.wav", "fvox/three.wav", "fvox/four.wav", "fvox/five.wav", "fvox/six.wav", "fvox/seven.wav", "fvox/eight.wav", "fvox/nine.wav", "fvox/ten.wav" } 
     
	emit_sound( 0, CHAN_VOICE, speak[ countdown ], 1.0, ATTN_NORM, 0, PITCH_NORM ) 
	countdown-- 
     
	set_hudmessage(255, 255, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);  
	show_hudmessage(0, "Countdown ^nInfection in: %i", time_s);  
	--time_s; 
     
	if(time_s >= 1) 
	{ 
		set_task(1.0, "countdown", 0) 
	} 
}
Vechta is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 08-17-2010 , 10:34   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #2

Since you are playing it to everybody, I would use
PHP Code:
client_cmd(0"mp3 sound file"
. If you have a WAV file, you can convert it into MP3 format file. This is a converter, Convert WAV to MP3

Good thing is MP3 is smaller than WAV with very little quality changes.

EDIT: Btw if you have a CVar remember to use return PLUGIN_HANDLED instead of return to prevent run time error 4.

Last edited by Excalibur.007; 08-17-2010 at 10:37.
Excalibur.007 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-17-2010 , 13:08   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #3

However, if you want to keep it in .wav, you can use client_cmd(0, "spk file name")

@Excalibur.007
fvox/one.wav, and the others are the included countdown file names. Not that easy to convert, or it is just a pain since everyone already has the files anyways.

And his runtime is that emit_sound() has to go from a real players id (I might be mistaken). It is meant so that if you are close enough to them, you can hear it. Like switching to a knife, turning on nightvision, etc. If I am right though, the runtime error is occuring because 0 is not a player's id.

Last edited by RedRobster; 08-17-2010 at 13:12.
RedRobster is offline
Reply



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 22:00.


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