Team Random Class
I noticed that the shotgun menu selection doesn't work with this code.
That is, press B 2 and immediately written in the center of the screen-now this message remains unavailable
What happened?
PHP Code:
#include <amxmodx>
public plugin_init()
{
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
}
public message_vgui_menu(msgid, dest, id)
{
switch(get_msg_arg_int(1))
{
case 26, 27:
{
set_task(0.0, "random_class", id, _, _, "a", 1)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public message_show_menu(msgid, dest, id)
{
static text[6]; get_msg_arg_string(4, text, charsmax(text))
switch(text[4])
{
case 'r', 'S':
{
set_task(0.0, "random_class", id, _, _, "a", 1)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public random_class(id)
{
switch(random_num(1, 4))
{
case 1: engclient_cmd(id, "joinclass", "1")
case 2: engclient_cmd(id, "joinclass", "2")
case 3: engclient_cmd(id, "joinclass", "3")
case 4: engclient_cmd(id, "joinclass", "4")
}
}
|