Added a CVAR for setting default class.

This commit is contained in:
richard 2008-10-11 23:48:15 +02:00
parent 5af48ead51
commit 243ddea848
5 changed files with 32 additions and 5 deletions

View File

@ -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 * Fixed bugs in IsClientPlayer
* Made a zombie admin menu (zr_admin). * Made a zombie admin menu (zr_admin).

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <market> #include <market>
#define VERSION "2.5.1.7" #define VERSION "2.5.1.8"
#include "zr/zombiereloaded" #include "zr/zombiereloaded"
#include "zr/global" #include "zr/global"
@ -141,7 +141,7 @@ public OnConfigsExecuted()
public OnClientPutInServer(client) public OnClientPutInServer(client)
{ {
pClass[client] = 0; pClass[client] = GetDefaultClassIndex();
gBlockMotherInfect[client] = false; gBlockMotherInfect[client] = false;
bZVision[client] = !IsFakeClient(client); bZVision[client] = !IsFakeClient(client);

View File

@ -137,6 +137,30 @@ GetClassIndex(String:name[])
return -1; 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) GetClassModel(classindex, String:model[], maxlen)
{ {
strcopy(model, maxlen, arrayClasses[classindex][data_model]); strcopy(model, maxlen, arrayClasses[classindex][data_model]);

View File

@ -18,6 +18,7 @@ enum ZRSettings
Handle:CVAR_CLASSES, Handle:CVAR_CLASSES,
Handle:CVAR_CLASSES_SPAWN, Handle:CVAR_CLASSES_SPAWN,
Handle:CVAR_CLASSES_RANDOM, Handle:CVAR_CLASSES_RANDOM,
Handle:CVAR_CLASSES_DEFAULT,
Handle:CVAR_ZOMBIE_HEALTH, Handle:CVAR_ZOMBIE_HEALTH,
Handle:CVAR_ZOMBIE_SPEED, Handle:CVAR_ZOMBIE_SPEED,
Handle:CVAR_ZOMBIE_JUMP_DISTANCE, Handle:CVAR_ZOMBIE_JUMP_DISTANCE,
@ -86,6 +87,7 @@ CreateCvars()
gCvars[CVAR_CLASSES] = CreateConVar("zr_classes", "1", "Enable zombie classes"); 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_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_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 <class name>");
gCvars[CVAR_ZOMBIE_HEALTH] = CreateConVar("zr_zombie_health", "5000", "The default health of a zombie"); 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_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)"); gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)");

View File

@ -14,8 +14,6 @@ Section content is listed in order of importance. Some of these can be ideas too
---- NORMAL/GAMEPLAY ---- ---- 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 it possible to disable certain classes on certain maps.
* Make a more advanced teleporter: * Make a more advanced teleporter: