Code:
/* Copyright (C) Rixorster
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <tsx>
// Made For PimpLordz
new playing
new radiosound
new Float:porigin[3] = { 1153.0, -289.0, -25.0 }
/*****************Declare Bar Music*****************/
public plugin_init()
{
register_plugin("Bar Music","1.0","Rixorster")
register_menucmd(register_menuid("Bar Music"),1023,"RadioMenuChoice")
register_concmd("radio_menu", "radio_menu", ADMIN_LEVEL_E, "RadioMenu")
register_clcmd("radio_menu", "radio_menu")
register_clcmd("say call_menu", "radio_menu")
register_concmd("harbuyay","create_entities")
}
public plugin_precache()
{
precache_sound("Pimplordz/Music/whatislove.wav")
precache_sound("Pimplordz/blank.wav")
}
/*****************Function that calls Bar Music*****************/
public radio_menu(id)
{
RadioMenuMenu(id)
return PLUGIN_CONTINUE
}
/*****************Menu Code for Bar Music*****************/
public RadioMenuMenu(id)
{
if (is_user_alive(id)) {
new menuBody[1024]
new key
format(menuBody, 1023, "\wBar Music\W^n^n\y1.\w What is love^n\y2.\w Lol^n\y3.\w Exit.")
key = (1<<0)|(1<<1)|(1<<2)
show_menu(id, key, menuBody)
}
}
/*****************Bar Music Choice Switch*****************/
public RadioMenuChoice(id, key)
{
switch(key)
{
case 0:
{
if(playing != 0)
{
return PLUGIN_HANDLED
}
new musicBox = create_entity("ambient_generic")
entity_set_string(musicBox,EV_SZ_classname,"ambient_generic")
entity_set_origin(musicBox,porigin)
entity_set_int(musicBox,EV_INT_spawnflags,4)
entity_set_string(musicBox,EV_SZ_message,"Pimplordz/Music/whatislove.wav")
set_task(69.0,"stop_Love")
client_cmd(id,"say lol")
playing = 1
}
case 1:
{
client_print(id, print_chat, "To be continued")
}
case 2:
{
return PLUGIN_HANDLED
}
}
}
public stop_Love(musicBox)
{
entity_set_string(musicBox,EV_SZ_message,"Pimplordz/blank.wav")
playing = 0
}
public create_ambient2(Float:porigin[3],targetname[],vol[],pitch[],spawnflags,file[])
{
new ambient = create_entity("ambient_generic")
if(!ambient) return PLUGIN_HANDLED
entity_set_string(ambient,EV_SZ_classname,"ambient_generic")
entity_set_int(ambient,EV_INT_spawnflags,spawnflags)
entity_set_float(ambient,EV_FL_health,10.0)
entity_set_string(ambient,EV_SZ_targetname,targetname)
entity_set_string(ambient,EV_SZ_message,file)
DispatchKeyValue(ambient,"pitch",pitch)
DispatchKeyValue(ambient,"volstart",vol)
DispatchKeyValue(ambient,"pitchstart",pitch)
DispatchSpawn(ambient)
new Float:origin[3]
origin[0] = float(porigin[0])
origin[1] = float(porigin[1])
origin[2] = float(porigin[2])
entity_set_origin(ambient,origin)
return PLUGIN_HANDLED
}
public create_entities()
{
create_ambient2( porigin, "barmusic", "10", "80", 8, "Pimplordz/Music/whatislove.wav" )
}