From 9d3564808952f01c43089b7052f77b9d24f0b303 Mon Sep 17 00:00:00 2001 From: richard Date: Sun, 12 Oct 2008 18:56:51 +0200 Subject: [PATCH] Added a CVAR for saving class selection after map changes. --- changelog.txt | 4 ++++ src/zombiereloaded.sp | 12 +++++++++++- src/zr/cvars.inc | 2 ++ todo.txt | 8 +++----- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3492753..852bbdb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2008.10.11 - 2.5.1.9 - Richard + * Added CVAR for saving class selection after map changes. Default: off. + If default classes are used, this one should be off. + 2008.10.11 - 2.5.1.8 - Richard * Added CVAR for setting default class. diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 7fee863..9501a93 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -15,7 +15,7 @@ #undef REQUIRE_PLUGIN #include -#define VERSION "2.5.1.8" +#define VERSION "2.5.1.9" #include "zr/zombiereloaded" #include "zr/global" @@ -116,6 +116,16 @@ public OnMapStart() LoadModelData(); LoadDownloadData(); + + /* Reset to default class if class selection saving is disabled. */ + if (!GetConVarBool(gCvars[CVAR_CLASSES_SAVE])) + { + new i; + for (i = 1; i <= MAXPLAYERS; i++) + { + pClass[i] = GetDefaultClassIndex(); + } + } } public OnConfigsExecuted() diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 06cee51..83e54cd 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -19,6 +19,7 @@ enum ZRSettings Handle:CVAR_CLASSES_SPAWN, Handle:CVAR_CLASSES_RANDOM, Handle:CVAR_CLASSES_DEFAULT, + Handle:CVAR_CLASSES_SAVE, Handle:CVAR_ZOMBIE_HEALTH, Handle:CVAR_ZOMBIE_SPEED, Handle:CVAR_ZOMBIE_JUMP_DISTANCE, @@ -88,6 +89,7 @@ CreateCvars() gCvars[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Classmenu is re-displayed every spawn (0: Disable)"); gCvars[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "A random class is assigned to each player every round (0: Disable)"); gCvars[CVAR_CLASSES_DEFAULT] = CreateConVar("zr_classes_default", "classic", "Default class selected for all players. Usage zr_classes_default "); + gCvars[CVAR_CLASSES_SAVE] = CreateConVar("zr_classes_save", "0", "Remember class selection when changing maps."); gCvars[CVAR_ZOMBIE_HEALTH] = CreateConVar("zr_zombie_health", "5000", "The default health of a zombie"); gCvars[CVAR_ZOMBIE_SPEED] = CreateConVar("zr_zombie_speed", "350", "How fast zombies travel (300: Default speed, 600: Double speed)"); gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)"); diff --git a/todo.txt b/todo.txt index 12d5491..30629b3 100644 --- a/todo.txt +++ b/todo.txt @@ -7,7 +7,7 @@ Section content is listed in order of importance. Some of these can be ideas too the array pProtect isn't used at all, just set to off and on. * DONE -- classes.inc:GetClassKnockback - change class knockback to be a miltiplier of the default knockback (like the + change class knockback to be a multiplier of the default knockback (like the old ZR), not absolute values: knockback = default * class knockback @@ -15,9 +15,7 @@ Section content is listed in order of importance. Some of these can be ideas too ---- NORMAL/GAMEPLAY ---- * Make it possible to disable certain classes on certain maps. - -* Make a CVAR for setting class selection to be remembered on map change. - Set default to off, so default class will always be selected on each map. + Admin command: zr_class_enabled <0/1> * Make a more advanced teleporter: - Admin command: zr_teleport @@ -29,7 +27,7 @@ Section content is listed in order of importance. Some of these can be ideas too (make a separate inc-file for the teleporter) * 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 same maps by + Make it a CVAR, so for example zombies can't kill themselfs on some maps by going through lasers. * zombie.inc:KnockBack / cvars.inc