自動加入CT(適合deathrun使用)

Home Home
<< 1 2 >>
跳頁: (共 2 頁)
引用 | 編輯 Mansoncs
2012-04-06 10:07
樓主
推文 x0
【插件資訊】

插件來源:部份修改
使用指令:一連接入伺服器後會有motd,按完確定後就是ct
沒有tr或spec選擇
安裝路徑:amxx 放入 addons\amxmodx\plugins      後 在 plugins.ini 加入 即可

【插件介紹】

這是一個簡單的插件,0雅不貴

[此文章售價 0 雅幣已有 252 人購買]
若發現會員採用欺騙的方法獲取財富,請立刻舉報,我們會對會員處以2-N倍的罰金,嚴重者封掉ID!



獻花 x0
引用 | 編輯 1661066267
2012-04-06 14:54
1樓
  
LZ沒源碼,幫你補個源碼:
複製程式
 

#include <amxmodx>

enum
{
 TEAM_NONE = 0,
 TEAM_T,
 TEAM_CT,
 TEAM_SPEC,
 
 MAX_TEAMS
};
new const g_cTeamChars[MAX_TEAMS] =
{
 'U',
 'T',
 'C',
 'S'
};
new const g_sTeamNums[MAX_TEAMS][] =
{
 "0",
 "1",
 "2",
 "3"
};
new const g_sClassNums[MAX_TEAMS][] =
{
 "1",
 "2",
 "3",
 "4"
};

// Old Style Menus
stock const FIRST_JOIN_MSG[] =  "#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] = "#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] =  "#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] = "#IG_Team_Select_Spect";
const iMaxLen = sizeof(INGAME_JOIN_MSG_SPEC);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =  2;

new g_iTeam[33];
new g_iPlayers[MAX_TEAMS];

new tjm_join_team;
new tjm_switch_team;
new tjm_class[MAX_TEAMS];
new tjm_block_change;

new blockjoining[6] 

public admin_lockspec() { 
blockjoining[5] = PLUGIN_HANDLED 
return PLUGIN_HANDLED 
} 

public plugin_init()
{
 register_plugin("Team Join Management", "0.3", "Exolent");
 register_event("TeamInfo", "event_TeamInfo", "a");
 register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
 register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
 tjm_join_team = register_cvar("tjm_join_team", "1");
 tjm_switch_team = register_cvar("tjm_switch_team", "1");
 tjm_class[TEAM_T] = register_cvar("tjm_class_t", "2");
 tjm_class[TEAM_CT] = register_cvar("tjm_class_ct", "4");
 tjm_block_change = register_cvar("tjm_block_change", "1");
 register_concmd("amx_lockspec","admin_lockspec",ADMIN_SLAY,"locks Spec Team") 
 return PLUGIN_CONTINUE 
}

public plugin_cfg()
{
 set_cvar_num("mp_limitteams", 32);
 set_cvar_num("sv_restart", 1);
}

public client_disconnect(id)
{
 remove_task(id);
}

public event_TeamInfo()
{
 new id = read_data(1);
 new sTeam[32], iTeam;
 read_data(2, sTeam, sizeof(sTeam) - 1);
 for(new i = 0; i < MAX_TEAMS; i++)
 {
  if(g_cTeamChars[i] == sTeam[0])
  {
   iTeam = i;
   break;
  }
 }
 
 if(g_iTeam[id] != iTeam)
 {
  g_iPlayers[g_iTeam[id]]--;
  g_iTeam[id] = iTeam;
  g_iPlayers[iTeam]++;
 }
}

public message_ShowMenu(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))
 {
  if(should_autoswitch(id))
  {
   set_autoswitch_task(id, iMsgid);
   return PLUGIN_HANDLED;
  }
  else if(get_pcvar_num(tjm_block_change))
  {
   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;
 }
 
 if(should_autojoin(id))
 {
  set_autojoin_task(id, iMsgid);
  return PLUGIN_HANDLED;
 }
 else if(should_autoswitch(id))
 {
  set_autoswitch_task(id, iMsgid);
  return PLUGIN_HANDLED;
 }
 else if((TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && get_pcvar_num(tjm_block_change))
 {
  return PLUGIN_HANDLED;
 }
 return PLUGIN_CONTINUE;
}

public task_Autojoin(iParam[], id)
{
 new iTeam = get_new_team(get_pcvar_num(tjm_join_team));
 if(iTeam != -1)
 {
  handle_join(id, iParam[0], iTeam);
 }
}

public task_Autoswitch(iParam[], id)
{
 new iTeam = get_switch_team(id);
 if(iTeam != -1)
 {
  handle_join(id, iParam[0], iTeam);
 }
}

stock handle_join(id, iMsgid, iTeam)
{
 new iMsgBlock = get_msg_block(iMsgid);
 set_msg_block(iMsgid, BLOCK_SET);
 
 engclient_cmd(id, "jointeam", g_sTeamNums[iTeam]);
 
 new iClass = get_team_class(iTeam);
 if(1 <= iClass <= 4)
 {
  engclient_cmd(id, "joinclass", g_sClassNums[iClass - 1]);
 }
 set_msg_block(iMsgid, iMsgBlock);
}

stock get_new_team(iCvar)
{
 switch(iCvar)
 {
  case 1:
  {
   return TEAM_T;
  }
  case 2:
  {
   return TEAM_CT;
  }
  case 3:
  {
   return TEAM_SPEC;
  }
  case 4:
  {
   new iTCount = g_iPlayers[TEAM_T];
   new iCTCount = g_iPlayers[TEAM_CT];
   if(iTCount < iCTCount)
   {
    return TEAM_T;
   }
   else if(iTCount > iCTCount)
   {
    return TEAM_CT;
   }
   else
   {
    return random_num(TEAM_T, TEAM_CT);
   }
  }
 }
 return -1;
}

stock get_switch_team(id)
{
 new iTeam;
 
 new iTCount = g_iPlayers[TEAM_T];
 new iCTCount = g_iPlayers[TEAM_CT];
 switch(g_iTeam[id])
 {
  case TEAM_T: iTCount--;
  case TEAM_CT: iCTCount--;
 }
 if(iTCount < iCTCount)
 {
  iTeam = TEAM_T;
 }
 else if(iTCount > iCTCount)
 {
  iTeam = TEAM_CT;
 }
 else
 {
  iTeam = random_num(TEAM_T, TEAM_CT);
 }
 
 if(iTeam != g_iTeam[id])
 {
  return iTeam;
 }
 
 return -1;
}

stock get_team_class(iTeam)
{
 new iClass;
 if(TEAM_NONE < iTeam < TEAM_SPEC)
 {
  iClass = get_pcvar_num(tjm_class[iTeam]);
  if(iClass < 1 || iClass > 4)
  {
   iClass = random_num(1, 4);
  }
 }
 return iClass;
}

stock set_autojoin_task(id, iMsgid)
{
 new iParam[2];
 iParam[0] = iMsgid;
 set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam));
}

stock set_autoswitch_task(id, iMsgid)
{
 new iParam[2];
 iParam[0] = iMsgid;
 set_task(0.1, "task_Autoswitch", id, iParam, sizeof(iParam));
}

stock bool:should_autojoin(id)
{
 return ((5 > get_pcvar_num(tjm_join_team) > 0) && is_user_connected(id) && !(TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

stock bool:should_autoswitch(id)
{
 return (get_pcvar_num(tjm_switch_team) && is_user_connected(id) && (TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}




獻花 x0
引用 | 編輯 qazzsew2988
2012-04-06 17:01
2樓
  
0元當然不貴
不過這個能用在哪裡

獻花 x0
引用 | 編輯 op47
2012-04-06 19:45
3樓
  
是用cs set user team 嗎? 表情

獻花 x0
引用 | 編輯 Mansoncs
2012-04-06 20:14
4樓
  
下面是引用 qazzsew2988 於 2012-04-06 17:01 發表的 : 到引言文
0元當然不貴
不過這個能用在哪裡

這個用在死跑,kz等等阿

獻花 x0
引用 | 編輯 loklichan512
2012-05-26 10:32
5樓
  
表情 謝謝樓主分享
我找了很久了 表情

獻花 x0
引用 | 編輯 dd123
2012-05-27 15:52
6樓
  
這個很好喔 這樣玩死奔就不用在選隊伍了!!

獻花 x0
引用 | 編輯 adi37545vfg
2012-07-07 14:37
7樓
  
表情 表情 表情 之後再按M 還可以選隊伍嗎>"<????~~~~ 表情 表情

獻花 x0
引用 | 編輯 Mansoncs
2012-07-07 18:46
8樓
  
下面是引用 adi37545vfg 於 2012-07-07 14:37 發表的 : 到引言文
表情   表情   表情 之後再按M 還可以選隊伍嗎>"<????~~~~ 表情   表情

不可以阿,不能選擇任何隊伍

獻花 x0
引用 | 編輯 0o0o0
2012-07-27 12:17
9樓
  
用死奔應該會很好用 表情

獻花 x0
引用 | 編輯 opod1
2012-08-09 14:35
10樓
  
不能download ?

獻花 x0
引用 | 編輯 李洨明
2012-10-09 21:59
11樓
  
自動加入 跟手動有啥不一樣? 不過好用是真的

獻花 x0
引用 | 編輯 [NiGhT]-妖
2012-12-30 22:03
12樓
  
玩喪屍也有用嗎? 表情 表情

獻花 x0
引用 | 編輯 he01148306
2013-01-27 19:02
13樓
  
如果用了突然想選恐怖不就很麻煩

獻花 x0
引用 | 編輯 he01148306
2013-02-02 09:20
14樓
  
用在1.6還可以 但在其他遊戲卻不能= = )純回不下

獻花 x0
引用 | 編輯 cs槍王
2013-02-08 10:22
15樓
  
下面是引用 1661066267 於 2012-04-06 14:54 發表的 : 到引言文
LZ沒源碼,幫你補個源碼:
[code]
#include <amxmodx>
enum
{
.......
這是sma嗎?

獻花 x0
引用 | 編輯 xuqiang52133
2013-02-20 10:47
16樓
  
-这个你能帮我弄成自动假如T队伍吗》谢谢你了。

獻花 x0
引用 | 編輯 Mansoncs
2013-03-16 10:34
17樓
  
下面是引用 he01148306 於 2013-01-27 19:02 發表的 : 到引言文
如果用了突然想選恐怖不就很麻煩

不會啊! 死跑不會突然想選恐怖份子的! 死跑插件已會
自動隨機找一個人做恐怖份子,你沒玩過嗎?

獻花 x0
引用 | 編輯 xuqiang52133
2013-07-10 17:39
18樓
  
这个不能选择匪徒吗?我实验了,不能选择队伍。

獻花 x0
引用 | 編輯 IamJed
2013-09-23 11:39
19樓
  
我都在TD.org 玩Deathrun的= = 所以我用不了= =謝謝

獻花 x0
引用 | 編輯 r4903820
2014-02-08 15:54
20樓
  
謝謝瞜 找很久了
表情

獻花 x0
引用 | 編輯 a0841688
2014-03-01 20:34
21樓
  
自動加入CT GOOD!!!!

獻花 x0
引用 | 編輯 ty01314
2014-06-30 21:15
22樓
  
真是個好用的插件,自已單機奔跑很有用。 表情

獻花 x0
引用 | 編輯 邪冷刃
2014-10-20 17:08
23樓
  
谢谢分享

獻花 x0
引用 | 編輯 sdfasfwefaef
2014-10-28 09:17
24樓
  
自动加入T也来一个。这样随机都有了

獻花 x0
引用 | 編輯 siamkcs
2015-04-18 16:17
25樓
  
多謝大大的無私分享

獻花 x0
引用 | 編輯 frank841220
2015-07-07 16:28
26樓
  
感謝分享

獻花 x0
引用 | 編輯 acbbb261
2015-08-05 10:58
27樓
  
很好的样子~~~

獻花 x0
引用 | 編輯 etbow2006
2015-12-12 04:40
28樓
  
棒!!

獻花 x0
引用 | 編輯 clover655
2016-05-15 21:04
29樓
  
感謝大大的分享

獻花 x0
<< 1 2 >>
跳頁: (共 2 頁)