Serverde M basıp takım seçiyorlar bunu nasıl halledicem basebuilder mod için ideal olanı ne ?
Nasıl oto girecekler takımlara.
Sew girenler oto T mi olmaları lazım.Yeni gelenler ?
Konu
Kod:
#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;
public plugin_init()
{
register_plugin("Otomatik Takim Secme", "0.3", "LockdowN");
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", "4");
tjm_switch_team = register_cvar("tjm_switch_team", "0");
tjm_class[TEAM_T] = register_cvar("tjm_class_t", "5");
tjm_class[TEAM_CT] = register_cvar("tjm_class_ct", "5");
tjm_block_change = register_cvar("tjm_block_change", "1");
}
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));
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/Alıntı:amx_cvar tjm_join_team "1" Oyuna Giren Kişiler Hangi Takıma Atıcagını Belirler (1 - T Takımı | 2- Ct Takımı 3- Spec
amx_cvar tjm_switch_team "0" // Oyuncuların Sonradan Takım Menüsünü Açmasını Ayarlar ( 1- Açık || 0- Kapalı)
Ayn O Şimdi Bide Kodu Daha Atıcam Oda T Gelince Oto Rev Yani Zombi Olarak Revlencek Bu Daha İyi Birşey <
PHP Kod:
/* AMXX Mod script.
*
* (c) Copyright 2004, developed by Geesu
* This file is provided as is (no warranties).
*
* Changelog
* 1.1:
* Added /respawn command to spawn a player if they're dead
* Added a public cvar
* 1.0:
* Pistols are now given to players when they respawn
* sv_checkpistols cvar added, if this is set to 0, then players will always spawn with a pistol, otherwise they will only spawn with a pistol when it is not scoutzknivez and not a ka map
* sv_respawn cvar added, set this to 0 to disable the plugin
*/
new const VERSION[] = "1.1"
#include <amxmodx>
#include <fun>
#include <cstrike>
#define DISABLE_CS 0
// team ids
#define UNASSIGNED 0
#define TS 1
#define CTS 2
#define AUTO_TEAM 5
public plugin_init(){
register_plugin("Respawn Forever", VERSION, "Pimp Daddy (OoTOAoO)")
register_event("DeathMsg","on_Death","a")
register_cvar("sv_checkpistols", "0")
register_cvar("sv_respawn", "1")
register_cvar("respawn_forever_version", VERSION, FCVAR_SERVER)
register_clcmd("say","on_Chat")
register_clcmd("say_team","on_Chat")
}
public on_Chat(id)
{
if ( !get_cvar_num("sv_respawn") )
{
client_print(id, print_chat, "* Respawn plugin disabled")
//return PLUGIN_CONTINUE
}
new szSaid[32]
read_args(szSaid, 31)
if (equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
{
spawn_func(id)
}
}
public spawn_func(id)
{
new parm[1]
parm[0]=id
/* Spawn the player twice to avoid the HL engine bug */
set_task(0.5,"player_spawn",72,parm,1)
set_task(0.7,"player_spawn",72,parm,1)
}
public on_Death()
{
if ( !get_cvar_num("sv_respawn") )
return PLUGIN_CONTINUE
new victim_id = read_data(2)
spawn_func( victim_id )
return PLUGIN_CONTINUE
}
public player_spawn(parm[1])
{
spawn(parm[0])
}
public client_connect(id)
{
set_task(1.0,"spawn_func",id)
}
Ct Atması İyi Degil Çünkü Haksızlık Olur Zombi Olan Kişi Çık Gir Yapar <
Son Düzenleme: 02-03-2020, 19:32, Düzenleyen: Chucky*.
(02-03-2020, 19:32)Chucky* Adlı Kullanıcıdan Alıntı:bunu nasıl t ayarlicamBuda Gireni Otomatik Revler T Ayarlıcaksın Onu Yeni Giren Aniden T Revlencek <PHP Kod:/* AMXX Mod script.
*
* (c) Copyright 2004, developed by Geesu
* This file is provided as is (no warranties).
*
* Changelog
* 1.1:
* Added /respawn command to spawn a player if they're dead
* Added a public cvar
* 1.0:
* Pistols are now given to players when they respawn
* sv_checkpistols cvar added, if this is set to 0, then players will always spawn with a pistol, otherwise they will only spawn with a pistol when it is not scoutzknivez and not a ka map
* sv_respawn cvar added, set this to 0 to disable the plugin
*/
new const VERSION[] = "1.1"
#include <amxmodx>
#include <fun>
#include <cstrike>
#define DISABLE_CS 0
// team ids
#define UNASSIGNED 0
#define TS 1
#define CTS 2
#define AUTO_TEAM 5
public plugin_init(){
register_plugin("Respawn Forever", VERSION, "Pimp Daddy (OoTOAoO)")
register_event("DeathMsg","on_Death","a")
register_cvar("sv_checkpistols", "0")
register_cvar("sv_respawn", "1")
register_cvar("respawn_forever_version", VERSION, FCVAR_SERVER)
register_clcmd("say","on_Chat")
register_clcmd("say_team","on_Chat")
}
public on_Chat(id)
{
if ( !get_cvar_num("sv_respawn") )
{
client_print(id, print_chat, "* Respawn plugin disabled")
//return PLUGIN_CONTINUE
}
new szSaid[32]
read_args(szSaid, 31)
if (equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
{
spawn_func(id)
}
}
public spawn_func(id)
{
new parm[1]
parm[0]=id
/* Spawn the player twice to avoid the HL engine bug */
set_task(0.5,"player_spawn",72,parm,1)
set_task(0.7,"player_spawn",72,parm,1)
}
public on_Death()
{
if ( !get_cvar_num("sv_respawn") )
return PLUGIN_CONTINUE
new victim_id = read_data(2)
spawn_func( victim_id )
return PLUGIN_CONTINUE
}
public player_spawn(parm[1])
{
spawn(parm[0])
}
public client_connect(id)
{
set_task(1.0,"spawn_func",id)
}
Ct Atması İyi Degil Çünkü Haksızlık Olur Zombi Olan Kişi Çık Gir Yapar <
Ayarlamicaksın Şu İlk Attıgımı Kur Komutları Yaz Sw Sonra 2 Attıgımı Kur Olur 2 attıgım Sadece Oto Revler 1 Ciyse Hangi Takım Ve M Tuşunu Kapatır Sen Yap Olcak Olmasa Ben Yaparım.
He tamam deniyorum bu arada 2de /respawn olayı var bu noluyor serverde /kurtul var karışmazlar dimi
Benzer Konular
Yorum
352
Okunma
Yorum
431
Okunma
15-05-2026, 01:22
Yorum
556
Okunma
12-04-2026, 22:45
)

