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