Panel Tankhud interferes with the Tank Pass menu by disawar1, Here is a video
It is only possible to pass the tank when it is in play.
Is there a way to make the Passtank menu open before the tank spawn like in this other video?
public Plugin myinfo =
{
name = "[L4D & L4D2] Tank Pass",
author = "Scratchy [Laika] & raziEiL [disawar1]",
description = "Allows the Tank to pass control to another player.",
version = PLUGIN_VERSION,
url = "https://steamcommunity.com/id/raziEiL/"
}
public void OnPluginStart()
{
// forward void TP_OnTankPass(int old_tank, int new_tank);
#if SOURCEMOD_V_COMPAT
g_fwdOnTankPass = new GlobalForward(FORWARD_ARGS);
#else
g_fwdOnTankPass = CreateGlobalForward(FORWARD_ARGS);
#endif
LoadTranslations("l4d_tank_pass.phrases");
LoadTranslations("common.phrases");
ConVar cVar = CreateConVar("l4d_tank_pass_command", "sm_tankhud", "Execute command according convar value on old_tank and new_tank to close 3d party HUD.", FCVAR_NOTIFY);
cVar.GetString(SZF(g_sCvarCmd));
cVar.AddChangeHook(OnCvarChange_Exec);
cVar = CreateConVar("l4d_tank_pass_replace", "1", "0=Kill the alive player before the Tank pass, 1=Replace the alive player with an infected bot before the Tank pass.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarReplace = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Replace);
cVar = CreateConVar("l4d_tank_pass_damage", "0", "0=Allow to pass the Tank when taking any damage, 1=Prevent to pass the Tank when taking any damage.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarDamage = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Damage);
cVar = CreateConVar("l4d_tank_pass_fire", "1", "0=Allow to pass the Tank when on fire, 1=Prevent to pass the Tank when on fire.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarFire = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Fire);
cVar = CreateConVar("l4d_tank_pass_extinguish", "0", "If \"l4d_tank_pass_fire\" convar set to 0: 0=Ignite the new Tank when passed, 1=Extinguish the new Tank when passed.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarExtinguish = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Extinguish);
cVar = CreateConVar("l4d_tank_pass_takeover", "1", "Sets the Tank passed count according convar value when taking control of the Tank AI. If >1 the tank will be replaced with a bot when the his frustration reaches 0.", FCVAR_NOTIFY, true, 1.0, true, 2.0);
g_iTakeOverPassedCount = cVar.IntValue;
cVar.AddChangeHook(OnCvarChange_TakeOver);
cVar = CreateConVar("l4d_tank_pass_notify", "1", "0=Off, 1=Display pass command info to the Tank through chat messages.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarNotify = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Notify);
cVar = CreateConVar("l4d_tank_pass_menu", "1", "0=Off, 1=Display the menu when the Tank is spawned", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarMenu = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Menu);
cVar = CreateConVar("l4d_tank_pass_count", "1", "0=Off, >0=The number of times the Tank can be passed by plugin (Frustration counts as pass).", FCVAR_NOTIFY, true, 0.0);
g_iCvarPassedCount = cVar.IntValue;
cVar.AddChangeHook(OnCvarChange_PassCount);
cVar = CreateConVar("l4d_tank_pass_confirm", "1", "0=Off, 1=Ask the player if he wants to get the Tank.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
g_bCvarConfirm = cVar.BoolValue;
cVar.AddChangeHook(OnCvarChange_Confirm);
RegConsoleCmd("sm_pass", Command_TankPass, "Pass the Tank control to another player.");
RegConsoleCmd("sm_passtank", Command_TankPass, "Pass the Tank control to another player.");
RegConsoleCmd("sm_tankpass", Command_TankPass, "Pass the Tank control to another player.");
RegAdminCmd("sm_forcepass", Command_ForcePass, ADMFLAG_KICK, "sm_forcepass <#userid|name> - Force to pass the Tank to target player.");
RegAdminCmd("sm_taketank", Command_TakeTank, ADMFLAG_KICK, "sm_taketank <#userid|name> - Take control of the Tank AI.");
public void AdminMenu_ForcePass(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength)
{
switch (action)
{
case TopMenuAction_DisplayOption:
{
Format(buffer, maxlength, "%T", "phrase10", param);
}
case TopMenuAction_SelectOption:
{
if (GetTank())
TankPassMenu(param, Menu_ForceAdmPass);
else {
PrintToChat(param, "%t", "phrase7");
if (g_hTopMenu != null)
g_hTopMenu.Display(param, TopMenuPosition_LastCategory);
}
}
}
}
public int MenuForceAdmHandler(Menu menu, MenuAction action, int admin, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char sId[12];
menu.GetItem(param2, SZF(sId));
int target = CID(StringToInt(sId));
int tank = GetTank();
if (ValidateOffer(Validate_Default, tank, target, admin))
TankPass(tank, target, admin);
if (g_hTopMenu != null)
g_hTopMenu.Display(admin, TopMenuPosition_LastCategory);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && g_hTopMenu != null)
g_hTopMenu.Display(admin, TopMenuPosition_LastCategory);
}
case MenuAction_End:
{
delete menu;
}
}
}
public void AdminMenu_TakeTank(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength)
{
switch (action)
{
case TopMenuAction_DisplayOption:
{
Format(buffer, maxlength, "%T", "phrase12", param);
}
case TopMenuAction_SelectOption:
{
if (GetTankBot())
TankPassMenu(param, Menu_Take);
else {
PrintToChat(param, "%t", "phrase7");
if (g_hTopMenu != null)
g_hTopMenu.Display(param, TopMenuPosition_LastCategory);
}
}
}
}
public int MenuTakeAdmHandler(Menu menu, MenuAction action, int admin, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char sId[12];
menu.GetItem(param2, SZF(sId));
TakeOverTank(CID(StringToInt(sId)), admin);
if (g_hTopMenu != null)
g_hTopMenu.Display(admin, TopMenuPosition_LastCategory);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack && g_hTopMenu != null)
g_hTopMenu.Display(admin, TopMenuPosition_LastCategory);
}
case MenuAction_End:
{
delete menu;
}
}
}
/*
|--------------------------------------------------------------------------
| MENU
|--------------------------------------------------------------------------
*/
void PreTankPassMenu(int client)
{
if (client && ValidateOffer(Validate_SkipTarget, client))
TankPassMenu(client, g_bCvarConfirm ? Menu_Pass : Menu_ForcePass);
}
void TankPassMenu(int client, int menuType = Menu_Pass)
{
bool hasTarget;
Menu menu;
switch (menuType)
{
case Menu_Pass:
menu = new Menu(MenuPassHandler);
case Menu_ForcePass:
menu = new Menu(MenuForceHandler);
case Menu_ForceAdmPass:
menu = new Menu(MenuForceAdmHandler);
case Menu_Take:
menu = new Menu(MenuTakeAdmHandler);
}
menu.SetTitle("%T", "phrase4", client);
char sName[MAX_NAME_LENGTH], sId[12];
for (int i = 1; i <= MaxClients; i++){
if (!IsValidTarget(i)) continue;
public int MenuForceHandler(Menu menu, MenuAction action, int tank, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char sId[12];
menu.GetItem(param2, SZF(sId));
int target = CID(StringToInt(sId));
if (ValidateOffer(Validate_Default, tank, target))
TankPass(tank, target);
}
case MenuAction_End:
{
delete menu;
}
}
}
public int MenuPassHandler(Menu menu, MenuAction action, int tank, int param2)
{
switch (action)
{
case MenuAction_Select:
{
char sId[12];
menu.GetItem(param2, SZF(sId));
int target = CID(StringToInt(sId));
if (ValidateOffer(Validate_Default, tank, target))
OfferMenu(tank, target);
}
case MenuAction_End:
{
delete menu;
}
}
}
void OfferMenu(int tank, int target)
{
g_iTankId[target] = UID(tank);
ExecCmd(target);
char sTemp[64];
Menu menu = new Menu(OfferMenuHandler);
FormatEx(SZF(sTemp), "%T", "phrase5", target);
menu.SetTitle(sTemp);
FormatEx(SZF(sTemp), "%T", "Yes", target);
menu.AddItem("", sTemp);
FormatEx(SZF(sTemp), "%T", "No", target);
menu.AddItem("", sTemp);
menu.ExitButton = true;
menu.Display(target, 10);
}
public int OfferMenuHandler(Menu menu, MenuAction action, int target, int param2)
{
switch (action)
{
case MenuAction_Select:
{
int tank = CID(g_iTankId[target]);
if (param2 == 0){
if (ValidateOffer(Validate_NotiyfyTarget, tank, target))
TankPass(tank, target);
}
else if (IsValidTank(tank))
PrintToChat(tank, "%t", "phrase6", target);
}
case MenuAction_Cancel:
{
int tank = CID(g_iTankId[target]);
if (IsValidTank(tank))
PrintToChat(tank, "%t", "phrase6", target);
}
case MenuAction_End:
{
delete menu;
}
}
}
/*
|--------------------------------------------------------------------------
| COMMANDS
|--------------------------------------------------------------------------
*/
public Action Command_TankPass(int client, int args)
{
if (!g_bIsBlocked[client])
PreTankPassMenu(client);
return Plugin_Handled;
}
public Action Command_ForcePass(int client, int args)
{
if (client && args){
char sArg[32], sName[MAX_TARGET_LENGTH];
int iTargetList[MPS], iCount;
bool bIsML;
GetCmdArg(1, SZF(sArg));
if (IsAllowToPass(client) && IsValidTank(client)){
if (g_bCvarMenu)
PreTankPassMenu(client);
PrintToChat(client, "%t", "phrase1");
}
}
public void Event_EntityKilled(Event h_Event, char[] s_Name, bool b_DontBroadcast)
{
int entity = h_Event.GetInt("entindex_killed");
if (IsClient(entity) && IsPlayerTank(entity))
RequestFrame(OnEntKilled, entity);
}
public void OnEntKilled(int client)
{
if (!IsAliveTank(client))
ResetPassData(client);
}
public void Event_PlayerBotReplace(Event h_Event, char[] s_Name, bool b_DontBroadcast)
{
int client = CID(h_Event.GetInt("player"));
if (!g_iPassedCount[client]) return;
int bot = CID(h_Event.GetInt("bot"));
if (IsReplaceableTank(bot, client))
TransferPass(client, bot);
}
// fired after tank_spawn
public void Event_BotPlayerReplace(Event h_Event, char[] s_Name, bool b_DontBroadcast)
{
int bot = CID(h_Event.GetInt("bot"));
if (!g_iPassedCount[bot]) return;
int client = CID(h_Event.GetInt("player"));
if (IsReplaceableTank(bot, client))
TransferPass(bot, client, false);
}
public void L4D_OnReplaceTank(int tank, int newtank)
{
OnReplaceTank(tank, newtank);
}
// support nyx extension
public Action L4D2_OnReplaceTank(int tank, int newtank)
{
OnReplaceTank(tank, newtank);
return Plugin_Continue;
}
void OnReplaceTank(int tank, int newtank)
{
if (tank == newtank) return;
if (g_bIsIgnited[tank])
RequestFrame(OnFrameIgnite, UID(newtank));
TransferPass(tank, newtank);
}
public void OnFrameIgnite(int client)
{
client = CID(client);
if (IsValidTank(client))
IgniteEntity(client, IGNITE_TIME);
}
/*
|--------------------------------------------------------------------------
| FUNCTIONS
|--------------------------------------------------------------------------
*/
void TankPass(int tank, int target, int admin = 0)
{
if (admin){
PrintToTeam(3, 0, "%t", "phrase9", target);
LogAction(admin, target, "\"%L\" has passed the Tank from \"%L\" to \"%L\"", admin, tank, target);
}
else if (g_iCvarPassedCount == 1)
PrintToTeam(3, 0, "%t", "phrase3", tank, target);
else
PrintToTeam(3, 0, "%t", "phrase14", tank, target, g_iPassedCount[tank] + 1, g_iCvarPassedCount);
bool isOnFire = IsOnFire(tank);
if (g_bIsFinale || !g_bCvarQuickPass){
if (IsMustIgnite(isOnFire))
g_bIsIgnited[tank] = true;
if (!g_bCvarReplace && IsReplaceableSI(target))
ForcePlayerSuicide(target);
for (int i = 1; i <= MaxClients; i++)
if (i != target && IsInfected(i) && !IsFakeClient(i))
L4D2Direct_SetTankTickets(i, 0);
public void OnCvarChange_Notify(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (!StrEqual(oldValue, newValue))
g_bCvarNotify = convar.BoolValue;
}
public void OnCvarChange_QuickPass(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (!StrEqual(oldValue, newValue))
g_bCvarQuickPass = convar.BoolValue;
}
public void OnCvarChange_Menu(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (!StrEqual(oldValue, newValue))
g_bCvarMenu = convar.BoolValue;
}
public void OnCvarChange_PassCount(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (!StrEqual(oldValue, newValue))
g_iCvarPassedCount = convar.IntValue;
}
public void OnCvarChange_Confirm(ConVar convar, const char[] oldValue, const char[] newValue)
{
if (!StrEqual(oldValue, newValue))
g_bCvarConfirm = convar.BoolValue;
}
Marttt
07-19-2021 07:44
Re: [L4D2] Tankhud interferes with the Tank Pass menu
You can have only have one menu at time, that's why the menu "closes"
The TankHUD triggers every second so you aren't able to use the Menu choose interface.
some solutions:
creating a new forward that the tank hud plugin can detect that someone opened the tank pass menu (and block to trigger the tank hud panel to that specific player)
or
you can add a timer to the person that gets the tank (detect that player is tank) before displaying the HUD to them
Tank Rush
07-19-2021 21:19
Re: [L4D2] Tankhud interferes with the Tank Pass menu
Quote:
Originally Posted by Marttt
(Post 2753128)
creating a new forward that the tank hud plugin can detect that someone opened the tank pass menu (and block to trigger the tank hud panel to that specific player)
this option would not be bad at all, but this is when the tank has spawned.
In the second video that I publish, the Tank Pass menu can be opened at any time, even when the tank has not spawned.
I use l4d_tank_control_eq.sp
new Handle:h_whosHadTank;
new String:queuedTankSteamId[64];
new Handle:hTankPrint;
new Handle:hTankDebug;
public Plugin:myinfo =
{
name = "L4D2 Tank Control",
author = "arti",
description = "Distributes the role of the tank evenly throughout the team",
version = "0.0.17",
url = "https://github.com/alexberriman/l4d2-plugins/tree/master/l4d_tank_control"
}
// Initialise the tank arrays/data values
h_whosHadTank = CreateArray(64);
// Register the boss commands
RegConsoleCmd("sm_passtank", TankShuffle_Cmd, "Re-picks at random someone to become tank.");
RegConsoleCmd("sm_givetank", GiveTank_Cmd, "Gives the tank to a selected player");
RegConsoleCmd("sm_boss", Tank_Cmd, "Shows who is becoming the tank.");
// Cvars
hTankPrint = CreateConVar("tankcontrol_print_all", "0", "Who gets to see who will become the tank? (0 = Infected, 1 = Everyone)");
hTankDebug = CreateConVar("tankcontrol_debug", "0", "Whether or not to debug to console");
// Crear automáticamente el archivo de configuración en cfg/sourcemod
AutoExecConfig( true, "l4d_tank_control_eq" );
}
public OnClientDisconnect(client)
{
decl String:tmpSteamId[64];
if (client)
{
GetClientAuthId(client, AuthId_Steam2, tmpSteamId, sizeof(tmpSteamId));
if (strcmp(queuedTankSteamId, tmpSteamId) == 0)
{
chooseTank();
outputTankToAll();
}
}
}
/**
* When a new game starts, reset the tank pool.
*/
public RoundStart_Event()
{
CreateTimer(10.0, newGame);
}
public Action:newGame(Handle:timer)
{
new teamAScore = L4D2Direct_GetVSCampaignScore(0);
new teamBScore = L4D2Direct_GetVSCampaignScore(1);
// If it's a new game, reset the tank pool
if (teamAScore == 0 && teamBScore == 0)
{
h_whosHadTank = CreateArray(64);
queuedTankSteamId = "";
}
}
/**
* When the round ends, reset the active tank.
*/
public RoundEnd_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
queuedTankSteamId = "";
}
/**
* When a player leaves the start area, choose a tank and output to all.
*/
public PlayerLeftStartArea_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
chooseTank();
outputTankToAll();
}
/**
* When the queued tank switches teams, choose a new one
*/
public PlayerTeam_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
new L4D2Team:oldTeam = L4D2Team:GetEventInt(event, "oldteam");
new client = GetClientOfUserId(GetEventInt(event, "userid"));
decl String:tmpSteamId[64];
/**
* When the tank dies, requeue a player to become tank (for finales)
*/
public PlayerDeath_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
new zombieClass = 0;
new victimId = GetEventInt(event, "userid");
new victim = GetClientOfUserId(victimId);
if (victimId && IsClientInGame(victim))
{
zombieClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
if (ZClass:zombieClass == ZClass_Tank)
{
if (GetConVarBool(hTankDebug))
{
PrintToConsoleAll("[TC] Tank died(1), choosing a new tank");
}
chooseTank();
}
}
}
public TankKilled_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetConVarBool(hTankDebug))
{
PrintToConsoleAll("[TC] Tank died(2), choosing a new tank");
}
chooseTank();
}
/**
* When a player wants to find out whos becoming tank,
* output to them.
*/
public Action:Tank_Cmd(client, args)
{
if (!IsClientInGame(client))
return Plugin_Handled;
new tankClientId;
decl String:tankClientName[128];
// Only output if we have a queued tank
if (! strcmp(queuedTankSteamId, ""))
{
return Plugin_Handled;
}
// If on infected, print to entire team
if (L4D2Team:GetClientTeam(client) == L4D2Team:L4D2Team_Infected || IsClientCaster(client))
{
if (client == tankClientId) CPrintToChat(client, "{red}<{default}Tank Selection{red}> {green}Usted {default}se convertirá en el {red}Tank{default}!");
else CPrintToChat(client, "{red}<{default}Tank Selection{red}> {olive}%s {default}se convertirá en el {red}Tank!", tankClientName);
}
}
return Plugin_Handled;
}
/**
* Shuffle the tank (randomly give to another player in
* the pool.
*/
public Action:TankShuffle_Cmd(client, args)
{
chooseTank();
outputTankToAll();
return Plugin_Handled;
}
/**
* Give the tank to a specific player.
*/
public Action:GiveTank_Cmd(client, args)
{
// Who are we targetting?
new String:arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
// Try and find a matching player
new target = FindTarget(client, arg1);
if (target == -1)
{
return Plugin_Handled;
}
// Get the players name
new String:name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
// Set the tank
if (IsClientConnected(target) && IsClientInGame(target) && ! IsFakeClient(target))
{
// Checking if on our desired team
if (L4D2Team:GetClientTeam(target) != L4D2Team:L4D2Team_Infected)
{
CPrintToChatAll("{olive}[SM] {default}%s no es infectado. Incapaz de pasar el tank", name);
return Plugin_Handled;
}
/**
* Selects a player on the infected team from random who hasn't been
* tank and gives it to them.
*/
public chooseTank()
{
// Create our pool of players to choose from
new Handle:infectedPool = CreateArray(64);
addTeamSteamIdsToArray(infectedPool, L4D2Team_Infected);
// If there is nobody on the infected team, return (otherwise we'd be stuck trying to select forever)
if (GetArraySize(infectedPool) == 0)
{
CloseHandle(infectedPool);
return;
}
// Remove players who've already had tank from the pool.
infectedPool = removeTanksFromPool(infectedPool, h_whosHadTank);
// If the infected pool is empty, remove infected players from pool
if (GetArraySize(infectedPool) == 0) // (when nobody on infected ,error)
{
new Handle:infectedTeam = CreateArray(64);
addTeamSteamIdsToArray(infectedTeam, L4D2Team_Infected);
if (GetArraySize(infectedTeam) > 1)
{
h_whosHadTank = removeTanksFromPool(h_whosHadTank, infectedTeam);
chooseTank();
}
else
{
queuedTankSteamId = "";
}
// Select a random person to become tank
new rndIndex = GetRandomInt(0, GetArraySize(infectedPool) - 1);
GetArrayString(infectedPool, rndIndex, queuedTankSteamId, sizeof(queuedTankSteamId));
CloseHandle(infectedPool);
}
/**
* Make sure we give the tank to our queued player.
*/
public Action:L4D_OnTryOfferingTankBot(tank_index, &bool:enterStatis)
{
// Reset the tank's frustration if need be
if (! IsFakeClient(tank_index))
{
PrintHintText(tank_index, "Rage Meter Refilled");
for (new i = 1; i <= MaxClients; i++)
{
if (! IsClientInGame(i) || GetClientTeam(i) != 3)
continue;
if (tank_index == i) CPrintToChat(i, "{red}<{default}Tank Rage{red}> {olive}Barra de frustración {red}Recargado");
else CPrintToChat(i, "{red}<{default}Tank Rage{red}> {default}({green}%N{default}'s) {olive}Barra de frustración {red}Recargado", tank_index);
}
// If we don't have a queued tank, choose one
if (! strcmp(queuedTankSteamId, ""))
chooseTank();
// Mark the player as having had tank
if (strcmp(queuedTankSteamId, "") != 0)
{
setTankTickets(queuedTankSteamId, 20000);
PushArrayString(h_whosHadTank, queuedTankSteamId);
}
return Plugin_Continue;
}
/**
* Sets the amount of tickets for a particular player, essentially giving them tank.
*/
public setTankTickets(const String:steamId[], const tickets)
{
new tankClientId = getInfectedPlayerBySteamId(steamId);
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientConnected(i) && IsClientInGame(i) && ! IsFakeClient(i) && GetClientTeam(i) == 3)
{
L4D2Direct_SetTankTickets(i, (i == tankClientId) ? tickets : 0);
}
}
}
/**
* Output who will become tank
*/
public outputTankToAll()
{
decl String:tankClientName[128];
new tankClientId = getInfectedPlayerBySteamId(queuedTankSteamId);
if (tankClientId != -1)
{
GetClientName(tankClientId, tankClientName, sizeof(tankClientName));
if (GetConVarBool(hTankPrint))
{
CPrintToChatAll("{red}<{default}Tank Selection{red}> {olive}%s {default}se convertirá en el {red}Tank!", tankClientName);
}
else
{
for (new i = 1; i <= MaxClients; i++)
{
if (!IS_VALID_INFECTED(i) && !IS_VALID_CASTER(i))
continue;
if (tankClientId == i) CPrintToChat(i, "{red}<{default}Tank Selection{red}> {green}Usted {default}se convertirá en el {red}Tank{default}!");
else CPrintToChat(i, "{red}<{default}Tank Selection{red}> {olive}%s {default}se convertirá en el {red}Tank!", tankClientName);
}
}
}
}
for (new i = 1; i <= MaxClients; i++)
{
if (!IS_VALID_INFECTED(i) && !IS_VALID_CASTER(i))
{
continue;
}
CPrintToChat(i, "{default}%s", sPrint);
}
}
/**
* Adds steam ids for a particular team to an array.
*
* @ param Handle:steamIds
* The array steam ids will be added to.
* @param L4D2Team:team
* The team to get steam ids for.
*/
public Handle:addTeamSteamIdsToArray(Handle:steamIds, L4D2Team:team)
{
decl String:steamId[64];
for (new i = 1; i <= MaxClients; i++)
{
// Basic check
if (IsClientConnected(i) && IsClientInGame(i) && ! IsFakeClient(i))
{
// Checking if on our desired team
if (L4D2Team:GetClientTeam(i) != team)
continue;
/**
* Removes steam ids from the tank pool if they've already had tank.
*
* @param Handle:steamIdTankPool
* The pool of potential steam ids to become tank.
* @ param Handle:tanks
* The steam ids of players who've already had tank.
*
* @return
* The pool of steam ids who haven't had tank.
*/
public Handle:removeTanksFromPool(Handle:steamIdTankPool, Handle:tanks)
{
decl index;
decl String:steamId[64];
for (new i = 0; i < GetArraySize(tanks); i++)
{
GetArrayString(tanks, i, steamId, sizeof(steamId));
index = FindStringInArray(steamIdTankPool, steamId);
if (index != -1)
{
RemoveFromArray(steamIdTankPool, index);
}
}
return steamIdTankPool;
}
/**
* Retrieves a player's client index by their steam id.
*
* @param const String:steamId[]
* The steam id to look for.
*
* @return
* The player's client index.
*/
public getInfectedPlayerBySteamId(const String:steamId[])
{
decl String:tmpSteamId[64];
for (new i = 1; i <= MaxClients; i++)
{
if (!IsClientConnected(i) || !IsClientInGame(i) || GetClientTeam(i) != 3)
continue;
With this I can pass the tank at any time, only it has no menu and the command !passtank only selects a random player to become the tank.
So why not add a menu to l4d_tank_control_eq.sp similar to the Tank Pass by disawar1 instead of randomly passing the tank to a player?
Marttt
07-20-2021 08:21
Re: [L4D2] Tankhud interferes with the Tank Pass menu