From 0efabe11469847abae6459598fa59bc21de46d2c Mon Sep 17 00:00:00 2001 From: richard Date: Sun, 28 Dec 2008 00:50:39 +0100 Subject: [PATCH] Made zr_suicide_world_damage CVAR for respawning as zombie if a zombie was killed by the world. --- changelog.txt | 3 +++ src/zombiereloaded.sp | 2 +- src/zr/cvars.inc | 2 ++ src/zr/event.inc | 19 ++++++++++--------- src/zr/zombie.inc | 10 +++++++++- src/zr/zombiereloaded.inc | 1 + todo.txt | 4 ---- 7 files changed, 26 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index afef99c..216830c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +2008.12.27 - 2.5.1.18 + * Made zr_suicide_world_damage CVAR for respawning as zombie if a zombie was killed by the world. + 2008.12.26 - 2.5.1.17 * Finished teleporter admin commands; zr_teleport, zr_tele_saveloc, zr_tele_loc, zr_tele_abort. * Teleport admin menu made, but not coded. diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index c933e82..551e4f3 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -15,7 +15,7 @@ #undef REQUIRE_PLUGIN #include -#define VERSION "2.5.1.17" +#define VERSION "2.5.1.18" #include "zr/zombiereloaded" #include "zr/global" diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index e4af07c..7a70373 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -49,6 +49,7 @@ enum ZRSettings Handle:CVAR_RESPAWN_DELAY, Handle:CVAR_SUICIDE, Handle:CVAR_SUICIDE_ECHO, + Handle:CVAR_SUICIDE_WORLD_DAMAGE, Handle:CVAR_SPAWN_MIN, Handle:CVAR_SPAWN_MAX, Handle:CVAR_PROTECT, @@ -126,6 +127,7 @@ CreateCvars() gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds"); gCvars[CVAR_SUICIDE] = CreateConVar("zr_suicide", "1", "Stops players from suiciding"); gCvars[CVAR_SUICIDE_ECHO] = CreateConVar("zr_suicide_echo", "0", "Log suicide attempts to admin chat."); + gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they was killed by the world, like elevators, doors and lasers."); gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds"); gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)"); diff --git a/src/zr/event.inc b/src/zr/event.inc index cf2f2c5..c24af61 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -392,7 +392,7 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); - + SetPlayerFOV(index, DEFAULT_FOV); ExtinguishEntity(index); @@ -436,20 +436,21 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) new bonus = GetClassKillBonus(pClass[index]); AddPlayerScore(attacker, bonus); } + + if (!IsClientPlayer(attacker)) + { + gKilledByWorld[index] = true; + } + else + { + gKilledByWorld[index] = false; + } } - new debug_val = GetConVarInt(gCvars[CVAR_DEBUG]); - new String:debug_msg[64]; - for (new x = 0; x < MAXTIMERS; x++) { if (tHandles[index][x] != INVALID_HANDLE) { - if (debug_val > 1) - { - Format(debug_msg, sizeof(debug_msg), "PlayerDeath - Killing timer %i with handle %x.", x, tHandles[index][x]); - ZR_DebugPrintToConsole(0, debug_msg); - } KillTimer(tHandles[index][x]); tHandles[index][x] = INVALID_HANDLE; } diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index cbb87b4..b31fca9 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -872,6 +872,7 @@ public Action:EndProtect(Handle:timer, any:index) RespawnPlayer(client) { + if (!IsClientInGame(client)) { return; @@ -886,10 +887,17 @@ RespawnPlayer(client) decl String:team[32]; GetConVarString(gCvars[CVAR_RESPAWN_TEAM], team, sizeof(team)); - + if (StrEqual(team, "zombie", false)) { Zombify(client, 0); + return; + } + + if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && gKilledByWorld[client]) + { + Zombify(client, 0); + gKilledByWorld[client] = false; } } diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index 461d041..4078706 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -45,6 +45,7 @@ new bool:gBlockMotherInfect[MAXPLAYERS+1]; new bool:bZVision[MAXPLAYERS+1]; new bool:dispHP[MAXPLAYERS+1]; new bool:pProtect[MAXPLAYERS+1]; +new bool:gKilledByWorld[MAXPLAYERS+1] = {false, ...}; new pClass[MAXPLAYERS+1]; new pNextClass[MAXPLAYERS+1]; diff --git a/todo.txt b/todo.txt index 146fdd4..e453c6d 100644 --- a/todo.txt +++ b/todo.txt @@ -15,10 +15,6 @@ Section content is listed in order of importance. Some of these can be ideas too * Make a admin command to read and write settings to a spesific class, using key/value. Integrate it with the zr_admin menu. -* Zombie dont have fall damage (damage by player 0 = server should always work) - Make it a CVAR, so for example zombies can't kill themselfs on some maps by - going through lasers. - * Knockback presets (integrated into zombie admin menu). Temporary do many changes on the zombies (by executing configs). Useful settings or fun settings. SourceMod already has a execute config menu, but it