Raised This Month: $ Target: $400
 0% 

Plugin crashing server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 07-05-2017 , 18:33   Plugin crashing server
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

#define PLUGIN "SoundMenu"
#define VERSION "v1.0"
#define AUTHOR "InteX"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_soundmenu""soundmenu"ADMIN_RCON"- otvara se menu slican speech meniju.")
}

public 
plugin_precache()
{
    
precache_sound("soundmenu/championsleague.mp3")
    
precache_sound("soundmenu/bashenga.mp3")
    
precache_sound("soundmenu/waka.mp3")
    
precache_sound("soundmenu/moja_vila.mp3")
    
precache_sound("soundmenu/ego.mp3")
    
precache_sound("soundmenu/gadafi.mp3")
}

public 
settask(id)
{
    
set_task(0.1"soundmenu")
}
public 
soundmenu(idlevelcid){
    if(!
cmd_access(idlevelcid1))
    return 
PLUGIN_HANDLED
    
new menu menu_create("\wSoundMenu v1.0\y by InteX""sound_meni");
    
menu_additem(menu"\yZaustavi muziku");
    
menu_additem(menu"Champions League");
    
menu_additem(menu"Vivo - Bashenga");
    
menu_additem(menu"Vivo - Waka");
    
menu_additem(menu"Juice - Moja Vila")
    
menu_additem(menu"Milan Stankovic - Ego")
    
menu_additem(menu"Maus Maki - Gadafi")
    
menu_display(idmenu);
    return 
PLUGIN_HANDLED
}
public 
sound_meni(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_CONTINUE;
    }
    
    new 
dst[33]
    
get_user_name(iddstcharsmax(dst))
    
    switch(
item)
    {
        case 
0:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je zaustavio muziku."dst)
            
client_cmd(0,"mp3 stop")
            
settask(id)
        }
        case 
1:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 pustio pesmu ^4'Champions League Anthem'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/championsleague.mp3")
            
settask(id)
        }
        case 
2:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je pustio pesmu ^4'Vivo - Bashenga'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/bashenga.mp3")
            
settask(id)
        }
        case 
3:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je pustio pesmu ^4'Vivo - Waka'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/waka.mp3")
            
settask(id)
        }
        case 
4:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je pustio pesmu ^4'Juice - Moja Vila'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/moja_vila.mp3")
            
settask(id)
        }
        case 
5:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je pustio pesmu ^4'Milan Stankovic - Ego'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/ego.mp3")
            
settask(id)
        }
        case 
6:
        {
            
ColorChat(0TEAM_COLOR"^4[MILF-JB]^1 Admin^3 %s^1 je pustio pesmu ^4'Maus Maki - Gadafi'"dst)
            
client_cmd(0,"mp3 play sound/soundmenu/gadafi.mp3")
            
settask(id)
        }

    }
    return 
PLUGIN_CONTINUE;

Why is this plugin crashing my server, everytime i play any music.
InteX01 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-05-2017 , 19:30   Re: Plugin crashing server
Reply With Quote #2

I think you don't need use "set_task" to show menu.

When you're precaching .mp3 SOUND, I think you need add sound/...example.mp3.

Example: precache_sound("sound/soundmenu/gadafi.mp3")
__________________








CrazY. is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 07-05-2017 , 19:34   Re: Plugin crashing server
Reply With Quote #3

It plays... .. But what causes server to crash :/ ?
InteX01 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 07-05-2017 , 20:19   Re: Plugin crashing server
Reply With Quote #4

Use precache_generic( ) for Mp3 files. Plus, try adding the "sound/" to the path.

PHP Code:
precache_generic"sound/soundmenu/championsleague.mp3" 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-06-2017 , 09:26   Re: Plugin crashing server
Reply With Quote #5

set_task(0.1, "soundmenu")


set_task(0.1, "soundmenu", id)


Destroy the menu in the handler fwd if you are recreating it..
And always return plugin handled in menu handler forward..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-06-2017 at 09:29.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-06-2017 , 09:54   Re: Plugin crashing server
Reply With Quote #6

Why did you even used set_task? I'm pretty sure that calling the function directly is more faster than set_task ...
You are showing a menu not passing a parameter to an object( player or whatever ) don't use
(id, level, cid) use (id) and to check the admin flag use get_user_flags(id) & ADMIN_RCON ...
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.
SpawnerF 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:58.


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