AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Auto join spect (https://forums.alliedmods.net/showthread.php?t=188433)

Netsys 06-26-2012 10:15

Auto join spect
 
As could do for players to directly enter spect?
The plugin "join team manager" of exolent not work, appears not reviewed ... players are left as "UNASSIGNED"

hornet 06-26-2012 11:12

Re: Auto join spect
 
Don't think so, probably just because of the message block.

With this players will auto join Spectator, but then will be free to join a team when they choose. Is that what your after?
Code:
#include <amxmodx> #include <cstrike> #define VGUI_SELECT_TEAM        2 public plugin_init() {     register_plugin( "Force Join Spec", "0.0.1", "hornet" );         register_message( get_user_msgid("ShowMenu"), "Message_ShowMenu" );     register_message( get_user_msgid("VGUIMenu"), "Message_VGUIMenu" ); } public client_disconnect( id ) {     remove_task( id ); } public Message_ShowMenu( iMsg, iDest, id ) {     if( cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )         return PLUGIN_CONTINUE;         static MESSAGE[] = "#Team_Select", szMsg[ charsmax( MESSAGE ) ];     get_msg_arg_string( 4, szMsg, charsmax( szMsg ) );     if( equal( szMsg, MESSAGE ) )     {         set_task( 0.1, "task_JoinTeam", id );         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; } public Message_VGUIMenu( iMsg, iDest, id ) {       if( get_msg_arg_int( 1 ) != VGUI_SELECT_TEAM || cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )         return PLUGIN_CONTINUE;             set_task( 0.1, "task_JoinTeam", id );         return PLUGIN_HANDLED; } public task_JoinTeam( id ) {     cs_set_user_team( id, CS_TEAM_SPECTATOR ); }

Netsys 06-26-2012 13:54

Re: Auto join spect
 
Quote:

Originally Posted by hornet (Post 1736517)
Code:
#include <amxmodx> #include <cstrike> #define VGUI_SELECT_TEAM        2 public plugin_init() {     register_plugin( "Force Join Spec", "0.0.1", "hornet" );         register_message( get_user_msgid("ShowMenu"), "Message_ShowMenu" );     register_message( get_user_msgid("VGUIMenu"), "Message_VGUIMenu" ); } public client_disconnect( id ) {     remove_task( id ); } public Message_ShowMenu( iMsg, iDest, id ) {     if( cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )         return PLUGIN_CONTINUE;         static MESSAGE[] = "#Team_Select", szMsg[ charsmax( MESSAGE ) ];     get_msg_arg_string( 4, szMsg, charsmax( szMsg ) );     if( equal( szMsg, MESSAGE ) )     {         set_task( 0.1, "task_JoinTeam", id );         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; } public Message_VGUIMenu( iMsg, iDest, id ) {       if( get_msg_arg_int( 1 ) != VGUI_SELECT_TEAM || cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )         return PLUGIN_CONTINUE;             set_task( 0.1, "task_JoinTeam", id );         return PLUGIN_HANDLED; } public task_JoinTeam( id ) {     cs_set_user_team( id, CS_TEAM_SPECTATOR ); }

This plugin does not work, appears as spect, but this as unasigned. The player can not see other players.

Waleed 06-26-2012 14:28

Re: Auto join spect
 
After
PHP Code:

client_connect(id) or client_putinserver(id// whichever works for you. 

You can use this:
PHP Code:

cs_set_user_team(id,CS_TEAM_SPECTATOR //Changing team to Spectator. 

I think that after connecting,Players will be forced to join team spectators,I didn't test it,Give it a try.

Netsys 06-26-2012 15:30

Re: Auto join spect
 
Quote:

Originally Posted by Waleed (Post 1736673)
After
PHP Code:

client_connect(id) or client_putinserver(id// whichever works for you. 

You can use this:
PHP Code:

cs_set_user_team(id,CS_TEAM_SPECTATOR //Changing team to Spectator. 

I think that after connecting,Players will be forced to join team spectators,I didn't test it,Give it a try.

dont work

Backstabnoob 06-26-2012 16:40

Re: Auto join spect
 
You cannot, I know when I once tried to set the user's team in client_putinserver, the server crashed.

Netsys 06-27-2012 03:58

Re: Auto join spect
 
can be achieved by hooking "ShowMenu" but I do not worked ...

Pourya 10-07-2012 08:01

Re: Auto join spect
 
hi all
any one can completed this plugin and upload sma file.

thanks all


All times are GMT -4. The time now is 06:10.

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