now disables properly and added semi support for specs
This commit is contained in:
parent
a988847775
commit
2fde5f3061
@ -42,7 +42,7 @@ public void OnPluginStart()
|
||||
g_hCVar_HideEnabled.AddChangeHook(OnConVarChanged);
|
||||
|
||||
|
||||
RegAdminCmd("sm_hide", Command_Hide, ADMFLAG_RCON);
|
||||
RegConsoleCmd("sm_hide", Command_Hide, "Hiding humans away");
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
@ -91,9 +91,6 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
if(!g_bHideEnabled)
|
||||
return;
|
||||
|
||||
SDKHook(client, SDKHook_SetTransmit, Hook_SetTransmit);
|
||||
}
|
||||
|
||||
@ -139,14 +136,21 @@ public Action Command_Hide(int client, int args)
|
||||
GetCmdArg(1, sArgs, sizeof(sArgs));
|
||||
iDistance = StringToInt(sArgs);
|
||||
}
|
||||
if (IsPlayerAlive(client) && ZR_IsClientZombie(client))
|
||||
{
|
||||
ReplyToCommand(client, "You are a zombie and therefore need to see the humans.");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if((iDistance == 0) || (iDistance < g_hCVar_HideMinimumDistance.IntValue) || (iDistance > g_hCVar_HideMaximumDistance.IntValue))
|
||||
{
|
||||
ReplyToCommand(client, "[Hide] Wrong input! Allowed range: %d-%d", g_hCVar_HideMinimumDistance.IntValue, g_hCVar_HideMaximumDistance.IntValue);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
ReplyToCommand(client, "[Hide] Humans within range %d are now hidden.", iDistance);
|
||||
if (!IsPlayerAlive(client))
|
||||
ReplyToCommand(client, "[Hide] All Humans are now hidden.");
|
||||
else
|
||||
ReplyToCommand(client, "[Hide] Humans within range %d are now hidden.", iDistance);
|
||||
g_iHideDistance[client] = iDistance * iDistance;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -161,12 +165,30 @@ public Action UpdateHide(Handle timer)
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(!IsClientInGame(client))
|
||||
continue;
|
||||
if(!g_iHideDistance[client])
|
||||
{
|
||||
for(int target = 1; target <= MaxClients; target++)
|
||||
{
|
||||
if(target != client && IsClientInGame(target) && IsPlayerAlive(target) && ZR_IsClientHuman(target))
|
||||
g_bHidePlayers[client][target] = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!IsPlayerAlive(client))
|
||||
{
|
||||
for(int target = 1; target <= MaxClients; target++)
|
||||
{
|
||||
if(target != client && IsClientInGame(target) && IsPlayerAlive(target) && ZR_IsClientHuman(target))
|
||||
{
|
||||
g_bHidePlayers[client][target] = true
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
if(!IsClientInGame(client) || !IsPlayerAlive(client) || !ZR_IsClientHuman(client))
|
||||
}
|
||||
if (!ZR_IsClientHuman(client))
|
||||
continue;
|
||||
|
||||
float fOriginClient[3];
|
||||
float fOriginTarget[3];
|
||||
|
||||
@ -200,4 +222,4 @@ public Action Hook_SetTransmit(int target, int client)
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user