Uploaded manually merged code.

This commit is contained in:
Greyscale
2009-04-29 02:50:25 +02:00
parent 1b8bcc9141
commit f5f9158941
5 changed files with 64 additions and 50 deletions

View File

@ -37,49 +37,71 @@ ClassOnClientDisconnect(client)
ClassOnClientSpawn(client)
{
// Reset client's FOV.
ToolsSetClientDefaultFOV(client, ATTRIBUTES_FOV_DEFAULT);
if (!IsPlayerAlive(client))
{
// The client isn't alive.
return;
}
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
new bool:showmenu = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SPAWN]);
decl String:steamid[16];
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.
GetClientAuthString(client, steamid, sizeof(steamid));
if (StrEqual(steamid, "BOT") || randomclass)
// Check if the player should spawn in admin mode.
if (ClassPlayerAdminMode[client])
{
// Get player's team
new teamid = GetClientTeam(client);
// Mark player as in admin mode.
ClassPlayerInAdminMode[client] = true;
// 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);
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
ClassGetName(client, classname, sizeof(classname));
}
else
{
new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS);
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex;
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
{
// Mark player as not in admin mode.
ClassPlayerInAdminMode[client] = false;
ZR_PrintToChat(client, "Auto-assign", classname);
// Apply class attributes for the currently active class.
ClassReloadPlayerCache(client, ClassGetActiveIndex(client));
ClassApplyAttributes(client);
}
}
ClassOnClientDeath(client)
{
// Reset certain attributes to not make spectating disorted.
ClassHealthRegenStop(client);
ClassOverlayStop(client);
// Set client's FOV back to normal.
ToolsSetClientDefaultFOV(client, 90);
}
ClassOnClientInfected(client, bool:motherzombie = false)
@ -93,11 +115,6 @@ ClassOnClientInfected(client, bool:motherzombie = false)
ClassApplyAttributes(client, motherzombie);
}
ClassOnRoundStart()
{
}
/* ------------------------------------
*
* PLAYER COMMANDS