2009-04-11 01:56:22 +02:00
|
|
|
/*
|
|
|
|
* ============================================================================
|
|
|
|
*
|
|
|
|
* Zombie:Reloaded
|
|
|
|
*
|
|
|
|
* File: classevents.inc
|
|
|
|
* Description: Functions for handling class related events.
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ------------------------------------
|
|
|
|
*
|
|
|
|
* GAME EVENTS
|
|
|
|
*
|
|
|
|
* ------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be called when a client connect to the server.
|
|
|
|
* (OnClientPutInServer)
|
|
|
|
*/
|
|
|
|
ClassClientInit(client)
|
|
|
|
{
|
2009-04-18 02:22:13 +02:00
|
|
|
if (ZRIsValidClient(client))
|
2009-04-11 01:56:22 +02:00
|
|
|
{
|
|
|
|
// Set default class indexes on the player.
|
|
|
|
ClassClientSetDefaultIndexes(client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOnClientDisconnect(client)
|
|
|
|
{
|
|
|
|
// Stop timers related to class attributes.
|
|
|
|
ClassOverlayStop(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOnClientSpawn(client)
|
|
|
|
{
|
2009-04-20 02:56:26 +02:00
|
|
|
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
|
|
|
|
new bool:showmenu = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SPAWN]);
|
2009-04-11 01:56:22 +02:00
|
|
|
decl String:steamid[16];
|
|
|
|
decl String:classname[64];
|
|
|
|
|
|
|
|
if (showmenu && !randomclass)
|
|
|
|
{
|
2009-04-15 23:40:45 +02:00
|
|
|
ClassMenuMain(client);
|
2009-04-11 01:56:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Assign random classes if enabled.
|
|
|
|
GetClientAuthString(client, steamid, sizeof(steamid));
|
|
|
|
if (StrEqual(steamid, "BOT") || randomclass)
|
|
|
|
{
|
2009-04-14 23:16:31 +02:00
|
|
|
// Get player's team
|
2009-04-11 01:56:22 +02:00
|
|
|
new teamid = GetClientTeam(client);
|
2009-04-14 23:16:31 +02:00
|
|
|
|
|
|
|
// If the first zombie spawned, and the player is on the terrorist team, then
|
|
|
|
// find a random zombie class, otherwise find a human class.
|
2009-04-17 12:16:44 +02:00
|
|
|
if (g_bZombieSpawned && teamid == CS_TEAM_T)
|
2009-04-11 01:56:22 +02:00
|
|
|
{
|
2009-04-14 23:16:31 +02:00
|
|
|
new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES);
|
2009-04-11 01:56:22 +02:00
|
|
|
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
|
|
|
|
ClassGetName(client, classname, sizeof(classname));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-14 23:16:31 +02:00
|
|
|
new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS);
|
2009-04-11 01:56:22 +02:00
|
|
|
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex;
|
|
|
|
ClassGetName(client, classname, sizeof(classname));
|
|
|
|
}
|
|
|
|
|
|
|
|
ZR_PrintToChat(client, "Auto-assign", classname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOnClientDeath(client)
|
|
|
|
{
|
|
|
|
ClassHealthRegenStop(client);
|
|
|
|
ClassOverlayStop(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOnClientInfected(client, bool:motherzombie = false)
|
|
|
|
{
|
|
|
|
new classindex = ClassGetActiveIndex(client);
|
|
|
|
|
|
|
|
// Update the players cache with zombie attributes.
|
|
|
|
ClassReloadPlayerCache(client, classindex);
|
|
|
|
|
|
|
|
// Apply the new attributes.
|
|
|
|
ClassApplyAttributes(client, motherzombie);
|
|
|
|
}
|
|
|
|
|
|
|
|
ClassOnRoundStart()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------
|
|
|
|
*
|
|
|
|
* PLAYER COMMANDS
|
|
|
|
*
|
|
|
|
* ------------------------------------
|
|
|
|
*/
|
|
|
|
|