Raised This Month: $51 Target: $400
 12% 

Need help on my menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stevenisecko138
Senior Member
Join Date: Dec 2008
Location: CA
Old 11-23-2009 , 05:12   Need help on my menu
Reply With Quote #1

I need help when someone opens the menu it turns on a beacon and when the menu closes it turns off the beacon, i did some of the code
PHP Code:
#include <amxmodx>
#include <cstrike> 
#include <fun> 
#include <hamsandwich> 



public plugin_init()
 {    
    
register_plugin("JailBreak_sub""1.0""EcKo");
     
register_clcmd"say /cm","AwesomeMenu");
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1);
    
set_task(15.0,"player_spawn"
 }
public 
player_spawn(id)
{
    if(
is_user_alive(id))
    {
        
server_cmd("decalfrequency 15")
        
client_print(idprint_chat"Type /cm to bring up the command menu");
    }
}  
public 
fw_PlayerSpawn_Post(id

    
set_user_rendering(id)    

public 
AwesomeMenu(id)
{
if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id)) 
    {  
    return 
PLUGIN_HANDLED;
}
    new 
menu menu_create("\rGuard Command Menu:""menu_handler");
    
menu_additem(menu"\wCage Day""1"0)
    
menu_additem(menu"\wPool Day""2"0)
    
menu_additem(menu"\wRestricted Freeday""3"0)
    
menu_additem(menu"\wUnrestricted Freeday""4"0)
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
public 
menu_handler(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
       new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Cage Day ***Listen to the Guard For More Orders***");
        
set_hudmessage(255255255, -1.0, -1.0);
           
show_hudmessage(id"Today is Going to be a Cage Day^n***Listen to the Guard For More Orders***");
        }
        case 
2:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Pool Day ***Listen to the Guard For More Orders***");
        
set_hudmessage(255255255, -1.0, -1.0)
           
show_hudmessage(id"Today is Going to be a Pool Day^n***Listen to the Guard For More Orders***");
        }
        case 
3
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Restricted Freeday ***Listen to the Guard For More Orders***");
        
set_hudmessage(255255255, -1.0, -1.0);
           
show_hudmessage(id"Today is Going to be a Restricted Freeday^n***Listen to the Guard For More Orders***");
        }
        case 
4
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Unrestricted Freeday^n***ANYTHING GOES***");
          
set_hudmessage(255255255, -1.0, -1.0);
           
show_hudmessage(id"Today is Going to be a Unrestricted Freeday^n***ANYTHING GOES***");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 
Found a beacon code here http://forums.alliedmods.net/showthread.php?t=96881
stevenisecko138 is offline
Send a message via AIM to stevenisecko138
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-23-2009 , 12:55   Re: Need help on my menu
Reply With Quote #2

Try this:

PHP Code:
// Beacon Code by Sylwester

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <fun>

#define MAX_PLAYERS 32
#define UPDATE_INTERVAL 3.0
#define TID_TIMER 9124

new g_snd_path[] = "buttons/blip1.wav"
new g_sprite_path[] = "sprites/laserbeam.spr"

new bool:g_got_beacon[MAX_PLAYERS+1]
new 
g_max_players
new Float:g_t_time
new g_timer_entid
new g_sprite


public plugin_init()
{
    
register_plugin("Menu+Beacon""1.0""Author");

    
register_clcmd"say /cm","AwesomeMenu");

    
g_max_players get_maxplayers();
    
create_timer();
}



public 
AwesomeMenu(id)
{
    if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    }
    new 
menu menu_create("\rGuard Command Menu:""menu_handler");
    
menu_additem(menu"\wCage Day""1"0)
    
menu_additem(menu"\wPool Day""2"0)
    
menu_additem(menu"\wRestricted Freeday""3"0)
    
menu_additem(menu"\wUnrestricted Freeday""4"0)
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    
g_got_beacon[id] = true;
    
    return 
PLUGIN_HANDLED
}

public 
menu_handler(idmenuitem)
{
    
g_got_beacon[id] = false;
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Cage Day ***Listen to the Guard For More Orders***");
            
set_hudmessage(255255255, -1.0, -1.0);
            
show_hudmessage(id"Today is Going to be a Cage Day^n***Listen to the Guard For More Orders***");
        }
        case 
2:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Pool Day ***Listen to the Guard For More Orders***");
            
set_hudmessage(255255255, -1.0, -1.0)
            
show_hudmessage(id"Today is Going to be a Pool Day^n***Listen to the Guard For More Orders***");
        }
        case 
3:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Restricted Freeday ***Listen to the Guard For More Orders***");
            
set_hudmessage(255255255, -1.0, -1.0);
            
show_hudmessage(id"Today is Going to be a Restricted Freeday^n***Listen to the Guard For More Orders***");
        }
        case 
4:
        {
            
client_print(idprint_chat"[JailBreak] Today is Going to be a Unrestricted Freeday^n***ANYTHING GOES***");
            
set_hudmessage(255255255, -1.0, -1.0);
            
show_hudmessage(id"Today is Going to be a Unrestricted Freeday^n***ANYTHING GOES***");
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
plugin_precache()
{
    
precache_sound(g_snd_path)
    
g_sprite precache_model(g_sprite_path)
}


public 
client_connect(id)
{
    
g_got_beacon[id] = false
}

public 
create_timer()
{
    
g_timer_entid engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"))

    if(
pev_valid(g_timer_entid))
    {
        
set_pev(g_timer_entidpev_classname"beacon_timer")
        
global_get(glb_timeg_t_time)
        
set_pev(g_timer_entidpev_nextthinkg_t_time UPDATE_INTERVAL)
        
register_forward(FM_Think,"fwd_Think")
    }
    else
    {
        
log_amx("Warning: Failed to create timer entity, using task instead")
        
set_task(UPDATE_INTERVAL"timer_cycle"TID_TIMER""0"b")
    }
}


public 
fwd_Think(Ent){
    if(
Ent != g_timer_entid)
        return 
FMRES_IGNORED
    g_t_time 
+= UPDATE_INTERVAL
    set_pev
(Entpev_nextthinkg_t_time)
    
timer_cycle()
    return 
FMRES_IGNORED
}


public 
plugin_unpause()
{
    if(
pev_valid(g_timer_entid))
    {
        
global_get(glb_timeg_t_time)
        
g_t_time += UPDATE_INTERVAL
        set_pev
(g_timer_entidpev_nextthinkg_t_time)
    }
}


public 
timer_cycle()
{
    static 
id
    
for(id=1id<=g_max_playersid++)
        if(
g_got_beacon[id] && is_user_alive(id))
            
show_beacon(id)
}


public 
show_beacon(id)
{
    static 
origin[3]
    
emit_sound(idCHAN_ITEMg_snd_path1.0ATTN_NORM0PITCH_NORM)

    
get_user_origin(idorigin)
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMCYLINDER)
    
write_coord(origin[0])//position.x
    
write_coord(origin[1])//position.y
    
write_coord(origin[2]-20)//position.z
    
write_coord(origin[0])    //axis.x
    
write_coord(origin[1])    //axis.y
    
write_coord(origin[2]+200)//axis.z
    
write_short(g_sprite)//sprite index
    
write_byte(0)       //starting frame
    
write_byte(1)        //frame rate in 0.1's
    
write_byte(6)        //life in 0.1's
    
write_byte(2)        //line width in 0.1's
    
write_byte(1)        //noise amplitude in 0.01's
    
write_byte(50)      //red
    
write_byte(50)      //green
    
write_byte(255)     //blue
    
write_byte(200)     //brightness
    
write_byte(6)       //scroll speed in 0.1's
    
message_end()

__________________
fysiks is online now
stevenisecko138
Senior Member
Join Date: Dec 2008
Location: CA
Old 11-23-2009 , 16:25   Re: Need help on my menu
Reply With Quote #3

thanks fysiks works fine +karma
stevenisecko138 is offline
Send a message via AIM to stevenisecko138
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 21:32.


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