Made cvar for displaying class menu on first spawn. Renamed class menu cvars.

This commit is contained in:
richard 2009-11-20 18:20:45 +01:00
parent 709b5d3bab
commit bedb4d4bda
4 changed files with 22 additions and 6 deletions

View File

@ -154,7 +154,11 @@ zr_permissions_use_groups "0"
// Re-display class selection menu every spawn. // Re-display class selection menu every spawn.
// Default: "0" // Default: "0"
zr_classes_spawn "0" zr_classes_menu_spawn "0"
// Display class selection menu when a player spawn for the first time.
// Default: "0"
zr_classes_menu_join "0"
// Player is assigned a random class every spawn. [Override: zr_classes_default_*] // Player is assigned a random class every spawn. [Override: zr_classes_default_*]
// Default: "0" // Default: "0"

View File

@ -53,7 +53,8 @@ enum CvarsList
Handle:CVAR_CONFIG_PATH_WEAPONS, Handle:CVAR_CONFIG_PATH_WEAPONS,
Handle:CVAR_CONFIG_PATH_HITGROUPS, Handle:CVAR_CONFIG_PATH_HITGROUPS,
Handle:CVAR_PERMISSIONS_USE_GROUPS, Handle:CVAR_PERMISSIONS_USE_GROUPS,
Handle:CVAR_CLASSES_SPAWN, Handle:CVAR_CLASSES_MENU_SPAWN,
Handle:CVAR_CLASSES_MENU_JOIN,
Handle:CVAR_CLASSES_RANDOM, Handle:CVAR_CLASSES_RANDOM,
Handle:CVAR_CLASSES_CHANGE_TIMELIMIT, Handle:CVAR_CLASSES_CHANGE_TIMELIMIT,
Handle:CVAR_CLASSES_SAVE, Handle:CVAR_CLASSES_SAVE,
@ -255,7 +256,8 @@ CvarsCreate()
// =========================== // ===========================
// General // General
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn."); g_hCvarsList[CVAR_CLASSES_MENU_SPAWN] = CreateConVar("zr_classes_menu_spawn", "0", "Re-display class selection menu every spawn.");
g_hCvarsList[CVAR_CLASSES_MENU_JOIN] = CreateConVar("zr_classes_menu_join", "0", "Display class selection menu when a player spawn for the first time.");
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn. [Override: zr_classes_default_*]"); g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn. [Override: zr_classes_default_*]");
g_hCvarsList[CVAR_CLASSES_CHANGE_TIMELIMIT] = CreateConVar("zr_classes_change_timelimit", "20", "Time limit to change human class with instant change after spawning. Time is in seconds. Use 0 or negative to disable."); g_hCvarsList[CVAR_CLASSES_CHANGE_TIMELIMIT] = CreateConVar("zr_classes_change_timelimit", "20", "Time limit to change human class with instant change after spawning. Time is in seconds. Use 0 or negative to disable.");
g_hCvarsList[CVAR_CLASSES_SAVE] = CreateConVar("zr_classes_save", "1", "Save players' class selections in server cookies and restore when connecting. [Override: zr_classes_default_*]"); g_hCvarsList[CVAR_CLASSES_SAVE] = CreateConVar("zr_classes_save", "1", "Save players' class selections in server cookies and restore when connecting. [Override: zr_classes_default_*]");

View File

@ -75,6 +75,9 @@ ClassClientInit(client)
// Forward event to sub-modules. // Forward event to sub-modules.
ClassOverlayClientInit(client); ClassOverlayClientInit(client);
} }
// Reset spawn flag.
ClassPlayerSpawned[client] = false;
} }
/** /**
@ -176,10 +179,12 @@ ClassOnClientSpawn(client)
TranslationPrintToChat(client, "Classes random assignment", classname); TranslationPrintToChat(client, "Classes random assignment", classname);
} }
// Display class menu if enabled. // Display class menu if either menu cvar is set.
new bool:classmenu = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SPAWN]); new bool:menuspawn = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_SPAWN]);
if (classmenu) new bool:menujoin = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_JOIN]);
if (menuspawn || (menujoin && !ClassPlayerSpawned[client]))
{ {
ClassPlayerSpawned[client] = true;
ClassMenuMain(client); ClassMenuMain(client);
} }
} }

View File

@ -458,6 +458,11 @@ new bool:ClassAllowInstantChange[MAXPLAYERS + 1];
*/ */
new String:ClassOriginalPlayerModel[MAXPLAYERS + 1][PLATFORM_MAX_PATH]; new String:ClassOriginalPlayerModel[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
/**
* Specifies whether a player has spawned.
*/
new bool:ClassPlayerSpawned[MAXPLAYERS + 1];
#include "zr/playerclasses/filtertools" #include "zr/playerclasses/filtertools"
#include "zr/playerclasses/attributes" #include "zr/playerclasses/attributes"
#include "zr/playerclasses/apply" #include "zr/playerclasses/apply"