Raised This Month: $ Target: $400
 0% 

Download the sounds if they do not have


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sutar
Senior Member
Join Date: Sep 2010
Old 05-12-2012 , 03:32   Re: Download the sounds if they do not have
Reply With Quote #1

Quote:
#include <amxmodx>

#define MaxSounds 4

new soundlist[MaxSounds][] =
{
"sound/loading/sound_1",
"sound/loading/sound_2",
"sound/loading/sound_3",
"sound/loading/sound_4"
}

public plugin_init()
{
register_plugin("Loading Sound", "1.5", "Sutar")
}

public client_connect(id)
{
client_cmd(id, "mp3 play %s", soundlist[random_num(0, MaxSounds)])
return PLUGIN_CONTINUE
}

public plugin_precache()
{
for(new i = 0; i < MaxSounds; i++)
{
if(!file_exists(soundlist[i]))
{
new path[75]
format(path, 74, "%s.mp3", soundlist[i])
precache_generic(path)
}
}

return PLUGIN_CONTINUE
}
Here everything seems right, but an error in line 20
line 20:

Quote:
client_cmd(id, "mp3 play %s", soundlist[random_num(0, MaxSounds)])
if you do "MaxSounds - 1". All is well, but the last sound will not play. What is wrong?
Sutar 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 00:19.


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