Update entWatch-interface.sp
This commit is contained in:
parent
c1f93dcf3b
commit
fdd39a1fa4
@ -35,112 +35,138 @@ public void OnMapStart()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action OnDisplayHUD(Handle timer)
|
public Action OnDisplayHUD(Handle timer)
|
||||||
{
|
{
|
||||||
if (EW_GetItemCount() >= 1)
|
int iZombiesCount;
|
||||||
|
int iZombies[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
int iHumansCount;
|
||||||
|
int iHumans[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
int iSpecsCount;
|
||||||
|
int iSpecs[MAXPLAYERS+1];
|
||||||
|
|
||||||
|
for (int client = 1; client <= MaxClients; client++)
|
||||||
{
|
{
|
||||||
char sTeamLines[2][255];
|
if (!IsClientInGame(client) || IsFakeClient(client))
|
||||||
|
continue;
|
||||||
|
|
||||||
for (int index; index < EW_GetItemCount(); index++)
|
switch(GetClientTeam(client))
|
||||||
{
|
{
|
||||||
CItem item = EW_GetItemData(index);
|
case(2): iZombies[iZombiesCount++] = client;
|
||||||
|
case(3): iHumans[iHumansCount++] = client;
|
||||||
if (item.dConfig.bDisplayInterface && item.bClient)
|
default: iSpecs[iSpecsCount++] = client;
|
||||||
{
|
|
||||||
char sLine[64];
|
|
||||||
char sShort[32];
|
|
||||||
item.dConfig.GetShort(sShort, sizeof(sShort));
|
|
||||||
|
|
||||||
switch(item.dConfig.iMode)
|
|
||||||
{
|
|
||||||
case MODE_COOLDOWN:
|
|
||||||
{
|
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "R", item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case MODE_MAXUSES:
|
|
||||||
{
|
|
||||||
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case MODE_COOLDOWNMAXUSES:
|
|
||||||
{
|
|
||||||
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
|
||||||
{
|
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case MODE_COOLDOWNCHARGES:
|
|
||||||
{
|
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "N/A", item.iClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int iTeamLine = GetClientTeam(item.iClient) - 2;
|
|
||||||
|
|
||||||
if (strlen(sTeamLines[iTeamLine]) + strlen(sLine) < sizeof(sTeamLines[]))
|
|
||||||
{
|
|
||||||
Format(sTeamLines[iTeamLine], sizeof(sTeamLines[]), "%s\n%s", sTeamLines[iTeamLine], sLine);
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int client = 1; client <= MaxClients; client++)
|
char sZombieHUD[255];
|
||||||
|
char sHumanHUD[255];
|
||||||
|
char sSpecHUD[255];
|
||||||
|
|
||||||
|
for (int index; index < EW_GetItemCount(); index++)
|
||||||
|
{
|
||||||
|
CItem item = EW_GetItemData(index);
|
||||||
|
|
||||||
|
if (item.bClient && item.dConfig.bDisplayInterface)
|
||||||
{
|
{
|
||||||
if (!IsClientInGame(client) || IsClientSourceTV(client) || IsFakeClient(client))
|
char sLine[64];
|
||||||
continue;
|
char sShort[32];
|
||||||
|
item.dConfig.GetShort(sShort, sizeof(sShort));
|
||||||
|
|
||||||
int iTeamLine;
|
switch(item.dConfig.iMode)
|
||||||
if ((iTeamLine = GetClientTeam(client) - 2) < 0)
|
|
||||||
{
|
{
|
||||||
int spectatingClient;
|
case MODE_COOLDOWN:
|
||||||
if ((spectatingClient = Client_GetObserverTarget(client)) < 0)
|
{
|
||||||
continue;
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
|
{
|
||||||
if ((iTeamLine = GetClientTeam(spectatingClient) - 2) < 0)
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
continue;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "R", item.iClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case MODE_MAXUSES:
|
||||||
|
{
|
||||||
|
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case MODE_COOLDOWNMAXUSES:
|
||||||
|
{
|
||||||
|
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
||||||
|
{
|
||||||
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case MODE_COOLDOWNCHARGES:
|
||||||
|
{
|
||||||
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "N/A", item.iClient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sTeamLines[iTeamLine][0])
|
switch(GetClientTeam(item.iClient))
|
||||||
{
|
{
|
||||||
Handle hMessage = StartMessageOne("KeyHintText", client);
|
case(2):
|
||||||
BfWriteByte(hMessage, 1);
|
{
|
||||||
BfWriteString(hMessage, sTeamLines[iTeamLine]);
|
if (strlen(sZombieHUD) + strlen(sLine) < sizeof(sZombieHUD))
|
||||||
EndMessage();
|
{
|
||||||
|
StrCat(sZombieHUD, sizeof(sZombieHUD), sLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case(3):
|
||||||
|
{
|
||||||
|
if (strlen(sHumanHUD) + strlen(sLine) < sizeof(sHumanHUD))
|
||||||
|
{
|
||||||
|
StrCat(sHumanHUD, sizeof(sHumanHUD), sLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(sSpecHUD) + strlen(sLine) < sizeof(sSpecHUD))
|
||||||
|
{
|
||||||
|
StrCat(sSpecHUD, sizeof(sSpecHUD), sLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle hZombieMessage = StartMessage("KeyHintText", iZombies, iZombiesCount);
|
||||||
|
BfWriteByte(hZombieMessage, 1);
|
||||||
|
BfWriteString(hZombieMessage, sZombieHUD);
|
||||||
|
EndMessage();
|
||||||
|
|
||||||
|
Handle hHumanMessage = StartMessage("KeyHintText", iHumans, iHumansCount);
|
||||||
|
BfWriteByte(hHumanMessage, 1);
|
||||||
|
BfWriteString(hHumanMessage, sHumanHUD);
|
||||||
|
EndMessage();
|
||||||
|
|
||||||
|
Handle hSpecMessage = StartMessage("KeyHintText", iSpecs, iSpecsCount);
|
||||||
|
BfWriteByte(hSpecMessage, 1);
|
||||||
|
BfWriteString(hSpecMessage, sSpecHUD);
|
||||||
|
EndMessage();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user