Update entWatch-interface.sp
This commit is contained in:
parent
43135b501a
commit
b73a9dbf49
@ -35,15 +35,37 @@ 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;
|
||||||
|
|
||||||
|
switch(GetClientTeam(client))
|
||||||
|
{
|
||||||
|
case(2): iZombies[iZombiesCount++] = client;
|
||||||
|
case(3): iHumans[iHumansCount++] = client;
|
||||||
|
default: iSpecs[iSpecsCount++] = client;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char sZombieHUD[255];
|
||||||
|
char sHumanHUD[255];
|
||||||
|
char sSpecHUD[255];
|
||||||
|
|
||||||
for (int index; index < EW_GetItemCount(); index++)
|
for (int index; index < EW_GetItemCount(); index++)
|
||||||
{
|
{
|
||||||
CItem item = EW_GetItemData(index);
|
CItem item = EW_GetItemData(index);
|
||||||
|
|
||||||
if (item.dConfig.bDisplayInterface && item.bClient)
|
if (item.bClient && item.dConfig.bDisplayInterface)
|
||||||
{
|
{
|
||||||
char sLine[64];
|
char sLine[64];
|
||||||
char sShort[32];
|
char sShort[32];
|
||||||
@ -55,22 +77,22 @@ public Action OnDisplayHUD(Handle timer)
|
|||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "R", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "R", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_MAXUSES:
|
case MODE_MAXUSES:
|
||||||
{
|
{
|
||||||
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
if (item.iTimesUsed < item.dConfig.iMaxUses)
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_COOLDOWNMAXUSES:
|
case MODE_COOLDOWNMAXUSES:
|
||||||
@ -79,68 +101,72 @@ public Action OnDisplayHUD(Handle timer)
|
|||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "D", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "D", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MODE_COOLDOWNCHARGES:
|
case MODE_COOLDOWNCHARGES:
|
||||||
{
|
{
|
||||||
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
if (item.iTimeReady > RoundToCeil(GetEngineTime()))
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d]: %N\n", sShort, item.iTimeReady - RoundToCeil(GetEngineTime()), item.iClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%d/%d]: %N\n", sShort, item.iTimesUsed, item.dConfig.iMaxUses, item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Format(sLine, sizeof(sLine), "%s [%s]: %N", sShort, "N/A", item.iClient);
|
Format(sLine, sizeof(sLine), "%s [%s]: %N\n", sShort, "N/A", item.iClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int iTeamLine = GetClientTeam(item.iClient) - 2;
|
switch(GetClientTeam(item.iClient))
|
||||||
|
|
||||||
if (strlen(sTeamLines[iTeamLine]) + strlen(sLine) < sizeof(sTeamLines[]))
|
|
||||||
{
|
{
|
||||||
Format(sTeamLines[iTeamLine], sizeof(sTeamLines[]), "%s\n%s", sTeamLines[iTeamLine], sLine);
|
case(2):
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int client = 1; client <= MaxClients; client++)
|
|
||||||
{
|
{
|
||||||
if (!IsClientInGame(client) || IsClientSourceTV(client) || IsFakeClient(client))
|
if (strlen(sZombieHUD) + strlen(sLine) < sizeof(sZombieHUD))
|
||||||
continue;
|
|
||||||
|
|
||||||
int iTeamLine;
|
|
||||||
if ((iTeamLine = GetClientTeam(client) - 2) < 0)
|
|
||||||
{
|
{
|
||||||
int spectatingClient;
|
StrCat(sZombieHUD, sizeof(sZombieHUD), sLine);
|
||||||
if ((spectatingClient = Client_GetObserverTarget(client)) < 0)
|
}
|
||||||
continue;
|
}
|
||||||
|
case(3):
|
||||||
if ((iTeamLine = GetClientTeam(spectatingClient) - 2) < 0)
|
{
|
||||||
continue;
|
if (strlen(sHumanHUD) + strlen(sLine) < sizeof(sHumanHUD))
|
||||||
|
{
|
||||||
|
StrCat(sHumanHUD, sizeof(sHumanHUD), sLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sTeamLines[iTeamLine][0])
|
if (strlen(sSpecHUD) + strlen(sLine) < sizeof(sSpecHUD))
|
||||||
{
|
{
|
||||||
Handle hMessage = StartMessageOne("KeyHintText", client);
|
StrCat(sSpecHUD, sizeof(sSpecHUD), sLine);
|
||||||
BfWriteByte(hMessage, 1);
|
}
|
||||||
BfWriteString(hMessage, sTeamLines[iTeamLine]);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
EndMessage();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user