Re: Need Some Scripting Help
Like This
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Music Plugin"
#define VERSION "1.0"
#define AUTHOR "DoviuX"
new listening[33]
new const music[][] = {
"sound/Left4Dead/Songs/amb4.mp3",
"sound/Left4Dead/Songs/amb5.mp3",
"sound/Left4Dead/Songs/amb10.mp3",
"sound/Left4Dead/Songs/amb6.mp3",
"sound/Left4Dead/Songs/amb12.mp3",
"sound/Left4Dead/Songs/amb7.mp3",
"sound/Left4Dead/Songs/amb11.mp3",
"sound/Left4Dead/Songs/amb8.mp3"
}
new const Float:music_lenght[] = {
139.0,
304.0,
200.0,
125.0,
200.0,
255.0,
200.0,
118.0
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "eFreezeTime", "a", "1=0", "2=0")
register_clcmd("say /stop","stop")
register_clcmd("say_team /stop","stop")
register_clcmd("say /play","play")
register_clcmd("say_team /play","play")
register_logevent("logevent_round_end", 2, "1=Round_End")
}
public stop(id)
{
if(listening[id])
{
client_cmd(id,"mp3 stop")
listening[id] = 0
if(task_exists(id))
remove_task(id)
}
else
{
client_print(id,print_chat,"You are not listening!")
}
}
public play(id)
{
if(!listening[id])
{
new abc = random_num(0,sizeof music - 1)
client_cmd(id, "mp3 play %s", music[abc])
listening[id] = 1
set_task(music_lenght[abc],"stop",id)
}
else
{
client_print(id,print_chat,"You are already listening!")
}
}
public plugin_precache()
{
for(new i = 0; i < sizeof music; i++)
precache_sound(music[i])
}
public eFreezeTime()
{
client_cmd(0, "mp3 play %s", music[random_num(0,sizeof music - 1)])
}
public client_disconnect(id)
{
listening[id] = 0
if(task_exists(id))
remove_task(id)
}
Or Like This ?
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Music Plugin"
#define VERSION "1.0"
#define AUTHOR "DoviuX"
new listening[33]
new const music[][] = {
"sound/Left4Dead/Songs/amb4.mp3",
"sound/Left4Dead/Songs/amb5.mp3",
"sound/Left4Dead/Songs/amb10.mp3",
"sound/Left4Dead/Songs/amb6.mp3",
"sound/Left4Dead/Songs/amb12.mp3",
"sound/Left4Dead/Songs/amb7.mp3",
"sound/Left4Dead/Songs/amb11.mp3",
"sound/Left4Dead/Songs/amb8.mp3"
}
new const Float:music_lenght[] = {
139.0,
304.0,
200.0,
125.0,
200.0,
255.0,
200.0,
118.0
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "eFreezeTime", "a", "1=0", "2=0")
register_clcmd("say /stop","stop")
register_clcmd("say_team /stop","stop")
register_clcmd("say /play","play")
register_clcmd("say_team /play","play")
register_logevent("EventRoundEnd", 2, "1=Round_End");
}
public stop(id)
{
if(listening[id])
{
client_cmd(id,"mp3 stop")
listening[id] = 0
if(task_exists(id))
remove_task(id)
}
else
{
client_print(id,print_chat,"You are not listening!")
}
}
public play(id)
{
if(!listening[id])
{
new abc = random_num(0,sizeof music - 1)
client_cmd(id, "mp3 play %s", music[abc])
listening[id] = 1
set_task(music_lenght[abc],"stop",id)
}
else
{
client_print(id,print_chat,"You are already listening!")
}
}
public plugin_precache()
{
for(new i = 0; i < sizeof music; i++)
precache_sound(music[i])
}
public eFreezeTime()
{
client_cmd(0, "mp3 play %s", music[random_num(0,sizeof music - 1)])
}
public client_disconnect(id)
{
listening[id] = 0
if(task_exists(id))
remove_task(id)
}
|