diff --git a/changelog.txt b/changelog.txt index 0ad5135..432ebe3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ -2009.02.15 - 2.5.1.x +2009.02.16 - 2.5.1.x * Fixed ambience sound not always playing. Changed ambience module to play a ambience sound per client, when they connect. * Improved logging function. + * Fixed zvision not disabled if the setting is empty in classes.txt. Disabled zvision timer (not really needed?). 2009.02.13 - 2.5.1.27 * Fixed bug in formatted log messages when client is negative or 0 (console). diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 47a154a..d6bc056 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -46,15 +46,15 @@ public Action:Command_NightVision(client, argc) return; } - bZVision[client] = !bZVision[client]; + bZVisionOn[client] = !bZVisionOn[client]; - if (bZVision[client]) + if (bZVisionOn[client]) { - StartZVision(client); + ZVisionPreCheck(client); } else { - StopZVision(client); + ZVisionStop(client); } } @@ -173,6 +173,8 @@ Zombify_Mother(client) GivePlayerItem(client, "weapon_knife"); ApplyZombieNightVision(client); + + ZVisionPreCheck(client); ApplyZombieFOV(client); @@ -187,11 +189,6 @@ Zombify_Mother(client) ZR_PrintToChat(client, "You are a zombie"); - if (bZVision[client]) - { - StartZVision(client); - } - new bool:mother_zombie_respawn = GetConVarBool(gCvars[CVAR_MOTHER_ZOMBIE_RESPAWN]); if (mother_zombie_respawn) { @@ -259,16 +256,13 @@ Zombify(client, attacker) ApplyZombieNightVision(client); + ZVisionPreCheck(client); + ApplyZombieFOV(client); ApplyZombieModel(client); ApplyZombieAlpha(client); - - if (bZVision[client]) - { - StartZVision(client); - } InfectionEffects(client); @@ -412,7 +406,7 @@ ApplyZombieNightVision(client) new bool:nvgs = GetClassNVGs(pClass[client]); NightVision(client, nvgs); - if (bZVision[client]) + if (nvgs) { NightVisionOn(client, nvgs); } @@ -679,65 +673,67 @@ AntiStick(attacker, client) TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, vector); } -StartZVision(client) +ZVisionPreCheck(client) { - if (tHandles[client][TZVISION] != INVALID_HANDLE) + if (IsFakeClient(client)) { - CloseHandle(tHandles[client][TZVISION]); + return; } - new bool:zvision = ZVision(client); - if (zvision) + decl String:zvision[128]; + GetClassZVision(pClass[client], zvision, sizeof(zvision)); + + if (strlen(zvision) == 0) { - new Float:redisplay = GetConVarFloat(gCvars[CVAR_ZVISION_REDISPLAY]); - tHandles[client][TZVISION] = CreateTimer(redisplay, ZVisionTimer, client, TIMER_REPEAT); + bZVision[client] = false; + } + else + { + bZVision[client] = true; + strcopy(ZVisionOverlay[client], PLATFORM_MAX_PATH, zvision); + + ZVisionStart(client); } } -StopZVision(client) +ZVisionStart(client) +{ + /*if (tHandles[client][TZVISION] != INVALID_HANDLE) + { + KillTimer(tHandles[client][TZVISION]); + tHandles[client][TZVISION] = INVALID_HANDLE; + }*/ + + DisplayClientOverlay(client, ZVisionOverlay[client]); + bZVisionOn[client] = true; + + //new Float:redisplay = GetConVarFloat(gCvars[CVAR_ZVISION_REDISPLAY]); + //tHandles[client][TZVISION] = CreateTimer(redisplay, ZVisionTimer, client, TIMER_REPEAT); +} + +ZVisionStop(client) { if (tHandles[client][TZVISION] != INVALID_HANDLE) { - CloseHandle(tHandles[client][TZVISION]); + KillTimer(tHandles[client][TZVISION]); tHandles[client][TZVISION] = INVALID_HANDLE; } ClientCommand(client, "r_screenoverlay \"\""); + bZVisionOn[client] = false; } -bool:ZVision(client) +/*public Action:ZVisionTimer(Handle:timer, any:client) { - if (IsFakeClient(client)) + if (!IsClientInGame(client) || !IsPlayerZombie(client)) { - return false; - } - - decl String:zvision[64]; - GetClassZVision(pClass[client], zvision, sizeof(zvision)); - - if (zvision[0]) - { - DisplayClientOverlay(client, zvision); - - return true; - } - - return false; -} - -public Action:ZVisionTimer(Handle:timer, any:index) -{ - if (!IsClientInGame(index) || !IsPlayerZombie(index)) - { - tHandles[index][TZVISION] = INVALID_HANDLE; - + tHandles[client][TZVISION] = INVALID_HANDLE; return Plugin_Stop; } - ZVision(index); - + DisplayClientOverlay(client, ZVisionOverlay[client]); return Plugin_Continue; -} +}*/ ZombieMoan(client) { diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 98dbb02..289bd37 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -63,6 +63,8 @@ new bool:motherZombie[MAXPLAYERS+1]; new bool:gZombie[MAXPLAYERS+1]; new bool:gBlockMotherInfect[MAXPLAYERS+1]; new bool:bZVision[MAXPLAYERS+1]; +new bool:bZVisionOn[MAXPLAYERS+1]; +new String:ZVisionOverlay[MAXPLAYERS+1][PLATFORM_MAX_PATH]; new bool:dispHP[MAXPLAYERS+1]; new bool:pProtect[MAXPLAYERS+1]; new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...}; diff --git a/todo.txt b/todo.txt index 9aed87f..e733995 100644 --- a/todo.txt +++ b/todo.txt @@ -7,8 +7,7 @@ Section content is listed in order of importance. Some of these can be ideas too * Fix ambience not always playing: separate timers for each player. -* Fix zvision not disabled if the class value is blank. Improve ZVision function, - use strlen instead of checking the first character. Also check the main CVAR. +* Fix zvision not displayed if classes are disabled. * Make admin commands to get or set classes: zr_classes_set