Re: [L4D2] Tank Spawn Announcement with sound (versus)
Yeah what I mean is that if no proper checks are made, is possible to crash the server. (like deleting the entity after X seconds to prevent No Free Edicts)
King_OXO
01-29-2021 15:38
Re: [L4D2] Tank Spawn Announcement with sound (versus)
Quote:
Originally Posted by Marttt
(Post 2734815)
Yeah what I mean is that if no proper checks are made, is possible to crash the server. (like deleting the entity after X seconds to prevent No Free Edicts)
OK, got it
sorry for making you waste your time
Tank Rush
01-29-2021 18:17
Re: [L4D2] Tank Spawn Announcement with sound (versus)
Hi Marttt, I have noticed that when the Tank bot spawns the tank ad appears in the chat, a few seconds pass, the player takes control of the tank and the chat ad appears again, it should appear once.
Marttt
01-29-2021 19:14
Re: [L4D2] Tank Spawn Announcement with sound (versus)
1 Attachment(s)
@TankRush, well try this one attached.
If it doesn't work you can try the one that Zonemod uses here.
Also in finales, it may work only for the first tank I think.
I didn't find a way to know when a tank passes the control from the last time I tried.
Tank Rush
01-29-2021 20:49
Re: [L4D2] Tank Spawn Announcement with sound (versus)
Quote:
Originally Posted by Marttt
(Post 2734852)
@TankRush, well try this one attached.
If it doesn't work you can try the one that Zonemod uses here.
Also in finales, it may work only for the first tank I think.
I didn't find a way to know when a tank passes the control from the last time I tried.
Your plugin works, the problem is in the final maps, it is only announced for the first tank of the first wave, but in the other waves it is no longer announced.
The Zonemod version does not emit sound, neither does the {red} color work
Tank Rush
01-30-2021 09:49
Re: [L4D2] Tank Spawn Announcement with sound (versus)
Quote:
Originally Posted by Marttt
(Post 2734868)
Try this.
Sorry to bother you Marttt, but this keeps failing. The ad appears in the first, second and third waves for survivors, I have tested it playing only with bots; but when there is a player on the infected team the ad only appears for the first tank on both teams.
HarryPotter
01-30-2021 11:39
Re: [L4D2] Tank Spawn Announcement with sound (versus)
public Action FindAnyTank(Handle timer, any client)
{
if(!IsTankInGame()){
g_bIsTankAlive = false;
}
}
void IsTankInGame(exclude = 0)
{
for (int i = 1; i <= MaxClients; i++)
if (exclude != i && IsClientInGame(i) && GetClientTeam(i) == 3 && IsPlayerTank(i) && IsPlayerAlive(i) && !IsIncapacitated(i))
return i;
return 0;
}
I'm sorry, I don't know how to do it
you can help?
Marttt
01-30-2021 18:48
Re: [L4D2] Tank Spawn Announcement with sound (versus)
1 Attachment(s)
Testing in my local server, the previous script work in coop and in versus (with 1 player). When there is more than 1 player (and in different teams) the plugin stops to work in versus after first spawn (weird).
I rewrote the plugin, try this:
Spoiler
PHP Code:
// ==================================================================================================== // Plugin Info - define // ==================================================================================================== #define PLUGIN_NAME "Tank Spawn Announcement with sound (made to Tank Rush)" #define PLUGIN_AUTHOR "Mart" #define PLUGIN_DESCRIPTION "When the tank spawns, it announces itself in chat by making a sound" #define PLUGIN_VERSION "1.0.2" #define PLUGIN_URL "https://forums.alliedmods.net/showthread.php?t=330277"
// ==================================================================================================== // Plugin Info // ==================================================================================================== public Plugin myinfo = { name = PLUGIN_NAME, author = PLUGIN_AUTHOR, description = PLUGIN_DESCRIPTION, version = PLUGIN_VERSION, url = PLUGIN_URL }
/** * Validates if is a valid client. * * @param client Client index. * @return True if client index is valid and client is in game, false otherwise. */ bool IsValidClient(int client) { return (IsValidClientIndex(client) && IsClientInGame(client)); }
/** * Returns if the client is a valid tank. * * @param client Client index. * @return True if client is a tank, false otherwise. */ bool IsPlayerTank(int client) { if (!IsValidClient(client)) return false;
if (GetClientTeam(client) != TEAM_INFECTED) return false;
if (GetZombieClass(client) != g_iTankClass) return false;
/** * Returns if any tank is alive. * * @return True if any tank is alive, false otherwise. */ bool HasAnyTankAlive() { for (int client = 1; client <= MaxClients; client++) { if (!IsPlayerTank(client)) continue;
int FindRandomPlayerByTeam(int color_team) { if (!(1 <= color_team <= 4)) return 0;
for (int client = 1; client <= MaxClients; client++) { if (!IsClientInGame(client)) continue;
if (GetClientTeam(client) == color_team) return client; }
return 0; }
Tank Rush
01-30-2021 21:05
Re: [L4D2] Tank Spawn Announcement with sound (versus)
Quote:
Originally Posted by Marttt
(Post 2735022)
Try this:
Spoiler
PHP Code:
// ====================================================================================================
// Plugin Info - define
// ====================================================================================================
#define PLUGIN_NAME "Tank Spawn Announcement with sound (made to Tank Rush)"
#define PLUGIN_AUTHOR "Mart"
#define PLUGIN_DESCRIPTION "When the tank spawns, it announces itself in chat by making a sound"
#define PLUGIN_VERSION "1.0.2"
#define PLUGIN_URL "https://forums.alliedmods.net/showthread.php?t=330277"
// ====================================================================================================
// Plugin Info
// ====================================================================================================
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = PLUGIN_URL
}
/**
* Validates if is a valid client.
*
* @param client Client index.
* @return True if client index is valid and client is in game, false otherwise.
*/
bool IsValidClient(int client)
{
return (IsValidClientIndex(client) && IsClientInGame(client));
}
/**
* Returns if the client is a valid tank.
*
* @param client Client index.
* @return True if client is a tank, false otherwise.
*/
bool IsPlayerTank(int client)
{
if (!IsValidClient(client))
return false;
if (GetClientTeam(client) != TEAM_INFECTED)
return false;
if (GetZombieClass(client) != g_iTankClass)
return false;
/**
* Returns if any tank is alive.
*
* @return True if any tank is alive, false otherwise.
*/
bool HasAnyTankAlive()
{
for (int client = 1; client <= MaxClients; client++)
{
if (!IsPlayerTank(client))
continue;