Uploaded manually merged code.
This commit is contained in:
parent
1b8bcc9141
commit
f5f9158941
@ -172,8 +172,8 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassOnClientSpawn(index);
|
|
||||||
InfectOnClientSpawn(index);
|
InfectOnClientSpawn(index);
|
||||||
|
ClassOnClientSpawn(index); // Module event depends on infect module.
|
||||||
SEffectsOnClientSpawn(index);
|
SEffectsOnClientSpawn(index);
|
||||||
AccountOnClientSpawn(index);
|
AccountOnClientSpawn(index);
|
||||||
SpawnProtectOnClientSpawn(index);
|
SpawnProtectOnClientSpawn(index);
|
||||||
|
@ -37,49 +37,71 @@ ClassOnClientDisconnect(client)
|
|||||||
|
|
||||||
ClassOnClientSpawn(client)
|
ClassOnClientSpawn(client)
|
||||||
{
|
{
|
||||||
// Reset client's FOV.
|
if (!IsPlayerAlive(client))
|
||||||
ToolsSetClientDefaultFOV(client, ATTRIBUTES_FOV_DEFAULT);
|
{
|
||||||
|
// The client isn't alive.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
|
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
|
||||||
new bool:showmenu = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SPAWN]);
|
|
||||||
decl String:steamid[16];
|
decl String:steamid[16];
|
||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
|
|
||||||
if (showmenu && !randomclass)
|
// Assign random classes if enabled. Always do it for bots.
|
||||||
|
GetClientAuthString(client, steamid, sizeof(steamid));
|
||||||
|
if (randomclass || StrEqual(steamid, "BOT"))
|
||||||
{
|
{
|
||||||
ClassMenuMain(client);
|
// Get random classes for each type.
|
||||||
|
new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES);
|
||||||
|
new randomhuman = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS);
|
||||||
|
|
||||||
|
// Mark zombie class as selected.
|
||||||
|
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
||||||
|
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
|
||||||
|
ZR_PrintToChat(client, "Auto-assign", classname);
|
||||||
|
|
||||||
|
// Mark human class as selected.
|
||||||
|
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
||||||
|
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
|
||||||
|
ZR_PrintToChat(client, "Auto-assign", classname);
|
||||||
|
|
||||||
|
// Update player cache with the human class data, and apply it.
|
||||||
|
ClassReloadPlayerCache(client, randomhuman);
|
||||||
|
ClassApplyAttributes(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign random classes if enabled.
|
// Check if the player should spawn in admin mode.
|
||||||
GetClientAuthString(client, steamid, sizeof(steamid));
|
if (ClassPlayerAdminMode[client])
|
||||||
if (StrEqual(steamid, "BOT") || randomclass)
|
|
||||||
{
|
|
||||||
// Get player's team
|
|
||||||
new teamid = GetClientTeam(client);
|
|
||||||
|
|
||||||
// If the first zombie spawned, and the player is on the terrorist team, then
|
|
||||||
// find a random zombie class, otherwise find a human class.
|
|
||||||
if (g_bZombieSpawned && teamid == CS_TEAM_T)
|
|
||||||
{
|
{
|
||||||
new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES);
|
// Mark player as in admin mode.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
|
ClassPlayerInAdminMode[client] = true;
|
||||||
ClassGetName(client, classname, sizeof(classname));
|
|
||||||
|
// Update player cache with the admin class and apply attributes.
|
||||||
|
new adminindex = ClassPlayerNextAdminClass[client];
|
||||||
|
ClassReloadPlayerCache(client, adminindex);
|
||||||
|
ClassApplyAttributes(client);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS);
|
// Mark player as not in admin mode.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex;
|
ClassPlayerInAdminMode[client] = false;
|
||||||
ClassGetName(client, classname, sizeof(classname));
|
|
||||||
}
|
|
||||||
|
|
||||||
ZR_PrintToChat(client, "Auto-assign", classname);
|
// Apply class attributes for the currently active class.
|
||||||
|
ClassReloadPlayerCache(client, ClassGetActiveIndex(client));
|
||||||
|
ClassApplyAttributes(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOnClientDeath(client)
|
ClassOnClientDeath(client)
|
||||||
{
|
{
|
||||||
|
// Reset certain attributes to not make spectating disorted.
|
||||||
ClassHealthRegenStop(client);
|
ClassHealthRegenStop(client);
|
||||||
ClassOverlayStop(client);
|
ClassOverlayStop(client);
|
||||||
|
|
||||||
|
// Set client's FOV back to normal.
|
||||||
|
ToolsSetClientDefaultFOV(client, 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOnClientInfected(client, bool:motherzombie = false)
|
ClassOnClientInfected(client, bool:motherzombie = false)
|
||||||
@ -93,11 +115,6 @@ ClassOnClientInfected(client, bool:motherzombie = false)
|
|||||||
ClassApplyAttributes(client, motherzombie);
|
ClassApplyAttributes(client, motherzombie);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassOnRoundStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------
|
/* ------------------------------------
|
||||||
*
|
*
|
||||||
* PLAYER COMMANDS
|
* PLAYER COMMANDS
|
||||||
|
@ -68,8 +68,8 @@ ClassMenuMain(client)
|
|||||||
Format(humanselect, sizeof(humanselect), "%t\n %s", "!zclass human", humanclass);
|
Format(humanselect, sizeof(humanselect), "%t\n %s", "!zclass human", humanclass);
|
||||||
AddMenuItem(menu, "", humanselect, human_itemdraw);
|
AddMenuItem(menu, "", humanselect, human_itemdraw);
|
||||||
|
|
||||||
// Only display admin class options for admins.
|
// Only display admin class options for admins, and if admin classes exist.
|
||||||
if (ZRIsClientAdmin(client))
|
if (ZRIsClientAdmin(client) && ClassCountTeam(ZR_CLASS_TEAM_ADMINS))
|
||||||
{
|
{
|
||||||
// List admin class options.
|
// List admin class options.
|
||||||
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ADMINS], adminclass, sizeof(adminclass), ZR_CLASS_CACHE_MODIFIED);
|
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ADMINS], adminclass, sizeof(adminclass), ZR_CLASS_CACHE_MODIFIED);
|
||||||
@ -243,9 +243,18 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
|
|||||||
// Solve teamid from the class index.
|
// Solve teamid from the class index.
|
||||||
teamid = ClassGetTeamID(classindex, ZR_CLASS_CACHE_MODIFIED);
|
teamid = ClassGetTeamID(classindex, ZR_CLASS_CACHE_MODIFIED);
|
||||||
|
|
||||||
|
// Check if the class is a admin class.
|
||||||
|
if (teamid == ZR_CLASS_TEAM_ADMINS)
|
||||||
|
{
|
||||||
|
// Set the admin class to be used on next admin spawn.
|
||||||
|
ClassPlayerNextAdminClass[client] = classindex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Set the players active class to the specified class.
|
// Set the players active class to the specified class.
|
||||||
ClassSelected[client][teamid] = classindex;
|
ClassSelected[client][teamid] = classindex;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case MenuAction_Cancel:
|
case MenuAction_Cancel:
|
||||||
{
|
{
|
||||||
if (slot == MenuCancel_ExitBack)
|
if (slot == MenuCancel_ExitBack)
|
||||||
|
@ -150,9 +150,8 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
ZR_HudHint(client, "Spawn protection end");
|
ZR_HudHint(client, "Spawn protection end");
|
||||||
|
|
||||||
// Fix attributes.
|
// Fix attributes.
|
||||||
// TODO: Set class attributes.
|
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
||||||
ToolsSetClientAlpha(client, 255);
|
ToolsSetClientLMV(client, ClassGetSpeed(client));
|
||||||
ToolsSetClientLMV(client, 300.0);
|
|
||||||
|
|
||||||
// Clear timer handle.
|
// Clear timer handle.
|
||||||
tSpawnProtect[client] = INVALID_HANDLE;
|
tSpawnProtect[client] = INVALID_HANDLE;
|
||||||
|
@ -19,20 +19,9 @@ public Action:Command_NightVision(client, argc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!InfectIsClientInfected(client))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bClientOverlayOn[client] = !bClientOverlayOn[client];
|
bClientOverlayOn[client] = !bClientOverlayOn[client];
|
||||||
|
|
||||||
decl String:overlay[256];
|
decl String:overlay[PLATFORM_MAX_PATH];
|
||||||
ClassGetOverlayPath(client, overlay, sizeof(overlay));
|
ClassGetOverlayPath(client, overlay, sizeof(overlay));
|
||||||
|
|
||||||
if (strlen(overlay) > 0)
|
if (strlen(overlay) > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user