AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Whats wrong with this thingy >.< *Bump* (https://forums.alliedmods.net/showthread.php?t=25964)

Rixorster 03-24-2006 16:45

Whats wrong with this thingy >.< *Bump*
 
Well, there's something wrong with this plugin, the sounds wont play at all! :(
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" ) }

Rixorster 03-25-2006 03:32

Sorry, but *Bump*
V3x? Anyone?

v3x 03-25-2006 04:02

I dunno. I suck with enitity manipulation.

Rixorster 03-25-2006 04:12

Darn darn, well, how can i make so that if i do:
Code:
// after defines... new Float:porigin[3] = { 1153.0, -289.0, -25.0 } //after plugin init... public testRadio() {     new boxOfRadio = create_entity("whatsthebestentityhere") //what entity should i choose?     entity_set_origin( boxOfRadio, porigin)     emit_sound(boxOfRadio, CHAN_AUTO, "Pimplordz/Music/whatislove.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) }

v3x 03-25-2006 04:28

Edit: Try this.
Code:
new musicBox = create_entity("ambient_generic"); if(musicBox > 0) {     DispatchKeyValue(musicBox , "message" , "Pimplordz/Music/whatislove.wav");     // ...     entity_set_origin(musicBox , porigin);     DispatchSpawn(musicBox); }
This will also help you: http://collective.valve-erc.com/inde...mbient_generic

Rixorster 03-25-2006 04:36

ooh, thanky thanky :P

v3x 03-25-2006 04:37

Edited post.

Rixorster 03-25-2006 04:58

+karma for you :P
Code:
new isleet public plugin_init() {     plugin_register("v3x is 1337","1337.0","Rix")     plugin_concmd("v3x","go_v3x") } public go_v3x() {     if(isleet == v3x)     {         client_print(id, print_chat, "V3x is mega1337")     } }


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

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