diff --git a/changelog.txt b/changelog.txt index 52c5e13..3492753 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ -2008.10.11 - 2.5.1.6 - Richard +2008.10.11 - 2.5.1.8 - Richard + * Added CVAR for setting default class. + +2008.10.11 - 2.5.1.7 - Richard * Fixed bugs in IsClientPlayer * Made a zombie admin menu (zr_admin). diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 4a4b343..7fee863 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -15,7 +15,7 @@ #undef REQUIRE_PLUGIN #include -#define VERSION "2.5.1.7" +#define VERSION "2.5.1.8" #include "zr/zombiereloaded" #include "zr/global" @@ -141,7 +141,7 @@ public OnConfigsExecuted() public OnClientPutInServer(client) { - pClass[client] = 0; + pClass[client] = GetDefaultClassIndex(); gBlockMotherInfect[client] = false; bZVision[client] = !IsFakeClient(client); diff --git a/src/zr/classes.inc b/src/zr/classes.inc index 5be85dd..0a306fa 100644 --- a/src/zr/classes.inc +++ b/src/zr/classes.inc @@ -137,6 +137,30 @@ GetClassIndex(String:name[]) return -1; } +GetDefaultClassIndex() +{ + new String:classname[64]; + new classindex; + GetConVarString(gCvars[CVAR_CLASSES_DEFAULT], classname, sizeof(classname)); + + if (strlen(classname) > 0) + { + classindex = GetClassIndex(classname); + if (classindex == -1) + { + return 0; + } + else + { + return classindex; + } + } + else + { + return 0; + } +} + GetClassModel(classindex, String:model[], maxlen) { strcopy(model, maxlen, arrayClasses[classindex][data_model]); diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 6aafdfa..06cee51 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -18,6 +18,7 @@ enum ZRSettings Handle:CVAR_CLASSES, Handle:CVAR_CLASSES_SPAWN, Handle:CVAR_CLASSES_RANDOM, + Handle:CVAR_CLASSES_DEFAULT, Handle:CVAR_ZOMBIE_HEALTH, Handle:CVAR_ZOMBIE_SPEED, Handle:CVAR_ZOMBIE_JUMP_DISTANCE, @@ -86,6 +87,7 @@ CreateCvars() gCvars[CVAR_CLASSES] = CreateConVar("zr_classes", "1", "Enable zombie classes"); 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_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 3e93927..7954389 100644 --- a/todo.txt +++ b/todo.txt @@ -14,8 +14,6 @@ Section content is listed in order of importance. Some of these can be ideas too ---- NORMAL/GAMEPLAY ---- -* Make a gloval CVAR for setting default zombie. Must work with per-map configs. - * Make it possible to disable certain classes on certain maps. * Make a more advanced teleporter: