Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
|
11-23-2009
, 12:55
Re: Need help on my menu
|
#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(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
g_got_beacon[id] = true;
return PLUGIN_HANDLED
}
public menu_handler(id, menu, item)
{
g_got_beacon[id] = false;
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
client_print(id, print_chat, "[JailBreak] Today is Going to be a Cage Day ***Listen to the Guard For More Orders***");
set_hudmessage(255, 255, 255, -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(id, print_chat, "[JailBreak] Today is Going to be a Pool Day ***Listen to the Guard For More Orders***");
set_hudmessage(255, 255, 255, -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(id, print_chat, "[JailBreak] Today is Going to be a Restricted Freeday ***Listen to the Guard For More Orders***");
set_hudmessage(255, 255, 255, -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(id, print_chat, "[JailBreak] Today is Going to be a Unrestricted Freeday^n***ANYTHING GOES***");
set_hudmessage(255, 255, 255, -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_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
if(pev_valid(g_timer_entid))
{
set_pev(g_timer_entid, pev_classname, "beacon_timer")
global_get(glb_time, g_t_time)
set_pev(g_timer_entid, pev_nextthink, g_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(Ent, pev_nextthink, g_t_time)
timer_cycle()
return FMRES_IGNORED
}
public plugin_unpause()
{
if(pev_valid(g_timer_entid))
{
global_get(glb_time, g_t_time)
g_t_time += UPDATE_INTERVAL
set_pev(g_timer_entid, pev_nextthink, g_t_time)
}
}
public timer_cycle()
{
static id
for(id=1; id<=g_max_players; id++)
if(g_got_beacon[id] && is_user_alive(id))
show_beacon(id)
}
public show_beacon(id)
{
static origin[3]
emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
get_user_origin(id, origin)
message_begin(MSG_BROADCAST, SVC_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()
}
__________________
|
|