Added actual functionality for the zr_infect_mzombie_respawn cvar.

This commit is contained in:
Greyscale 2009-05-15 08:14:14 +02:00
parent 6d09157719
commit 363be11591
2 changed files with 24 additions and 3 deletions

View File

@ -565,6 +565,16 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
// TODO: A solution to stop confusing bots? Respawn and teleport? // TODO: A solution to stop confusing bots? Respawn and teleport?
CS_SwitchTeam(client, CS_TEAM_T); CS_SwitchTeam(client, CS_TEAM_T);
// If respawn is enabled, then teleport mother zombie back to spawnpoint.
if (motherinfect)
{
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
if(zombierespawn)
{
ZTeleTeleportClient(client);
}
}
// Format infection message. // Format infection message.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);

View File

@ -170,7 +170,7 @@ bool:ZTeleClient(client)
// Tell client how much time is left until teleport. // Tell client how much time is left until teleport.
TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]); TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
// Start repeating timer. // Start timer.
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
} }
else else
@ -178,8 +178,8 @@ bool:ZTeleClient(client)
// Reset timer handle. // Reset timer handle.
tZTele[client] = INVALID_HANDLE; tZTele[client] = INVALID_HANDLE;
// Teleport client. // Teleport client to spawn.
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR); ZTeleTeleportClient(client);
// Tell client they've been teleported. // Tell client they've been teleported.
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax); TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
@ -191,6 +191,17 @@ bool:ZTeleClient(client)
return true; return true;
} }
/**
* Teleport client to their spawn location.
*
* @param client The client index.
*/
ZTeleTeleportClient(client)
{
// Teleport client.
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
}
/** /**
* Timer callback, counts down teleport to the client. * Timer callback, counts down teleport to the client.
* *