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)
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)
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.
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
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.
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;
// ====================================================================================================
// 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;