Raised This Month: $ Target: $400
 0% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-28-2011 , 10:33   Re: Help
Reply With Quote #1

I've added a simple team check.

PHP Code:
#include <amxmodx>

#define AUTO_TEAM_JOIN_DELAY 0.1

#define TEAM_SELECT_VGUI_MENU_ID 2

public plugin_init() 
{
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
}

public 
message_show_menu(msgiddestid
{
    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid
{
    if( 
get_user_teamid ) != && get_user_teamid ) != )
    return 
PLUGIN_CONTINUE;
    
    if (
get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID )
        return 
PLUGIN_CONTINUE

    set_force_team_join_task
(idmsgid)

    return 
PLUGIN_HANDLED
}

set_force_team_join_task(idmenu_msgid) {
    static 
param_menu_msgid[2]
    
param_menu_msgid[0] = menu_msgid
    set_task
(AUTO_TEAM_JOIN_DELAY"task_force_team_join"idparam_menu_msgidsizeof param_menu_msgid)
}

public 
task_force_team_join(menu_msgid[], id) {
    if (
get_user_team(id))
        return

    
force_team_join(idmenu_msgid[0], "1""1")
}

stock force_team_join(idmenu_msgid/* const */ team[] = "5"/* const */ class[] = "0") {
    static 
jointeam[] = "jointeam"
    
if (class[0] == '0') {
        
engclient_cmd(idjointeamteam)
        return
    }

    static 
msg_blockjoinclass[] = "joinclass"
    
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(idjointeamteam)
    
engclient_cmd(idjoinclass, class)
    
set_msg_block(menu_msgidmsg_block)

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 01:06.


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