Author
|
Message
|
sıɹɹoɥɔ ʞɔnu
|
07-31-2012
, 12:50
Simple auto teamjoin problem
|
#1
|
I tried to remake Exolent's Team Join Management with an simple version.
Here is the code:
Spoiler
PHP Code:
#include < amxmodx >
const VGUI_JOIN_TEAM_NUM = 2
public plugin_init() { register_plugin( "Team Join Management", "0.3", "Exolent" ) register_message( get_user_msgid( "ShowMenu" ), "message_ShowMenu" ) register_message( get_user_msgid( "VGUIMenu" ), "message_VGUIMenu" ) }
public message_ShowMenu( iMsgid, iDest, id ) { static const FIRST_JOIN_MSG[ ] = "#Team_Select" static const FIRST_JOIN_MSG_SPEC[ ] = "#Team_Select_Spect" static const INGAME_JOIN_MSG[ ] = "#IG_Team_Select" static const INGAME_JOIN_MSG_SPEC[ ] = "#IG_Team_Select_Spect" static sMenuCode[ sizeof( INGAME_JOIN_MSG_SPEC ) ] get_msg_arg_string( 4, sMenuCode, charsmax( sMenuCode ) ) if( equal( sMenuCode, FIRST_JOIN_MSG ) || equal( sMenuCode, FIRST_JOIN_MSG_SPEC ) ) { set_autojoin_task( id, iMsgid ) return PLUGIN_HANDLED } else if( equal( sMenuCode, INGAME_JOIN_MSG ) || equal( sMenuCode, INGAME_JOIN_MSG_SPEC ) ) { set_autojoin_task( id, iMsgid ) return PLUGIN_HANDLED } return PLUGIN_CONTINUE }
public message_VGUIMenu( iMsgid, iDest, id ) { if( get_msg_arg_int( 1 ) != VGUI_JOIN_TEAM_NUM ) { return PLUGIN_CONTINUE } set_autojoin_task( id, iMsgid ) return PLUGIN_CONTINUE }
public task_Autojoin( iParam[ ], id ) { if( is_user_connected( id ) ) { handle_join( id, iParam[ 0 ], random_num( 1, 2 ) ) } }
handle_join( id, iMsgid, iTeam ) { new iMsgBlock = get_msg_block( iMsgid ) set_msg_block( iMsgid, BLOCK_SET ) static const szTeamNums[ 4 ][ ] = { "0", "1", "2", "3" } engclient_cmd( id, "jointeam", szTeamNums[ iTeam ] ) engclient_cmd( id, "joinclass", "5" ) set_msg_block( iMsgid, iMsgBlock ) }
set_autojoin_task( id, iMsgid ) { new iParam[ 2 ] iParam[ 0 ] = iMsgid set_task( 1.0, "task_Autojoin", id, iParam, sizeof( iParam ) ) }
but sometimes when i connected is say:
Code:
This command is not available to you at this point // Cstrike_TitlesTXT_Command_Not_Available
why ? I need to play with m_iUserPrefs offset ? Who to do ? Thanks.
|
|
|
|