//==================================================================================================== // // Name: [entWatch] Interface // Author: zaCade & Prometheum // Description: Handle the interface of [entWatch] // //==================================================================================================== #pragma newdecls required #include #include #include //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Plugin myinfo = { name = "[entWatch] Interface", author = "zaCade & Prometheum", description = "Handle the interface of [entWatch]", version = "4.0.0" }; //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void OnMapStart() { CreateTimer(1.0, OnDisplayHUD, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action OnDisplayHUD(Handle timer) { if (EW_GetItemCount() >= 1) { char sTeamLines[2][255]; for (int index; index < EW_GetItemCount(); index++) { CItem item = EW_GetItemData(index); if (item.dConfig.bDisplayInterface && item.bClient) { 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++) { if (!IsClientInGame(client) || IsClientSourceTV(client) || IsFakeClient(client)) continue; int iTeamLine; if ((iTeamLine = GetClientTeam(client) - 2) < 0) { int spectatingClient; if ((spectatingClient = Client_GetObserverTarget(client)) < 0) continue; if ((iTeamLine = GetClientTeam(spectatingClient) - 2) < 0) continue; } if (sTeamLines[iTeamLine][0]) { Handle hMessage = StartMessageOne("KeyHintText", client); BfWriteByte(hMessage, 1); BfWriteString(hMessage, sTeamLines[iTeamLine]); EndMessage(); } } } }