Save recent infections via SteamID.
Change SteamID cache to AccountID. Fix error which broke shotgun knockback. Add roundend stats to console. Renamed some global variables to have g_ prefix
This commit is contained in:
parent
dd1ba186eb
commit
e7597639c2
@ -107,6 +107,7 @@
|
||||
#include "zr/api/api"
|
||||
|
||||
new bool:g_bLate = false;
|
||||
new bool:g_bServerStarted = false;
|
||||
|
||||
/**
|
||||
* Record plugin info.
|
||||
@ -155,7 +156,6 @@ public OnPluginStart()
|
||||
LogInit(); // Doesn't depend on CVARs.
|
||||
TranslationInit();
|
||||
CvarsInit();
|
||||
ToolsInit();
|
||||
CookiesInit();
|
||||
CommandsInit();
|
||||
WeaponsInit();
|
||||
@ -194,6 +194,11 @@ public OnLibraryRemoved(const String:name[])
|
||||
*/
|
||||
public OnMapStart()
|
||||
{
|
||||
if(!g_bServerStarted)
|
||||
{
|
||||
ToolsInit();
|
||||
g_bServerStarted = true;
|
||||
}
|
||||
// Forward event to modules.
|
||||
ClassOnMapStart();
|
||||
OverlaysOnMapStart();
|
||||
@ -384,3 +389,11 @@ public OnEntityCreated(entity, const String:classname[])
|
||||
{
|
||||
NapalmOnEntityCreated(entity, classname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called before every server frame. Note that you should avoid
|
||||
* doing expensive computations or declaring large local arrays.
|
||||
*/
|
||||
public void OnGameFrame()
|
||||
{
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ DamageLoad()
|
||||
TrimString(arrayCmds[x]);
|
||||
|
||||
// Prepare intercept for this command.
|
||||
RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept);
|
||||
AddCommandListener(DamageSuicideIntercept, arrayCmds[x]);
|
||||
}
|
||||
|
||||
// Important: If ZR can be unloaded some day, make sure to remove the listeners and set this to false.
|
||||
@ -367,7 +367,7 @@ public Action:DamageOnTakeDamage(client, &attacker, &inflictor, &Float:damage, &
|
||||
* @param client The client index.
|
||||
* @param argc The number of arguments in command string.
|
||||
*/
|
||||
public Action:DamageSuicideIntercept(client, argc)
|
||||
public Action:DamageSuicideIntercept(int client, const char[] command, int argc)
|
||||
{
|
||||
// Get suicide interception settings.
|
||||
new bool:suicideAfterInfect = GetConVarBool(g_hCvarsList[CVAR_SUICIDE_AFTER_INFECT]);
|
||||
|
@ -278,7 +278,7 @@ Action:ImmunityOnClientDamage(client, attacker, &Float:damage)
|
||||
}
|
||||
|
||||
// Check if spawn protection is on.
|
||||
if (bInfectImmune[client])
|
||||
if (g_bInfectImmune[client])
|
||||
{
|
||||
// Block damage.
|
||||
return Plugin_Handled;
|
||||
|
@ -48,8 +48,8 @@
|
||||
/**
|
||||
* @section Global variables to store infect timer handles.
|
||||
*/
|
||||
new Handle:tInfect = INVALID_HANDLE;
|
||||
new Handle:tInfectCountdown = INVALID_HANDLE;
|
||||
new Handle:g_tInfect = INVALID_HANDLE;
|
||||
new Handle:g_tInfectCountdown = INVALID_HANDLE;
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
@ -57,32 +57,27 @@ new Handle:tInfectCountdown = INVALID_HANDLE;
|
||||
/**
|
||||
* Infection countdown data pack.
|
||||
*/
|
||||
new Handle:hInfectCountdownData = INVALID_HANDLE;
|
||||
new Handle:g_hInfectCountdownData = INVALID_HANDLE;
|
||||
|
||||
/**
|
||||
* Array for flagging client as zombie.
|
||||
*/
|
||||
new bool:bZombie[MAXPLAYERS + 1];
|
||||
new bool:g_bZombie[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Array for flagging client to be protected.
|
||||
*/
|
||||
new bool:bInfectImmune[MAXPLAYERS + 1];
|
||||
new bool:g_bInfectImmune[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Available mother zombie infection status.
|
||||
* Array for storing client mother zombie last flag.
|
||||
*/
|
||||
enum InfectMotherStatus
|
||||
{
|
||||
MotherStatus_None = 0,
|
||||
MotherStatus_Chosen = 1,
|
||||
MotherStatus_Last = 2
|
||||
}
|
||||
new bool:g_bInfectMotherLast[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Array for storing client mother zombie protection status.
|
||||
* SteamID cache for storing client mother zombie protection status.
|
||||
*/
|
||||
new InfectMotherStatus:g_InfectMotherStatus[MAXPLAYERS + 1];
|
||||
new Handle:g_hInfectMotherCycle = INVALID_HANDLE;
|
||||
|
||||
/**
|
||||
* Available mother zombie infection modes.
|
||||
@ -102,9 +97,12 @@ InfectOnMapEnd()
|
||||
{
|
||||
// Reset timers. Infect timers are invalidated on a map change if they are
|
||||
// still running.
|
||||
ZREndTimer(tInfect);
|
||||
ZREndTimer(tInfectCountdown);
|
||||
ZREndTimer(g_tInfect);
|
||||
ZREndTimer(g_tInfectCountdown);
|
||||
InfectStopCountdown();
|
||||
|
||||
// Clear mother zombie round-robin cycle storage.
|
||||
SteamidCacheReset(g_hInfectMotherCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,6 +125,9 @@ InfectLoad()
|
||||
|
||||
// Add sound file to downloads table.
|
||||
AddFileToDownloadsTable(sound);
|
||||
|
||||
// Create mother zombie round-robin cycle storage.
|
||||
g_hInfectMotherCycle = SteamidCacheCreate();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,10 +147,10 @@ InfectOnCommandsCreate()
|
||||
InfectClientInit(client)
|
||||
{
|
||||
// Reset infect immunity flag.
|
||||
bInfectImmune[client] = false;
|
||||
g_bInfectImmune[client] = false;
|
||||
|
||||
// Reset mother zombie protection.
|
||||
g_InfectMotherStatus[client] = MotherStatus_None;
|
||||
// Reset mother zombie last flag.
|
||||
g_bInfectMotherLast[client] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,7 +265,7 @@ InfectOnClientTeam(client, team)
|
||||
}
|
||||
|
||||
// Disable zombie flag on client.
|
||||
bZombie[client] = false;
|
||||
g_bZombie[client] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,7 +276,7 @@ InfectOnClientTeam(client, team)
|
||||
InfectOnClientSpawn(client)
|
||||
{
|
||||
// Disable zombie flag on client.
|
||||
bZombie[client] = false;
|
||||
g_bZombie[client] = false;
|
||||
|
||||
// Check if client is spawning on the terrorist team.
|
||||
if (ZRIsClientOnTeam(client, CS_TEAM_T) && InfectHasZombieSpawned())
|
||||
@ -347,7 +348,7 @@ InfectOnClientHurt(client, attacker, const String:weapon[])
|
||||
}
|
||||
|
||||
// If client has infect immunity, then stop.
|
||||
if (bInfectImmune[client])
|
||||
if (g_bInfectImmune[client])
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -375,8 +376,8 @@ InfectOnClientHurt(client, attacker, const String:weapon[])
|
||||
InfectOnRoundStart()
|
||||
{
|
||||
// Stop infect timers if running.
|
||||
ZREndTimer(tInfect);
|
||||
ZREndTimer(tInfectCountdown);
|
||||
ZREndTimer(g_tInfect);
|
||||
ZREndTimer(g_tInfectCountdown);
|
||||
|
||||
// Tell plugin there are no zombies.
|
||||
g_bZombieSpawned = false;
|
||||
@ -388,8 +389,8 @@ InfectOnRoundStart()
|
||||
InfectOnRoundFreezeEnd()
|
||||
{
|
||||
// Stop infect timers if running.
|
||||
ZREndTimer(tInfect);
|
||||
ZREndTimer(tInfectCountdown);
|
||||
ZREndTimer(g_tInfect);
|
||||
ZREndTimer(g_tInfectCountdown);
|
||||
|
||||
// If the zombie has spawned already (had to be through admin) then stop.
|
||||
if (InfectHasZombieSpawned())
|
||||
@ -404,10 +405,7 @@ InfectOnRoundFreezeEnd()
|
||||
// Pick random time between min and max.
|
||||
new Float:randomtime = GetRandomFloat(infectspawntimemin, infectspawntimemax);
|
||||
|
||||
// Round to the nearest whole number (and convert back to a float) so the countdown is synched with it.
|
||||
float(RoundToNearest(randomtime));
|
||||
|
||||
tInfect = CreateTimer(randomtime, InfectMotherZombie, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_tInfect = CreateTimer(randomtime, InfectMotherZombie, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
// Check cvar and start a countdown timer if enabled.
|
||||
new bool:countdown = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]);
|
||||
@ -417,13 +415,13 @@ InfectOnRoundFreezeEnd()
|
||||
InfectStopCountdown();
|
||||
|
||||
// Store the time until infection, and initialize the counter.
|
||||
hInfectCountdownData = CreateDataPack();
|
||||
WritePackFloat(hInfectCountdownData, randomtime);
|
||||
WritePackFloat(hInfectCountdownData, 0.0);
|
||||
tInfectCountdown = CreateTimer(1.0, InfectCountdown, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hInfectCountdownData = CreateDataPack();
|
||||
WritePackFloat(g_hInfectCountdownData, randomtime);
|
||||
WritePackFloat(g_hInfectCountdownData, 0.0);
|
||||
g_tInfectCountdown = CreateTimer(1.0, InfectCountdown, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
// Display initial tick.
|
||||
InfectCountdown(tInfectCountdown);
|
||||
InfectCountdown(g_tInfectCountdown);
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,14 +431,14 @@ InfectOnRoundFreezeEnd()
|
||||
InfectOnRoundEnd()
|
||||
{
|
||||
// Stop infect timers if running.
|
||||
ZREndTimer(tInfect);
|
||||
ZREndTimer(tInfectCountdown);
|
||||
ZREndTimer(g_tInfect);
|
||||
ZREndTimer(g_tInfectCountdown);
|
||||
|
||||
// x = client index.
|
||||
for (new x = 1; x <= MaxClients; x++)
|
||||
{
|
||||
// Disable zombie flag on client.
|
||||
bZombie[x] = false;
|
||||
g_bZombie[x] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +450,7 @@ InfectOnRoundEnd()
|
||||
public Action:InfectMotherZombie(Handle:timer)
|
||||
{
|
||||
// Reset timer handle.
|
||||
tInfect = INVALID_HANDLE;
|
||||
g_tInfect = INVALID_HANDLE;
|
||||
|
||||
// Create eligible player list.
|
||||
new Handle:arrayEligibleClients = INVALID_HANDLE;
|
||||
@ -546,7 +544,7 @@ public Action:InfectMotherZombie(Handle:timer)
|
||||
new client = GetArrayCell(arrayEligibleClients, n);
|
||||
|
||||
// If client hasn't been chosen this cycle, put into aCandidates array.
|
||||
if (g_InfectMotherStatus[client] == MotherStatus_None)
|
||||
if (!SteamidCacheClientExists(g_hInfectMotherCycle, client))
|
||||
{
|
||||
PushArrayCell(aCandidates, client);
|
||||
candidates++;
|
||||
@ -563,7 +561,7 @@ public Action:InfectMotherZombie(Handle:timer)
|
||||
|
||||
// If client hasn't been chosen last round, put into aCandidates array,
|
||||
// but only until we have enough candidates.
|
||||
if (!(g_InfectMotherStatus[client] & MotherStatus_Last))
|
||||
if (!g_bInfectMotherLast[client])
|
||||
{
|
||||
PushArrayCell(aCandidates, client);
|
||||
candidates++;
|
||||
@ -575,20 +573,17 @@ public Action:InfectMotherZombie(Handle:timer)
|
||||
}
|
||||
|
||||
// Restart the cycle.
|
||||
// Reset all players MotherStatus.
|
||||
for (int client = 0; client <= MAXPLAYERS; client++)
|
||||
{
|
||||
g_InfectMotherStatus[client] = MotherStatus_None;
|
||||
}
|
||||
// Clear mother zombie round-robin cycle storage.
|
||||
SteamidCacheReset(g_hInfectMotherCycle);
|
||||
|
||||
// Announce start of new cycle
|
||||
TranslationPrintToChatAll(true, false, "Mother zombie infect cycle reset");
|
||||
}
|
||||
|
||||
// Remove MotherStatus_Last flag from all players.
|
||||
// Remove mother zombie last flag from all players.
|
||||
for (int client = 0; client <= MAXPLAYERS; client++)
|
||||
{
|
||||
g_InfectMotherStatus[client] &= ~MotherStatus_Last;
|
||||
g_bInfectMotherLast[client] = false;
|
||||
}
|
||||
|
||||
// Infect players.
|
||||
@ -662,9 +657,9 @@ public Action:InfectCountdown(Handle:timer)
|
||||
}
|
||||
|
||||
// Read the info from the datapack.
|
||||
ResetPack(hInfectCountdownData);
|
||||
new Float:length = ReadPackFloat(hInfectCountdownData);
|
||||
new Float:counter = ReadPackFloat(hInfectCountdownData);
|
||||
ResetPack(g_hInfectCountdownData);
|
||||
new Float:length = ReadPackFloat(g_hInfectCountdownData);
|
||||
new Float:counter = ReadPackFloat(g_hInfectCountdownData);
|
||||
|
||||
// Check if the countdown has finished.
|
||||
if (counter >= length)
|
||||
@ -679,9 +674,9 @@ public Action:InfectCountdown(Handle:timer)
|
||||
counter++;
|
||||
|
||||
// Write the new counter value to the datapack.
|
||||
ResetPack(hInfectCountdownData);
|
||||
WritePackFloat(hInfectCountdownData, length);
|
||||
WritePackFloat(hInfectCountdownData, counter);
|
||||
ResetPack(g_hInfectCountdownData);
|
||||
WritePackFloat(g_hInfectCountdownData, length);
|
||||
WritePackFloat(g_hInfectCountdownData, counter);
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
@ -692,13 +687,13 @@ public Action:InfectCountdown(Handle:timer)
|
||||
InfectStopCountdown()
|
||||
{
|
||||
// Kill the timer.
|
||||
ZREndTimer(tInfectCountdown);
|
||||
ZREndTimer(g_tInfectCountdown);
|
||||
|
||||
// Destroy data pack.
|
||||
if (hInfectCountdownData != INVALID_HANDLE)
|
||||
if (g_hInfectCountdownData != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(hInfectCountdownData);
|
||||
hInfectCountdownData = INVALID_HANDLE;
|
||||
CloseHandle(g_hInfectCountdownData);
|
||||
g_hInfectCountdownData = INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -724,7 +719,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||
}
|
||||
|
||||
// Mark player as zombie.
|
||||
bZombie[client] = true;
|
||||
g_bZombie[client] = true;
|
||||
|
||||
// Check if consecutive infection protection is enabled.
|
||||
new bool:infectconsecutiveblock = GetConVarBool(g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK]);
|
||||
@ -733,13 +728,14 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||
// If this is a mother infect, update the mother zombie protection status
|
||||
if (motherinfect)
|
||||
{
|
||||
g_InfectMotherStatus[client] = MotherStatus_Chosen | MotherStatus_Last;
|
||||
g_bInfectMotherLast[client] = true;
|
||||
SteamidCacheAddClient(g_hInfectMotherCycle, client);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Consecutive infection protection is disabled. No immunity.
|
||||
g_InfectMotherStatus[client] = MotherStatus_None;
|
||||
g_bInfectMotherLast[client] = false;
|
||||
}
|
||||
|
||||
// Apply effects.
|
||||
@ -837,7 +833,7 @@ InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
|
||||
}
|
||||
|
||||
// Mark player as human.
|
||||
bZombie[client] = false;
|
||||
g_bZombie[client] = false;
|
||||
|
||||
// Switch the player to counter-terrorists.
|
||||
CS_SwitchTeam(client, CS_TEAM_CT);
|
||||
@ -1115,7 +1111,7 @@ bool:InfectIsClientInfected(client)
|
||||
}
|
||||
|
||||
// Return client's zombie flag.
|
||||
return bZombie[client];
|
||||
return g_bZombie[client];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1133,7 +1129,7 @@ bool:InfectIsClientHuman(client)
|
||||
}
|
||||
|
||||
// Return opposite of client's zombie flag.
|
||||
return !bZombie[client];
|
||||
return !g_bZombie[client];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1153,10 +1149,10 @@ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false,
|
||||
if (!zombiespawned)
|
||||
{
|
||||
// Stop mother infect timer.
|
||||
if (tInfect != INVALID_HANDLE)
|
||||
if (g_tInfect != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(tInfect);
|
||||
tInfect = INVALID_HANDLE;
|
||||
KillTimer(g_tInfect);
|
||||
g_tInfect = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
// Move all clients to CT
|
||||
|
@ -73,6 +73,10 @@ RespawnOnClientSpawn(client)
|
||||
|
||||
// Reset timer handle.
|
||||
tRespawn[client] = INVALID_HANDLE;
|
||||
|
||||
// Reset player velocity
|
||||
float fResetVelocity[3] = {0.0, 0.0, 0.0};
|
||||
ToolsClientVelocity(client, fResetVelocity, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,10 +188,6 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals
|
||||
// Spawn player.
|
||||
CS_RespawnPlayer(client);
|
||||
|
||||
// Reset player velocity
|
||||
float fResetVelocity[3] = {0.0, 0.0, 0.0};
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fResetVelocity);
|
||||
|
||||
// Check if first zombie has spawned.
|
||||
if (InfectHasZombieSpawned())
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ enum RoundEndOutcome
|
||||
/**
|
||||
* Global variable to store round win timer handle.
|
||||
*/
|
||||
new Handle:tRoundEnd = INVALID_HANDLE;
|
||||
new Handle:g_tRoundEnd = INVALID_HANDLE;
|
||||
|
||||
/**
|
||||
* Map is starting.
|
||||
@ -75,7 +75,7 @@ new Handle:tRoundEnd = INVALID_HANDLE;
|
||||
RoundEndOnMapStart()
|
||||
{
|
||||
// Reset timer handle.
|
||||
tRoundEnd = INVALID_HANDLE;
|
||||
g_tRoundEnd = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,13 +113,13 @@ RoundEndOnRoundStart()
|
||||
RoundEndOverlayStop();
|
||||
|
||||
// If round end timer is running, then kill it.
|
||||
if (tRoundEnd != INVALID_HANDLE)
|
||||
if (g_tRoundEnd != INVALID_HANDLE)
|
||||
{
|
||||
// Kill timer.
|
||||
KillTimer(tRoundEnd);
|
||||
KillTimer(g_tRoundEnd);
|
||||
|
||||
// Reset timer handle.
|
||||
tRoundEnd = INVALID_HANDLE;
|
||||
g_tRoundEnd = INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ RoundEndOnRoundFreezeEnd()
|
||||
}
|
||||
|
||||
// Start timer.
|
||||
tRoundEnd = CreateTimer(roundtime, RoundEndTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_tRoundEnd = CreateTimer(roundtime, RoundEndTimer, _, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,13 +155,13 @@ RoundEndOnRoundFreezeEnd()
|
||||
RoundEndOnRoundEnd(reason)
|
||||
{
|
||||
// If round end timer is running, then kill it.
|
||||
if (tRoundEnd != INVALID_HANDLE)
|
||||
if (g_tRoundEnd != INVALID_HANDLE)
|
||||
{
|
||||
// Kill timer.
|
||||
KillTimer(tRoundEnd);
|
||||
KillTimer(g_tRoundEnd);
|
||||
|
||||
// Reset timer handle.
|
||||
tRoundEnd = INVALID_HANDLE;
|
||||
g_tRoundEnd = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
// Tell plugin no zombies have been spawned.
|
||||
@ -193,6 +193,8 @@ RoundEndOnRoundEnd(reason)
|
||||
// Display the overlay to all clients.
|
||||
RoundEndOverlayStart(outcome);
|
||||
|
||||
RoundEndDisplayStats();
|
||||
|
||||
// Balance teams if enabled.
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_ROUNDEND_BALANCE_TEAMS]))
|
||||
{
|
||||
@ -200,6 +202,46 @@ RoundEndOnRoundEnd(reason)
|
||||
}
|
||||
}
|
||||
|
||||
RoundEndDisplayStats()
|
||||
{
|
||||
for(int player = 1; player <= MaxClients; player++)
|
||||
{
|
||||
if(!IsClientInGame(player))
|
||||
continue;
|
||||
|
||||
static char sPlayerID[8];
|
||||
static char sPlayerName[MAX_NAME_LENGTH + 2];
|
||||
static char sPlayerAuth[24];
|
||||
static char sPlayerTeam[8];
|
||||
static char sPlayerState[8];
|
||||
|
||||
FormatEx(sPlayerID, sizeof(sPlayerID), "%d", GetClientUserId(player));
|
||||
FormatEx(sPlayerName, sizeof(sPlayerName), "\"%N\"", player);
|
||||
|
||||
if(!GetClientAuthId(player, AuthId_Steam2, sPlayerAuth, sizeof(sPlayerAuth)))
|
||||
FormatEx(sPlayerAuth, sizeof(sPlayerAuth), "STEAM_ID_PENDING");
|
||||
|
||||
if(IsPlayerAlive(player))
|
||||
FormatEx(sPlayerState, sizeof(sPlayerState), "alive");
|
||||
else
|
||||
FormatEx(sPlayerState, sizeof(sPlayerState), "dead");
|
||||
|
||||
if(InfectIsClientInfected(player))
|
||||
FormatEx(sPlayerTeam, sizeof(sPlayerTeam), "zombie");
|
||||
else
|
||||
FormatEx(sPlayerTeam, sizeof(sPlayerTeam), "human");
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(!IsClientInGame(client))
|
||||
continue;
|
||||
|
||||
PrintToConsole(client, "# %8s %40s %24s %5s %6s",
|
||||
sPlayerID, sPlayerName, sPlayerAuth, sPlayerState, sPlayerTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a round_end reason, to a round winner, or draw.
|
||||
*
|
||||
@ -239,7 +281,7 @@ RoundEndOutcome:RoundEndReasonToOutcome(reason)
|
||||
public Action:RoundEndTimer(Handle:timer)
|
||||
{
|
||||
// Set the global timer handle variable to INVALID_HANDLE.
|
||||
tRoundEnd = INVALID_HANDLE;
|
||||
g_tRoundEnd = INVALID_HANDLE;
|
||||
|
||||
// If there aren't clients on both teams, then stop.
|
||||
if (!ZRTeamHasClients())
|
||||
|
@ -28,7 +28,7 @@
|
||||
/**
|
||||
* Array for storing spawn protect timer handles per client.
|
||||
*/
|
||||
new Handle:tSpawnProtect[MAXPLAYERS + 1];
|
||||
new Handle:g_tSpawnProtect[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Array for storing time left for spawn protection per client.
|
||||
@ -43,7 +43,7 @@ new pSpawnProtectTime[MAXPLAYERS + 1];
|
||||
SpawnProtectClientInit(client)
|
||||
{
|
||||
// Reset timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,13 +60,13 @@ SpawnProtectOnClientSpawnPost(client)
|
||||
}
|
||||
|
||||
// If timer is currently running, kill it.
|
||||
if (tSpawnProtect[client] != INVALID_HANDLE)
|
||||
if (g_tSpawnProtect[client] != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(tSpawnProtect[client]);
|
||||
KillTimer(g_tSpawnProtect[client]);
|
||||
}
|
||||
|
||||
// Reset timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
|
||||
// If protect cvar is disabled, then stop.
|
||||
new bool:protect = GetConVarBool(g_hCvarsList[CVAR_SPAWNPROTECT]);
|
||||
@ -76,7 +76,7 @@ SpawnProtectOnClientSpawnPost(client)
|
||||
}
|
||||
|
||||
// Disable spawn protection on client.
|
||||
bInfectImmune[client] = false;
|
||||
g_bInfectImmune[client] = false;
|
||||
|
||||
// Start spawn protection.
|
||||
SpawnProtectStart(client);
|
||||
@ -90,13 +90,13 @@ SpawnProtectOnClientSpawnPost(client)
|
||||
SpawnProtectOnClientDeath(client)
|
||||
{
|
||||
// If timer is running, kill it.
|
||||
if (tSpawnProtect[client] != INVALID_HANDLE)
|
||||
if (g_tSpawnProtect[client] != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(tSpawnProtect[client]);
|
||||
KillTimer(g_tSpawnProtect[client]);
|
||||
}
|
||||
|
||||
// Reset timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,7 +158,7 @@ SpawnProtectStart(client)
|
||||
}
|
||||
|
||||
// Set spawn protect flag on client.
|
||||
bInfectImmune[client] = true;
|
||||
g_bInfectImmune[client] = true;
|
||||
|
||||
// Set spawn protect attributes.
|
||||
ClassApplySpeedEx(client, speed);
|
||||
@ -175,7 +175,7 @@ SpawnProtectStart(client)
|
||||
TranslationPrintHintText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||
|
||||
// Start repeating timer.
|
||||
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||
g_tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,7 +190,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||
if (!IsClientInGame(client))
|
||||
{
|
||||
// Reset timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||
if (!InfectIsClientHuman(client))
|
||||
{
|
||||
// Reset timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||
if (pSpawnProtectTime[client] <= 0)
|
||||
{
|
||||
// Remove protect flag.
|
||||
bInfectImmune[client] = false;
|
||||
g_bInfectImmune[client] = false;
|
||||
|
||||
// Tell client spawn protection is over.
|
||||
TranslationPrintHintText(client, "Spawn protection end");
|
||||
@ -222,7 +222,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||
ClassApplySpeedEx(client, ClassGetSpeed(client));
|
||||
|
||||
// Clear timer handle.
|
||||
tSpawnProtect[client] = INVALID_HANDLE;
|
||||
g_tSpawnProtect[client] = INVALID_HANDLE;
|
||||
|
||||
// Stop timer.
|
||||
return Plugin_Stop;
|
||||
|
@ -25,11 +25,6 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* The maximum length of a SteamID
|
||||
*/
|
||||
#define STEAMIDCACHE_MAX_LENGTH 16
|
||||
|
||||
/**
|
||||
* Creates a steamid cache.
|
||||
*
|
||||
@ -38,7 +33,7 @@
|
||||
stock Handle:SteamidCacheCreate()
|
||||
{
|
||||
// Return steamid cache handle.
|
||||
return CreateArray(STEAMIDCACHE_MAX_LENGTH);
|
||||
return CreateArray(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,11 +52,12 @@ stock bool:SteamidCacheAddClient(Handle:steamidcache, client)
|
||||
}
|
||||
|
||||
// Get client's SteamID.
|
||||
new String:steamid[STEAMIDCACHE_MAX_LENGTH];
|
||||
GetClientAuthId(client, AuthId_SteamID64, steamid, sizeof(steamid), true);
|
||||
new steamid = GetSteamAccountID(client);
|
||||
if (!steamid)
|
||||
return false;
|
||||
|
||||
// Push SteamID into the SteamID cache.
|
||||
PushArrayString(steamidcache, steamid);
|
||||
PushArrayCell(steamidcache, steamid);
|
||||
|
||||
// Client added successfully.
|
||||
return true;
|
||||
@ -77,11 +73,12 @@ stock bool:SteamidCacheAddClient(Handle:steamidcache, client)
|
||||
stock bool:SteamidCacheClientExists(Handle:steamidcache, client)
|
||||
{
|
||||
// Get client's SteamID.
|
||||
decl String:steamid[STEAMIDCACHE_MAX_LENGTH];
|
||||
GetClientAuthId(client, AuthId_SteamID64, steamid, sizeof(steamid), true);
|
||||
new steamid = GetSteamAccountID(client);
|
||||
if (!steamid)
|
||||
return false;
|
||||
|
||||
// Return true if client was found, false otherwise.
|
||||
return (FindStringInArray(steamidcache, steamid) != -1);
|
||||
return (FindValueInArray(steamidcache, steamid) != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,11 +55,11 @@ ToolsInit()
|
||||
*/
|
||||
ToolsFindOffsets()
|
||||
{
|
||||
// If offset "m_vecVelocity[0]" can't be found, then stop the plugin.
|
||||
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
||||
// If offset "m_vecAbsVelocity" can't be found, then stop the plugin.
|
||||
g_iToolsVelocity = FindDataMapInfo(0, "m_vecAbsVelocity");
|
||||
if (g_iToolsVelocity == -1)
|
||||
{
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBaseEntity::m_vecAbsVelocity\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
||||
@ -90,7 +90,6 @@ ToolsFindOffsets()
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_iFOV\" was not found.");
|
||||
}
|
||||
|
||||
// void CBaseEntity::SetAbsVelocity( const Vector &vecAbsVelocity )
|
||||
Handle hGameConf = LoadGameConfigFile("zombiereloaded");
|
||||
if (hGameConf != INVALID_HANDLE)
|
||||
{
|
||||
|
@ -35,16 +35,6 @@
|
||||
*/
|
||||
stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:stack = true)
|
||||
{
|
||||
static bool:gotoffset = false;
|
||||
static offset = -1;
|
||||
|
||||
if(!gotoffset)
|
||||
{
|
||||
offset = FindDataMapInfo(client, "m_vecAbsVelocity");
|
||||
if(offset != -1)
|
||||
gotoffset = true;
|
||||
}
|
||||
|
||||
// If retrieve is true, then get client's velocity.
|
||||
if (!apply)
|
||||
{
|
||||
@ -66,10 +56,7 @@ stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:
|
||||
}
|
||||
|
||||
// Apply velocity on client.
|
||||
if(gotoffset) // Fixes trigger OnStartTouch/OnEndTouch bug
|
||||
SetEntDataVector(client, offset, vecVelocity);
|
||||
else // Fallback to old one
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
|
||||
SetEntDataVector(client, g_iToolsVelocity, vecVelocity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user