Rename ztele functions to use new module prefix naming convention.
The underscore makes it easier to see the real function name because it visualy separates the prefix.
This commit is contained in:
parent
400856e554
commit
1ef060258f
|
@ -279,7 +279,7 @@ public OnClientPutInServer(client)
|
||||||
AntiStickClientInit(client);
|
AntiStickClientInit(client);
|
||||||
SpawnProtectClientInit(client);
|
SpawnProtectClientInit(client);
|
||||||
RespawnClientInit(client);
|
RespawnClientInit(client);
|
||||||
ZTeleClientInit(client);
|
ZTele_OnClientPutInServer(client);
|
||||||
ZHPClientInit(client);
|
ZHPClientInit(client);
|
||||||
ImmunityClientInit(client);
|
ImmunityClientInit(client);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ public OnClientDisconnect(client)
|
||||||
ZSpawnOnClientDisconnect(client);
|
ZSpawnOnClientDisconnect(client);
|
||||||
VolOnPlayerDisconnect(client);
|
VolOnPlayerDisconnect(client);
|
||||||
ImmunityOnClientDisconnect(client);
|
ImmunityOnClientDisconnect(client);
|
||||||
ZTeleOnClientDisconnect(client);
|
ZTele_OnClientDisconnect(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,7 @@ CommandsInit()
|
||||||
AntiStickOnCommandsCreate();
|
AntiStickOnCommandsCreate();
|
||||||
ZCookiesOnCommandsCreate();
|
ZCookiesOnCommandsCreate();
|
||||||
ZSpawnOnCommandsCreate();
|
ZSpawnOnCommandsCreate();
|
||||||
ZTeleOnCommandsCreate();
|
ZTele_OnCommandsCreate();
|
||||||
ZHPOnCommandsCreate();
|
ZHPOnCommandsCreate();
|
||||||
VolOnCommandsCreate();
|
VolOnCommandsCreate();
|
||||||
ZombieSoundsOnCommandsCreate();
|
ZombieSoundsOnCommandsCreate();
|
||||||
|
|
|
@ -500,7 +500,7 @@ CvarsCreate()
|
||||||
g_hCvarsList[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "Allow player to toggle real HP display as a zombie.");
|
g_hCvarsList[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "Allow player to toggle real HP display as a zombie.");
|
||||||
g_hCvarsList[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "Default ZHP toggle state set on connecting player. [Dependency: zr_zhp]");
|
g_hCvarsList[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "Default ZHP toggle state set on connecting player. [Dependency: zr_zhp]");
|
||||||
|
|
||||||
ZTeleOnCvarsCreate();
|
ZTele_OnCvarsCreate();
|
||||||
|
|
||||||
// Auto-generate config file if it doesn't exist, then execute.
|
// Auto-generate config file if it doesn't exist, then execute.
|
||||||
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
|
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
|
||||||
|
|
|
@ -189,7 +189,7 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
|
||||||
RoundStartOnClientSpawn(index);
|
RoundStartOnClientSpawn(index);
|
||||||
SEffectsOnClientSpawn(index);
|
SEffectsOnClientSpawn(index);
|
||||||
RespawnOnClientSpawn(index);
|
RespawnOnClientSpawn(index);
|
||||||
ZTeleOnClientSpawn(index);
|
ZTele_OnClientSpawn(index);
|
||||||
ZHPOnClientSpawn(index);
|
ZHPOnClientSpawn(index);
|
||||||
VolOnPlayerSpawn(index);
|
VolOnPlayerSpawn(index);
|
||||||
ImmunityClientSpawn(index);
|
ImmunityClientSpawn(index);
|
||||||
|
@ -291,7 +291,7 @@ public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroad
|
||||||
RespawnOnClientDeath(index, attacker, weapon);
|
RespawnOnClientDeath(index, attacker, weapon);
|
||||||
NapalmOnClientDeath(index);
|
NapalmOnClientDeath(index);
|
||||||
ZSpawnOnClientDeath(index);
|
ZSpawnOnClientDeath(index);
|
||||||
ZTeleOnClientDeath(index);
|
ZTele_OnClientDeath(index);
|
||||||
ZHPOnClientDeath(index);
|
ZHPOnClientDeath(index);
|
||||||
VolOnPlayerDeath(index);
|
VolOnPlayerDeath(index);
|
||||||
RoundEndOnClientDeath();
|
RoundEndOnClientDeath();
|
||||||
|
|
|
@ -770,7 +770,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||||
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
|
new bool:zombierespawn = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN]);
|
||||||
if(zombierespawn)
|
if(zombierespawn)
|
||||||
{
|
{
|
||||||
ZTeleTeleportClient(client);
|
ZTele_TeleportClient(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check override.
|
// Check override.
|
||||||
|
@ -778,7 +778,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||||
{
|
{
|
||||||
if (respawnoverride && respawn)
|
if (respawnoverride && respawn)
|
||||||
{
|
{
|
||||||
ZTeleTeleportClient(client);
|
ZTele_TeleportClient(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||||
RoundEndOnClientInfected();
|
RoundEndOnClientInfected();
|
||||||
DamageOnClientInfected(client, motherinfect);
|
DamageOnClientInfected(client, motherinfect);
|
||||||
SEffectsOnClientInfected(client);
|
SEffectsOnClientInfected(client);
|
||||||
ZTeleOnClientInfected(client);
|
ZTele_OnClientInfected(client);
|
||||||
ZHPOnClientInfected(client);
|
ZHPOnClientInfected(client);
|
||||||
APIOnClientInfected(client, attacker, motherinfect, respawnoverride, respawn);
|
APIOnClientInfected(client, attacker, motherinfect, respawnoverride, respawn);
|
||||||
ImmunityOnClientInfected(client);
|
ImmunityOnClientInfected(client);
|
||||||
|
@ -830,7 +830,7 @@ InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassReloadPlayer(client);
|
ClassReloadPlayer(client);
|
||||||
RoundEndOnClientInfected();
|
RoundEndOnClientInfected();
|
||||||
ZTeleOnClientInfected(client);
|
ZTele_OnClientInfected(client);
|
||||||
|
|
||||||
// Give human a new knife. (If you leave the old one there will be glitches with the knife positioning)
|
// Give human a new knife. (If you leave the old one there will be glitches with the knife positioning)
|
||||||
new knife = GetPlayerWeaponSlot(client, _:Slot_Melee);
|
new knife = GetPlayerWeaponSlot(client, _:Slot_Melee);
|
||||||
|
@ -844,7 +844,7 @@ InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
|
||||||
// Check if we should respawn the client.
|
// Check if we should respawn the client.
|
||||||
if (respawn)
|
if (respawn)
|
||||||
{
|
{
|
||||||
ZTeleTeleportClient(client);
|
ZTele_TeleportClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we should spawn protect the client.
|
// Check if we should spawn protect the client.
|
||||||
|
|
|
@ -177,7 +177,7 @@ public ZAdminMenuHandle(Handle:menu_zadmin, MenuAction:action, client, slot)
|
||||||
resend = false;
|
resend = false;
|
||||||
|
|
||||||
// Send list of clients to infect.
|
// Send list of clients to infect.
|
||||||
MenuClientList(client, ZTeleForceHandle, true, true, false, "ZTele clients title");
|
MenuClientList(client, ZTele_ForceHandle, true, true, false, "ZTele clients title");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ Handle ZTeleCvar_MaxHuman;
|
||||||
Handle ZTeleCvar_AutoCancel;
|
Handle ZTeleCvar_AutoCancel;
|
||||||
Handle ZTeleCvar_AutoCancelDistance;
|
Handle ZTeleCvar_AutoCancelDistance;
|
||||||
|
|
||||||
void ZTeleOnCvarsCreate()
|
void ZTele_OnCvarsCreate()
|
||||||
{
|
{
|
||||||
ZTeleCvar_Zombie = CreateConVar("zr_ztele_zombie", "1", "Allow zombies to use ZTele.");
|
ZTeleCvar_Zombie = CreateConVar("zr_ztele_zombie", "1", "Allow zombies to use ZTele.");
|
||||||
ZTeleCvar_HumanBefore = CreateConVar("zr_ztele_human_before", "1", "Allow humans to use ZTele before the mother zombie has spawned.");
|
ZTeleCvar_HumanBefore = CreateConVar("zr_ztele_human_before", "1", "Allow humans to use ZTele before the mother zombie has spawned.");
|
||||||
|
@ -48,47 +48,47 @@ void ZTeleOnCvarsCreate()
|
||||||
ZTeleCvar_AutoCancelDistance = CreateConVar("zr_ztele_autocancel_distance", "20", "Maximum distance, in feet, player is allowed to travel before teleport is cancelled. [Dependency: zr_ztele_autocancel]");
|
ZTeleCvar_AutoCancelDistance = CreateConVar("zr_ztele_autocancel_distance", "20", "Maximum distance, in feet, player is allowed to travel before teleport is cancelled. [Dependency: zr_ztele_autocancel]");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleZombieCanTeleport()
|
bool ZTele_ZombieCanTeleport()
|
||||||
{
|
{
|
||||||
return GetConVarBool(ZTeleCvar_Zombie);
|
return GetConVarBool(ZTeleCvar_Zombie);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleHumanCanTeleportBeforeInfection()
|
bool ZTele_HumanCanTeleportBeforeInfection()
|
||||||
{
|
{
|
||||||
return GetConVarBool(ZTeleCvar_HumanBefore);
|
return GetConVarBool(ZTeleCvar_HumanBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleHumanCanTeleportAfterInfection()
|
bool ZTele_HumanCanTeleportAfterInfection()
|
||||||
{
|
{
|
||||||
return GetConVarBool(ZTeleCvar_HumanAfter);
|
return GetConVarBool(ZTeleCvar_HumanAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetZombieDelay()
|
int ZTele_GetZombieDelay()
|
||||||
{
|
{
|
||||||
return GetConVarInt(ZTeleCvar_DelayZombie);
|
return GetConVarInt(ZTeleCvar_DelayZombie);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetHumanDelay()
|
int ZTele_GetHumanDelay()
|
||||||
{
|
{
|
||||||
return GetConVarInt(ZTeleCvar_DelayHuman);
|
return GetConVarInt(ZTeleCvar_DelayHuman);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetZombieLimit()
|
int ZTele_GetZombieLimit()
|
||||||
{
|
{
|
||||||
return GetConVarInt(ZTeleCvar_MaxZombie);
|
return GetConVarInt(ZTeleCvar_MaxZombie);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetHumanLimit()
|
int ZTele_GetHumanLimit()
|
||||||
{
|
{
|
||||||
return GetConVarInt(ZTeleCvar_MaxHuman);
|
return GetConVarInt(ZTeleCvar_MaxHuman);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleIsAutoCancelEnabled()
|
bool ZTele_IsAutoCancelEnabled()
|
||||||
{
|
{
|
||||||
return GetConVarBool(ZTeleCvar_AutoCancel);
|
return GetConVarBool(ZTeleCvar_AutoCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ZTeleGetAutoCancelDistance()
|
float ZTele_GetAutoCancelDistance()
|
||||||
{
|
{
|
||||||
return GetConVarFloat(ZTeleCvar_AutoCancelDistance);
|
return GetConVarFloat(ZTeleCvar_AutoCancelDistance);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,13 +57,13 @@ int g_iZTeleTimeLeft[MAXPLAYERS + 1];
|
||||||
/**
|
/**
|
||||||
* Create commands specific to ZTele.
|
* Create commands specific to ZTele.
|
||||||
*/
|
*/
|
||||||
void ZTeleOnCommandsCreate()
|
void ZTele_OnCommandsCreate()
|
||||||
{
|
{
|
||||||
// Register ZTele command.
|
// Register ZTele command.
|
||||||
RegConsoleCmd(SAYHOOKS_KEYWORD_ZTELE, ZTeleCommand, "Teleport back to spawn if you are stuck.");
|
RegConsoleCmd(SAYHOOKS_KEYWORD_ZTELE, ZTele_Command, "Teleport back to spawn if you are stuck.");
|
||||||
|
|
||||||
// Register admin command to force ZTele.
|
// Register admin command to force ZTele.
|
||||||
RegConsoleCmd("zr_ztele_force", ZTeleForceCommand, "Force ZTele on a client. Usage: zr_ztele_force <client>");
|
RegConsoleCmd("zr_ztele_force", ZTele_ForceCommand, "Force ZTele on a client. Usage: zr_ztele_force <client>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,9 +71,9 @@ void ZTeleOnCommandsCreate()
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
void ZTeleClientInit(int client)
|
void ZTele_OnClientPutInServer(int client)
|
||||||
{
|
{
|
||||||
ZTeleStopTimer(client);
|
ZTele_StopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ void ZTeleClientInit(int client)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
void ZTeleOnClientSpawn(int client)
|
void ZTele_OnClientSpawn(int client)
|
||||||
{
|
{
|
||||||
// Reset tele count.
|
// Reset tele count.
|
||||||
g_iZTeleCount[client] = 0;
|
g_iZTeleCount[client] = 0;
|
||||||
|
@ -89,7 +89,7 @@ void ZTeleOnClientSpawn(int client)
|
||||||
// Get spawn location.
|
// Get spawn location.
|
||||||
GetClientAbsOrigin(client, g_vecZTeleSpawn[client]);
|
GetClientAbsOrigin(client, g_vecZTeleSpawn[client]);
|
||||||
|
|
||||||
ZTeleStopTimer(client);
|
ZTele_StopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,14 +97,14 @@ void ZTeleOnClientSpawn(int client)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
void ZTeleOnClientDeath(int client)
|
void ZTele_OnClientDeath(int client)
|
||||||
{
|
{
|
||||||
ZTeleStopTimer(client);
|
ZTele_StopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZTeleOnClientDisconnect(int client)
|
void ZTele_OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
ZTeleStopTimer(client);
|
ZTele_StopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,9 +112,9 @@ void ZTeleOnClientDisconnect(int client)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
void ZTeleOnClientInfected(int client)
|
void ZTele_OnClientInfected(int client)
|
||||||
{
|
{
|
||||||
ZTeleStopTimer(client);
|
ZTele_StopTimer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,7 +134,7 @@ bool ZTeleClient(int client, bool force = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If teleport is already in progress, then stop.
|
// If teleport is already in progress, then stop.
|
||||||
if (ZTeleClientInProgress(client))
|
if (ZTele_ClientInProgress(client))
|
||||||
{
|
{
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
|
@ -147,13 +147,13 @@ bool ZTeleClient(int client, bool force = false)
|
||||||
if (force)
|
if (force)
|
||||||
{
|
{
|
||||||
// Forcing teleport.
|
// Forcing teleport.
|
||||||
ZTeleTeleportClient(client);
|
ZTele_TeleportClient(client);
|
||||||
|
|
||||||
// Skip everything else.
|
// Skip everything else.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZTeleMustBeHuman(client))
|
if (ZTele_MustBeHuman(client))
|
||||||
{
|
{
|
||||||
// Tell client they must be human to use this feature.
|
// Tell client they must be human to use this feature.
|
||||||
TranslationPrintToChat(client, "Must be human");
|
TranslationPrintToChat(client, "Must be human");
|
||||||
|
@ -161,17 +161,17 @@ bool ZTeleClient(int client, bool force = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool infected = InfectIsClientInfected(client);
|
bool infected = InfectIsClientInfected(client);
|
||||||
if (!infected && !ZTeleCanHumanTeleport())
|
if (!infected && !ZTele_CanHumanTeleport())
|
||||||
{
|
{
|
||||||
// Tell client that feature is restricted at this time.
|
// Tell client that feature is restricted at this time.
|
||||||
TranslationPrintToChat(client, "ZTele restricted human");
|
TranslationPrintToChat(client, "ZTele restricted human");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZTeleHasReachedLimit(client))
|
if (ZTele_HasReachedLimit(client))
|
||||||
{
|
{
|
||||||
// Tell client that they have already reached their limit.
|
// Tell client that they have already reached their limit.
|
||||||
int maxTeleports = ZTeleGetClientLimit(client);
|
int maxTeleports = ZTele_GetClientLimit(client);
|
||||||
TranslationPrintToChat(client, "ZTele max", maxTeleports);
|
TranslationPrintToChat(client, "ZTele max", maxTeleports);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -180,26 +180,26 @@ bool ZTeleClient(int client, bool force = false)
|
||||||
GetClientAbsOrigin(client, g_vecZTeleOrigin[client]);
|
GetClientAbsOrigin(client, g_vecZTeleOrigin[client]);
|
||||||
|
|
||||||
// Set timeleft array to value of respective cvar.
|
// Set timeleft array to value of respective cvar.
|
||||||
g_iZTeleTimeLeft[client] = ZTeleGetClientDelay(client);
|
g_iZTeleTimeLeft[client] = ZTele_GetClientDelay(client);
|
||||||
if (g_iZTeleTimeLeft[client] > 0)
|
if (g_iZTeleTimeLeft[client] > 0)
|
||||||
{
|
{
|
||||||
// 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 timer.
|
// Start timer.
|
||||||
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
tZTele[client] = CreateTimer(1.0, ZTele_Timer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Teleport client to spawn.
|
// Teleport client to spawn.
|
||||||
ZTeleTeleportClient(client);
|
ZTele_TeleportClient(client);
|
||||||
|
|
||||||
// Increment teleport count.
|
// Increment teleport count.
|
||||||
g_iZTeleCount[client]++;
|
g_iZTeleCount[client]++;
|
||||||
|
|
||||||
// If we're forcing the ZTele, then don't increment the count or print how many teleports they have used.
|
// If we're forcing the ZTele, then don't increment the count or print how many teleports they have used.
|
||||||
// Tell client they've been teleported.
|
// Tell client they've been teleported.
|
||||||
int maxTeleports = ZTeleGetClientLimit(client);
|
int maxTeleports = ZTele_GetClientLimit(client);
|
||||||
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], maxTeleports);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], maxTeleports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,8 @@ bool ZTeleClient(int client, bool force = false)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
void ZTeleTeleportClient(int client)
|
// TODO: This function is called externally, move to interface.
|
||||||
|
void ZTele_TeleportClient(int client)
|
||||||
{
|
{
|
||||||
// Teleport client.
|
// Teleport client.
|
||||||
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
|
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
|
||||||
|
@ -226,7 +227,8 @@ void ZTeleTeleportClient(int client)
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param slot The menu slot selected. (starting from 0)
|
* @param slot The menu slot selected. (starting from 0)
|
||||||
*/
|
*/
|
||||||
public int ZTeleForceHandle(Handle menu_ztele_force, MenuAction action, int client, int slot)
|
// TODO: This function is called externally, move to interface.
|
||||||
|
public int ZTele_ForceHandle(Handle menu_ztele_force, MenuAction action, int client, int slot)
|
||||||
{
|
{
|
||||||
// Client selected an option.
|
// Client selected an option.
|
||||||
if (action == MenuAction_Select)
|
if (action == MenuAction_Select)
|
||||||
|
@ -238,7 +240,7 @@ public int ZTeleForceHandle(Handle menu_ztele_force, MenuAction action, int clie
|
||||||
if (target == 0)
|
if (target == 0)
|
||||||
{
|
{
|
||||||
// Re-send the menu.
|
// Re-send the menu.
|
||||||
MenuClientList(client, ZTeleForceHandle, true, true, false, "ZTele clients title");
|
MenuClientList(client, ZTele_ForceHandle, true, true, false, "ZTele clients title");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +263,7 @@ public int ZTeleForceHandle(Handle menu_ztele_force, MenuAction action, int clie
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-send the menu.
|
// Re-send the menu.
|
||||||
MenuClientList(client, ZTeleForceHandle, true, true, false, "ZTele clients title");
|
MenuClientList(client, ZTele_ForceHandle, true, true, false, "ZTele clients title");
|
||||||
}
|
}
|
||||||
// Client closed the menu.
|
// Client closed the menu.
|
||||||
if (action == MenuAction_Cancel)
|
if (action == MenuAction_Cancel)
|
||||||
|
@ -287,7 +289,7 @@ public int ZTeleForceHandle(Handle menu_ztele_force, MenuAction action, int clie
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param argc Argument count.
|
* @param argc Argument count.
|
||||||
*/
|
*/
|
||||||
public Action ZTeleForceCommand(int client, int argc)
|
public Action ZTele_ForceCommand(int client, int argc)
|
||||||
{
|
{
|
||||||
// Check if privileged.
|
// Check if privileged.
|
||||||
if (!ZRIsClientPrivileged(client, OperationType_Generic))
|
if (!ZRIsClientPrivileged(client, OperationType_Generic))
|
||||||
|
@ -355,7 +357,7 @@ public Action ZTeleForceCommand(int client, int argc)
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param argc Argument count.
|
* @param argc Argument count.
|
||||||
*/
|
*/
|
||||||
public Action ZTeleCommand(int client, int argc)
|
public Action ZTele_Command(int client, int argc)
|
||||||
{
|
{
|
||||||
// If client is console, then stop and tell them this feature is for players only.
|
// If client is console, then stop and tell them this feature is for players only.
|
||||||
if (ZRIsConsole(client))
|
if (ZRIsConsole(client))
|
||||||
|
@ -377,7 +379,7 @@ public Action ZTeleCommand(int client, int argc)
|
||||||
* @param timer The timer handle.
|
* @param timer The timer handle.
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
*/
|
*/
|
||||||
public Action ZTeleTimer(Handle timer, int client)
|
public Action ZTele_Timer(Handle timer, int client)
|
||||||
{
|
{
|
||||||
if (!IsClientInGame(client))
|
if (!IsClientInGame(client))
|
||||||
{
|
{
|
||||||
|
@ -386,10 +388,10 @@ public Action ZTeleTimer(Handle timer, int client)
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZTelePlayerWalkedTooFar(client))
|
if (ZTele_PlayerWalkedTooFar(client))
|
||||||
{
|
{
|
||||||
// Abort teleport.
|
// Abort teleport.
|
||||||
int maxDistanceInFeet = RoundToNearest(ZTeleGetAutoCancelDistance());
|
int maxDistanceInFeet = RoundToNearest(ZTele_GetAutoCancelDistance());
|
||||||
|
|
||||||
TranslationPrintCenterText(client, "ZTele autocancel centertext");
|
TranslationPrintCenterText(client, "ZTele autocancel centertext");
|
||||||
TranslationPrintToChat(client, "ZTele autocancel text", maxDistanceInFeet);
|
TranslationPrintToChat(client, "ZTele autocancel text", maxDistanceInFeet);
|
||||||
|
@ -414,7 +416,7 @@ public Action ZTeleTimer(Handle timer, int client)
|
||||||
g_iZTeleCount[client]++;
|
g_iZTeleCount[client]++;
|
||||||
|
|
||||||
// Get max teleports per round.
|
// Get max teleports per round.
|
||||||
int ztelemax = InfectIsClientInfected(client) ? ZTeleGetZombieLimit() : ZTeleGetHumanLimit();
|
int ztelemax = InfectIsClientInfected(client) ? ZTele_GetZombieLimit() : ZTele_GetHumanLimit();
|
||||||
|
|
||||||
// Tell client spawn protection is over.
|
// Tell client spawn protection is over.
|
||||||
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
||||||
|
@ -430,60 +432,60 @@ public Action ZTeleTimer(Handle timer, int client)
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleClientInProgress(int client)
|
bool ZTele_ClientInProgress(int client)
|
||||||
{
|
{
|
||||||
return tZTele[client] != null;
|
return tZTele[client] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZTeleStopTimer(int client)
|
void ZTele_StopTimer(int client)
|
||||||
{
|
{
|
||||||
if (ZTeleClientInProgress(client))
|
if (ZTele_ClientInProgress(client))
|
||||||
{
|
{
|
||||||
KillTimer(tZTele[client]);
|
KillTimer(tZTele[client]);
|
||||||
}
|
}
|
||||||
tZTele[client] = null;
|
tZTele[client] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleMustBeHuman(int client)
|
bool ZTele_MustBeHuman(int client)
|
||||||
{
|
{
|
||||||
bool infected = InfectIsClientInfected(client);
|
bool infected = InfectIsClientInfected(client);
|
||||||
bool ztelezombie = ZTeleZombieCanTeleport();
|
bool ztelezombie = ZTele_ZombieCanTeleport();
|
||||||
|
|
||||||
return (infected && !ztelezombie);
|
return (infected && !ztelezombie);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleCanHumanTeleport()
|
bool ZTele_CanHumanTeleport()
|
||||||
{
|
{
|
||||||
// There are individual restrictions whether a human can teleport before or
|
// There are individual restrictions whether a human can teleport before or
|
||||||
// after zombies have spawned.
|
// after zombies have spawned.
|
||||||
return InfectHasZombieSpawned() ? ZTeleHumanCanTeleportAfterInfection() : ZTeleHumanCanTeleportBeforeInfection();
|
return InfectHasZombieSpawned() ? ZTele_HumanCanTeleportAfterInfection() : ZTele_HumanCanTeleportBeforeInfection();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetTeleportCount(int client)
|
int ZTele_GetTeleportCount(int client)
|
||||||
{
|
{
|
||||||
return g_iZTeleCount[client];
|
return g_iZTeleCount[client];
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetClientLimit(int client)
|
int ZTele_GetClientLimit(int client)
|
||||||
{
|
{
|
||||||
return InfectIsClientInfected(client) ? ZTeleGetZombieLimit() : ZTeleGetHumanLimit();
|
return InfectIsClientInfected(client) ? ZTele_GetZombieLimit() : ZTele_GetHumanLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTeleHasReachedLimit(int client)
|
bool ZTele_HasReachedLimit(int client)
|
||||||
{
|
{
|
||||||
int teleportCount = ZTeleGetTeleportCount(client);
|
int teleportCount = ZTele_GetTeleportCount(client);
|
||||||
int maxTeleports = ZTeleGetClientLimit(client);
|
int maxTeleports = ZTele_GetClientLimit(client);
|
||||||
return teleportCount >= maxTeleports;
|
return teleportCount >= maxTeleports;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZTeleGetClientDelay(int client)
|
int ZTele_GetClientDelay(int client)
|
||||||
{
|
{
|
||||||
InfectIsClientInfected(client) ? ZTeleGetZombieDelay() : ZTeleGetHumanDelay();
|
InfectIsClientInfected(client) ? ZTele_GetZombieDelay() : ZTele_GetHumanDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZTelePlayerWalkedTooFar(int client)
|
bool ZTele_PlayerWalkedTooFar(int client)
|
||||||
{
|
{
|
||||||
if (!ZTeleIsAutoCancelEnabled())
|
if (!ZTele_IsAutoCancelEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +494,7 @@ bool ZTelePlayerWalkedTooFar(int client)
|
||||||
GetClientAbsOrigin(client, clientPosition);
|
GetClientAbsOrigin(client, clientPosition);
|
||||||
|
|
||||||
float clientDistance = GetVectorDistance(clientPosition, g_vecZTeleOrigin[client]);
|
float clientDistance = GetVectorDistance(clientPosition, g_vecZTeleOrigin[client]);
|
||||||
float maxDistanceInFeet = ZTeleGetAutoCancelDistance();
|
float maxDistanceInFeet = ZTele_GetAutoCancelDistance();
|
||||||
float maxDistance = ZRConvertUnitsFloat(maxDistanceInFeet, CONVERSION_FEET_TO_UNITS);
|
float maxDistance = ZRConvertUnitsFloat(maxDistanceInFeet, CONVERSION_FEET_TO_UNITS);
|
||||||
|
|
||||||
return clientDistance > maxDistance;
|
return clientDistance > maxDistance;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user