Add teleport on infect option.

This commit is contained in:
BotoX 2019-12-30 14:19:05 +01:00
parent 63adb12960
commit a5e0f31fc1
2 changed files with 12 additions and 0 deletions

View File

@ -107,6 +107,7 @@ enum CvarsList
Handle:CVAR_INFECT_WEAPONS_DROP, Handle:CVAR_INFECT_WEAPONS_DROP,
Handle:CVAR_INFECT_KNIFE_COOLDOWN, Handle:CVAR_INFECT_KNIFE_COOLDOWN,
Handle:CVAR_INFECT_MAX_DISTANCE, Handle:CVAR_INFECT_MAX_DISTANCE,
Handle:CVAR_INFECT_TELEPORT,
Handle:CVAR_INFECT_MZOMBIE_MODE, Handle:CVAR_INFECT_MZOMBIE_MODE,
Handle:CVAR_INFECT_MZOMBIE_RATIO, Handle:CVAR_INFECT_MZOMBIE_RATIO,
Handle:CVAR_INFECT_MZOMBIE_MIN, Handle:CVAR_INFECT_MZOMBIE_MIN,
@ -337,6 +338,7 @@ CvarsCreate()
g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead."); g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead.");
g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie."); g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie.");
g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]"); g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]");
g_hCvarsList[CVAR_INFECT_TELEPORT] = CreateConVar("zr_infect_teleport", "0", "Teleports on infect to zombie.");
// Effects // Effects
g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way."); g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way.");

View File

@ -819,10 +819,20 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
// Check override. // Check override.
else else
{ {
new bool:teleport = GetConVarBool(g_hCvarsList[CVAR_INFECT_TELEPORT]);
if (respawnoverride && respawn) if (respawnoverride && respawn)
{ {
ZTele_TeleportClient(client); ZTele_TeleportClient(client);
} }
// Teleport to attacker when infected
else if(teleport && ZRIsClientValid(attacker))
{
// Get client's position.
new Float:clientloc[3];
GetClientAbsOrigin(attacker, clientloc);
TeleportEntity(client, clientloc, NULL_VECTOR, NULL_VECTOR);
}
} }
// Remove kevlar and helmet // Remove kevlar and helmet