updates for entwatch to work
This commit is contained in:
parent
e00352d8a0
commit
58b91973c1
@ -526,25 +526,26 @@ public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnWeaponPickup(int client, int weapon)
|
||||
{
|
||||
if (Client_IsValid(client) && Entity_IsValid(weapon) && g_hArray_Items.Length)
|
||||
{
|
||||
for (int index; index < g_hArray_Items.Length; index++)
|
||||
{
|
||||
CItem item = g_hArray_Items.Get(index);
|
||||
if (Client_IsValid(client) && Entity_IsValid(weapon) && g_hArray_Items.Length)
|
||||
{
|
||||
for (int index; index < g_hArray_Items.Length; index++)
|
||||
{
|
||||
CItem item = g_hArray_Items.Get(index);
|
||||
|
||||
if (item.bWeapon && item.iWeapon == weapon)
|
||||
{
|
||||
item.iClient = client;
|
||||
if (item.bWeapon && item.iWeapon == weapon)
|
||||
{
|
||||
item.iClient = client;
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientItemPickup);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(index);
|
||||
Call_Finish();
|
||||
Call_StartForward(g_hFwd_OnClientItemPickup);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(index);
|
||||
Call_Finish();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -552,25 +553,26 @@ public Action OnWeaponPickup(int client, int weapon)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnWeaponDrop(int client, int weapon)
|
||||
{
|
||||
if (Client_IsValid(client) && Entity_IsValid(weapon) && g_hArray_Items.Length)
|
||||
{
|
||||
for (int index; index < g_hArray_Items.Length; index++)
|
||||
{
|
||||
CItem item = g_hArray_Items.Get(index);
|
||||
if (Client_IsValid(client) && Entity_IsValid(weapon) && g_hArray_Items.Length)
|
||||
{
|
||||
for (int index; index < g_hArray_Items.Length; index++)
|
||||
{
|
||||
CItem item = g_hArray_Items.Get(index);
|
||||
|
||||
if (item.bWeapon && item.iWeapon == weapon)
|
||||
{
|
||||
item.iClient = INVALID_ENT_REFERENCE;
|
||||
if (item.bWeapon && item.iWeapon == weapon)
|
||||
{
|
||||
item.iClient = INVALID_ENT_REFERENCE;
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientItemDrop);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(index);
|
||||
Call_Finish();
|
||||
Call_StartForward(g_hFwd_OnClientItemDrop);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(index);
|
||||
Call_Finish();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sdktools>
|
||||
#include <sourcemod>
|
||||
#include <clientprefs>
|
||||
#include <entWatch_core>
|
||||
@ -95,141 +96,142 @@ public Action Command_ToggleHUD(int client, int args)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnDisplayHUD(Handle timer)
|
||||
{
|
||||
int iHUDPages[3];
|
||||
char sHUDPanels[3][8][255]
|
||||
int iHUDPages[3];
|
||||
char sHUDPanels[3][8][255]
|
||||
|
||||
for (int index; index < EW_GetItemCount(); index++)
|
||||
{
|
||||
CItem item = EW_GetItemData(index);
|
||||
for (int index; index < EW_GetItemCount(); index++)
|
||||
{
|
||||
CItem item = EW_GetItemData(index);
|
||||
|
||||
if (item.bClient && item.dConfig.bDisplayInterface)
|
||||
{
|
||||
char sShort[32];
|
||||
item.dConfig.GetShort(sShort, sizeof(sShort));
|
||||
if (item.bClient && item.dConfig.bDisplayInterface)
|
||||
{
|
||||
char sShort[32];
|
||||
item.dConfig.GetShort(sShort, sizeof(sShort));
|
||||
|
||||
char sLine[96];
|
||||
switch(item.dConfig.iMode)
|
||||
{
|
||||
case MODE_COOLDOWN:
|
||||
{
|
||||
if (item.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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);
|
||||
}
|
||||
}
|
||||
char sLine[96];
|
||||
switch(item.dConfig.iMode)
|
||||
{
|
||||
case MODE_COOLDOWN:
|
||||
{
|
||||
if (item.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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.flTimeReady > GetEngineTime())
|
||||
{
|
||||
Format(sLine, sizeof(sLine), "%s [%d]: %N", sShort, RoundToCeil(item.flTimeReady - 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);
|
||||
}
|
||||
}
|
||||
|
||||
switch(GetClientTeam(item.iClient))
|
||||
{
|
||||
case(2):
|
||||
{
|
||||
if (strlen(sHUDPanels[1][iHUDPages[1]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[1]++;
|
||||
switch(GetClientTeam(item.iClient))
|
||||
{
|
||||
case(2):
|
||||
{
|
||||
if (strlen(sHUDPanels[1][iHUDPages[1]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[1]++;
|
||||
|
||||
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
case(3):
|
||||
{
|
||||
if (strlen(sHUDPanels[2][iHUDPages[2]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[2]++;
|
||||
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[1][iHUDPages[1]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
case(3):
|
||||
{
|
||||
if (strlen(sHUDPanels[2][iHUDPages[2]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[2]++;
|
||||
|
||||
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
}
|
||||
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[2][iHUDPages[2]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(sHUDPanels[0][iHUDPages[0]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[0]++;
|
||||
if (strlen(sHUDPanels[0][iHUDPages[0]]) + strlen(sLine) + 2 >= sizeof(sHUDPanels[][])) iHUDPages[0]++;
|
||||
|
||||
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
}
|
||||
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), sLine);
|
||||
StrCat(sHUDPanels[0][iHUDPages[0]], sizeof(sHUDPanels[][]), "\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int iPageUpdate;
|
||||
static int iPageCurrent[3];
|
||||
static int iPageUpdate;
|
||||
static int iPageCurrent[3];
|
||||
|
||||
if (iPageUpdate >= 5)
|
||||
{
|
||||
for (int iPageID; iPageID < 3; iPageID++)
|
||||
{
|
||||
if (iPageCurrent[iPageID] >= iHUDPages[iPageID])
|
||||
iPageCurrent[iPageID] = 0;
|
||||
else
|
||||
iPageCurrent[iPageID]++;
|
||||
}
|
||||
if (iPageUpdate >= 5)
|
||||
{
|
||||
for (int iPageID; iPageID < 3; iPageID++)
|
||||
{
|
||||
if (iPageCurrent[iPageID] >= iHUDPages[iPageID])
|
||||
iPageCurrent[iPageID] = 0;
|
||||
else
|
||||
iPageCurrent[iPageID]++;
|
||||
}
|
||||
|
||||
iPageUpdate = 0;
|
||||
}
|
||||
else
|
||||
iPageUpdate++;
|
||||
iPageUpdate = 0;
|
||||
}
|
||||
else
|
||||
iPageUpdate++;
|
||||
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (!IsClientInGame(client) || (IsFakeClient(client) && !IsClientSourceTV(client)) || g_bInterfaceHidden[client])
|
||||
continue;
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (!IsClientInGame(client) || (IsFakeClient(client) && !IsClientSourceTV(client)) || g_bInterfaceHidden[client])
|
||||
continue;
|
||||
|
||||
int iPanelID;
|
||||
switch(GetClientTeam(client))
|
||||
{
|
||||
case(2): iPanelID = 1;
|
||||
case(3): iPanelID = 2;
|
||||
}
|
||||
int iPanelID;
|
||||
switch(GetClientTeam(client))
|
||||
{
|
||||
case(2): iPanelID = 1;
|
||||
case(3): iPanelID = 2;
|
||||
}
|
||||
|
||||
if (sHUDPanels[iPanelID][iPageCurrent[iPanelID]][0])
|
||||
{
|
||||
Handle hMessage = StartMessageOne("KeyHintText", client);
|
||||
BfWriteByte(hMessage, 1);
|
||||
BfWriteString(hMessage, sHUDPanels[iPanelID][iPageCurrent[iPanelID]]);
|
||||
EndMessage();
|
||||
}
|
||||
}
|
||||
if (sHUDPanels[iPanelID][iPageCurrent[iPanelID]][0])
|
||||
{
|
||||
Handle hMessage = StartMessageOne("KeyHintText", client);
|
||||
BfWriteByte(hMessage, 1);
|
||||
BfWriteString(hMessage, sHUDPanels[iPanelID][iPageCurrent[iPanelID]]);
|
||||
EndMessage();
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -252,4 +254,4 @@ stock bool GetClientCookieBool(int client, Handle hCookie)
|
||||
GetClientCookie(client, hCookie, sValue, sizeof(sValue));
|
||||
|
||||
return view_as<bool>(StringToInt(sValue));
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sdktools>
|
||||
#include <sourcemod>
|
||||
#include <cstrike>
|
||||
#include <entWatch_core>
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sdktools>
|
||||
#include <sourcemod>
|
||||
#include <clientprefs>
|
||||
#include <entWatch_core>
|
||||
@ -512,4 +513,4 @@ stock int GetClientCookieInt(int client, Handle hCookie)
|
||||
GetClientCookie(client, hCookie, sValue, sizeof(sValue));
|
||||
|
||||
return StringToInt(sValue);
|
||||
}
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ methodmap Basic < StringMap
|
||||
this.SetValue(membername, value);
|
||||
}
|
||||
|
||||
public bool GetVector(const char[] membername, float[3] vector)
|
||||
public bool GetVector(const char[] membername, float vector[3])
|
||||
{
|
||||
return this.GetArray(membername, vector, sizeof(vector));
|
||||
}
|
||||
|
||||
public void SetVector(const char[] membername, const float[3] value)
|
||||
public void SetVector(const char[] membername, const float value[3])
|
||||
{
|
||||
this.SetArray(membername, value, sizeof(value));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user