Improved handling of invalid handle errors (maybe not fixed). Added a debug switch and a log function. Added debug messages on zspawn. Fixed zr_spawn not spawning spectactors (when using @all).
This commit is contained in:
parent
a56e89b907
commit
cf8bd3aead
@ -1,3 +1,10 @@
|
|||||||
|
2008.10.29 - 2.5.1.10 - Richard
|
||||||
|
* Improved handling of invalid handle errors on OnClientDisconnect and PlayerDeath.
|
||||||
|
CloseHandle sometimes cause errors when destroying timers. Solution: KillTimer.
|
||||||
|
* Added debug switch and a function for printing/logging messages to client consoles or the server.
|
||||||
|
* Added debug messages on zspawn.
|
||||||
|
* Fixed zr_spawn not spawning spectactors (if @all is used).
|
||||||
|
|
||||||
2008.10.11 - 2.5.1.9 - Richard
|
2008.10.11 - 2.5.1.9 - Richard
|
||||||
* Added CVAR for saving class selection after map changes. Default: off.
|
* Added CVAR for saving class selection after map changes. Default: off.
|
||||||
If default classes are used, this one should be off.
|
If default classes are used, this one should be off.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
#include <market>
|
#include <market>
|
||||||
|
|
||||||
#define VERSION "2.5.1.9"
|
#define VERSION "2.5.1.10"
|
||||||
|
|
||||||
#include "zr/zombiereloaded"
|
#include "zr/zombiereloaded"
|
||||||
#include "zr/global"
|
#include "zr/global"
|
||||||
@ -168,6 +168,8 @@ public OnClientPutInServer(client)
|
|||||||
{
|
{
|
||||||
tHandles[client][x] = INVALID_HANDLE;
|
tHandles[client][x] = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnClientDisconnect(client)
|
public OnClientDisconnect(client)
|
||||||
@ -181,10 +183,12 @@ public OnClientDisconnect(client)
|
|||||||
{
|
{
|
||||||
if (tHandles[client][x] != INVALID_HANDLE)
|
if (tHandles[client][x] != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
CloseHandle(tHandles[client][x]);
|
KillTimer(tHandles[client][x]);
|
||||||
tHandles[client][x] = INVALID_HANDLE;
|
tHandles[client][x] = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
MapChangeCleanup()
|
MapChangeCleanup()
|
||||||
@ -194,6 +198,17 @@ MapChangeCleanup()
|
|||||||
tRound = INVALID_HANDLE;
|
tRound = INVALID_HANDLE;
|
||||||
tInfect = INVALID_HANDLE;
|
tInfect = INVALID_HANDLE;
|
||||||
tAmbience = INVALID_HANDLE;
|
tAmbience = INVALID_HANDLE;
|
||||||
|
|
||||||
|
for (new client = 1; client <= maxclients; client++)
|
||||||
|
{
|
||||||
|
for (new x = 0; x < MAXTIMERS; x++)
|
||||||
|
{
|
||||||
|
if (tHandles[client][x] != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
tHandles[client][x] = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZREnd()
|
ZREnd()
|
||||||
@ -215,7 +230,7 @@ ZREnd()
|
|||||||
{
|
{
|
||||||
if (tHandles[x][y] != INVALID_HANDLE)
|
if (tHandles[x][y] != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
CloseHandle(tHandles[x][y]);
|
KillTimer(tHandles[x][y]);
|
||||||
tHandles[x][y] = INVALID_HANDLE;
|
tHandles[x][y] = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,10 +73,16 @@ public Action:Command_Respawn(client, argc)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new team;
|
||||||
for (new x = 0; x < tcount; x++)
|
for (new x = 0; x < tcount; x++)
|
||||||
{
|
{
|
||||||
|
team = GetClientTeam(client);
|
||||||
|
if (team == CS_TEAM_T || team == CS_TEAM_CT)
|
||||||
|
{
|
||||||
|
ZR_DebugPrintToConsole(x, "ZSpawn: Spawned player");
|
||||||
RespawnPlayer(targets[x]);
|
RespawnPlayer(targets[x]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
enum ZRSettings
|
enum ZRSettings
|
||||||
{
|
{
|
||||||
Handle:CVAR_ENABLE,
|
Handle:CVAR_ENABLE,
|
||||||
|
Handle:CVAR_DEBUG,
|
||||||
Handle:CVAR_ALLOW_PLAYER_TEAM,
|
Handle:CVAR_ALLOW_PLAYER_TEAM,
|
||||||
Handle:CVAR_AMBIENCE,
|
Handle:CVAR_AMBIENCE,
|
||||||
Handle:CVAR_AMBIENCE_FILE,
|
Handle:CVAR_AMBIENCE_FILE,
|
||||||
@ -79,6 +80,7 @@ new gCvars[ZRSettings];
|
|||||||
CreateCvars()
|
CreateCvars()
|
||||||
{
|
{
|
||||||
gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)");
|
gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)");
|
||||||
|
gCvars[CVAR_DEBUG] = CreateConVar("zr_debug", "0", "Debug switch, for developers. Usually enables logging of messages and events to a console. (0: Disable)");
|
||||||
gCvars[CVAR_ALLOW_PLAYER_TEAM] = CreateConVar("zr_allow_player_team", "0", "This will allow the player_team event to be fired on first team join, enable when using mani model menu (0: Disable)");
|
gCvars[CVAR_ALLOW_PLAYER_TEAM] = CreateConVar("zr_allow_player_team", "0", "This will allow the player_team event to be fired on first team join, enable when using mani model menu (0: Disable)");
|
||||||
gCvars[CVAR_AMBIENCE] = CreateConVar("zr_ambience", "1", "Enable creepy ambience to be played throughout the game (0: Disable)");
|
gCvars[CVAR_AMBIENCE] = CreateConVar("zr_ambience", "1", "Enable creepy ambience to be played throughout the game (0: Disable)");
|
||||||
gCvars[CVAR_AMBIENCE_FILE] = CreateConVar("zr_ambience_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1");
|
gCvars[CVAR_AMBIENCE_FILE] = CreateConVar("zr_ambience_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1");
|
||||||
|
@ -439,7 +439,7 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
|||||||
{
|
{
|
||||||
if (tHandles[index][x] != INVALID_HANDLE)
|
if (tHandles[index][x] != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
CloseHandle(tHandles[index][x]);
|
KillTimer(tHandles[index][x]);
|
||||||
tHandles[index][x] = INVALID_HANDLE;
|
tHandles[index][x] = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,25 +183,35 @@ public Market_PostOnWeaponSelected(client, &bool:allowed)
|
|||||||
|
|
||||||
ZSpawn(client)
|
ZSpawn(client)
|
||||||
{
|
{
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Spawn request:");
|
||||||
new bool:spawn = GetConVarBool(gCvars[CVAR_ZSPAWN]);
|
new bool:spawn = GetConVarBool(gCvars[CVAR_ZSPAWN]);
|
||||||
if (!spawn)
|
if (!spawn)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
ZR_PrintToChat(client, "Feature is disabled");
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Not enabled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new team = GetClientTeam(client);
|
new team = GetClientTeam(client);
|
||||||
if (team != CS_TEAM_T && team != CS_TEAM_CT)
|
if (team != CS_TEAM_T && team != CS_TEAM_CT)
|
||||||
{
|
{
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Player is not a T or CT.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlayerAlive(client) || IsPlayerInList(client))
|
if (IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Player appears to be alive.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsPlayerInList(client))
|
||||||
|
{
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Player is already in the list (= maybe spawned, or bug).");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(client, "ZSpawn: Spawned player");
|
||||||
RespawnPlayer(client);
|
RespawnPlayer(client);
|
||||||
|
|
||||||
AddPlayerToList(client);
|
AddPlayerToList(client);
|
||||||
|
@ -202,3 +202,17 @@ bool:IsClientPlayer(client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZR_DebugPrintToConsole(client, String:message[])
|
||||||
|
{
|
||||||
|
if (client)
|
||||||
|
{ /* Client console */
|
||||||
|
PrintToConsole(client, message);
|
||||||
|
LogMessage("Debug log (client %i) -- %s", client, message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ /* Server console */
|
||||||
|
PrintToServer(message);
|
||||||
|
LogMessage("Debug log (client %i) -- %s", client, message);
|
||||||
|
}
|
||||||
|
}
|
2
todo.txt
2
todo.txt
@ -14,8 +14,6 @@ Section content is listed in order of importance. Some of these can be ideas too
|
|||||||
|
|
||||||
---- NORMAL/GAMEPLAY ----
|
---- NORMAL/GAMEPLAY ----
|
||||||
|
|
||||||
* Fix class data not reloaded on map change. Custom class data from previous map is not reset.
|
|
||||||
|
|
||||||
* Make it possible to disable certain classes on certain maps.
|
* Make it possible to disable certain classes on certain maps.
|
||||||
Admin command: zr_class_enabled <class name> <0/1>
|
Admin command: zr_class_enabled <class name> <0/1>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user