Raised This Month: $51 Target: $400
 12% 

[Req] Transfer to CT those who retries


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snake.
Senior Member
Join Date: Jul 2017
Old 06-10-2020 , 22:13   [Req] Transfer to CT those who retries
Reply With Quote #1

If someone retry in 20 seconds, they will be automatically transfered to CT team. Thanks in advance.
Snake. is offline
Send a message via Skype™ to Snake.
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-14-2020 , 01:23   Re: [Req] Transfer to CT those who retries
Reply With Quote #2

Code:
#include amxmodx //If client retries in 20 sec auto CT. #define SNAKE 5000 #define disconnected disconnect public plugin_init() {     register_plugin("Force CT on 20s retry","A",".sρiηX҉."); } public client_putinserver(id) {     set_user_info(id,"_vgui_menus", "0")     if(task_exists(id+SNAKE))         change_task(id+SNAKE, 0.3) &&         set_msg_block( get_user_msgid( "MOTD" ), BLOCK_SET );     else         CS_OnBuyAttempt(id) } public set_team_ct(TaskID) {     new id = TaskID-SNAKE     set_user_info(id,"_vgui_menus", "0")     client_cmd(id,"jointeam 2"); } public CS_OnBuyAttempt(id){ set_user_info(id,"_vgui_menus", "0");} public client_disconnected(id) {     set_task(20.0,"set_team_ct", id+SNAKE); }
__________________

Last edited by DJEarthQuake; 10-29-2020 at 17:12. Reason: set_user_info is better
DJEarthQuake is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 06-14-2020 , 03:46   Re: [Req] Transfer to CT those who retries
Reply With Quote #3

Try if this kicks you from reconnecting and if so change it to set the team.

Code:
#include <amxmodx> #define RETRY 20 new Trie:trie; new steamid[MAX_PLAYERS+1][32]; public plugin_init(){     trie = TrieCreate(); } public client_authorized(id){     get_user_authid(id, steamid[id], charsmax(steamid[]));     _do(steamid[id], id); } public client_disconnected(id){     TrieSetCell(trie, steamid[id], get_systime());     set_task(float(RETRY), "delete_entry", _, steamid[id], charsmax(steamid[])) } public delete_entry(_steamid[32]){     _do(_steamid); } stock _do(input[], id=0){     new _time, _systime = get_systime();         if (TrieGetCell(trie, input, _time)){         if (id && _systime - _time <= RETRY)                 server_cmd("kick #%d", get_user_userid(id));         else TrieDeleteKey(trie, input);     } }
__________________

Last edited by Relaxing; 06-14-2020 at 03:54. Reason: explanation
Relaxing is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 06-14-2020 , 03:49   Re: [Req] Transfer to CT those who retries
Reply With Quote #4

Code:
#include <amxmod> #pragma semicolon 1 const TASKID_Autojoin = 583079; new const FIRST_JOIN_MSG[] =        "#Team_Select"; new const FIRST_JOIN_MSG_SPEC[] =   "#Team_Select_Spect"; new const INGAME_JOIN_MSG[] =      "#IG_Team_Select"; new const INGAME_JOIN_MSG_SPEC[]"#IG_Team_Select_Spect"; const iMaxLen = sizeof( INGAME_JOIN_MSG_SPEC ); public plugin_init() {     register_plugin( "Auto CT Join", "1.0", "Exolent" );         register_message( get_user_msgid("ShowMenu"), "msgShowMenu" );     register_message( get_user_msgid("VGUIMenu"), "msgVGUIMenu" );         // I know this is gay but ffs sometimes it doesnt blocked...     register_clcmd( "chooseteam", "cmdBlock" ); } public plugin_cfg() {     set_cvar_num( "mp_limitteams", 32 );     set_cvar_num( "mp_autoteambalance", 0 );     set_cvar_num( "sv_restart", 1 ); } public cmdBlock( id )     return PLUGIN_HANDLED; public client_disconnect( id )     remove_task( id + TASKID_Autojoin ); public msgShowMenu( iMsgid, iDest, id ) {     static sMenuCode[iMaxLen];     get_msg_arg_string(4, sMenuCode, sizeof(sMenuCode) - 1);         if( equal(sMenuCode, FIRST_JOIN_MSG) || equal(sMenuCode, FIRST_JOIN_MSG_SPEC) ) {         if( should_autojoin(id) ) {             set_autojoin_task(id, iMsgid);             return PLUGIN_HANDLED;         }     }     else if( equal(sMenuCode, INGAME_JOIN_MSG) || equal(sMenuCode, INGAME_JOIN_MSG_SPEC) )         return PLUGIN_HANDLED;         return PLUGIN_CONTINUE; } public msgVGUIMenu( iMsgid, iDest, id ) {     if( get_msg_arg_int(1) != 2 )         return PLUGIN_CONTINUE;         if( should_autojoin(id) ) {         set_autojoin_task(id, iMsgid);         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; } public task_Autojoin( iParam[], id )     handle_join( id - TASKID_Autojoin, iParam[0] ); handle_join( id, iMsgid ) {     new iMsgBlock = get_msg_block( iMsgid );     set_msg_block( iMsgid, BLOCK_SET );         engclient_cmd( id, "jointeam", "2" );         new iClass[2];     iClass[0] = random_num( '1', '4' );     engclient_cmd( id, "joinclass", iClass );         set_msg_block( iMsgid, iMsgBlock ); } set_autojoin_task( id, iMsgid ) {     new iParam[1];     iParam[0] = iMsgid;     set_task( 0.1, "task_Autojoin", id + TASKID_Autojoin, iParam, sizeof(iParam) ); } should_autojoin( id )     return ( is_user_connected(id) && get_user_team(id) != 2 && !task_exists(id + TASKID_Autojoin) );
alferd 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 19:55.


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