entWatch4: Add native, and comment old code.

This commit is contained in:
zaCade 2019-03-28 16:01:39 +01:00
parent c0c6dd3179
commit e43d77b477
4 changed files with 36 additions and 18 deletions

View File

@ -52,6 +52,7 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int erro
g_bLate = bLate; g_bLate = bLate;
CreateNative("EW_GetItemCount", Native_GetItemCount); CreateNative("EW_GetItemCount", Native_GetItemCount);
CreateNative("EW_GetItemData", Native_GetItemData);
RegPluginLibrary("entWatch-core"); RegPluginLibrary("entWatch-core");
return APLRes_Success; return APLRes_Success;
@ -616,4 +617,19 @@ public Action OnWeaponTouch(int client, int weapon)
public int Native_GetItemCount(Handle hPlugin, int numParams) public int Native_GetItemCount(Handle hPlugin, int numParams)
{ {
return g_hArray_Items.Length; return g_hArray_Items.Length;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int Native_GetItemData(Handle hPlugin, int numParams)
{
int index = GetNativeCell(1);
if ((index < 0) || (index > g_hArray_Items.Length))
{
return ThrowNativeError(SP_ERROR_INDEX, "Item index %d is invalid.", index);
}
return view_as<int>(g_hArray_Items.Get(index));
} }

View File

@ -28,7 +28,7 @@ public Plugin myinfo =
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnGameFrame() public void OnGameFrame()
{ {
if (EW_GetItemCount()) /* if (EW_GetItemCount())
{ {
char sHUDFormat[250]; char sHUDFormat[250];
char sHUDBuffer[64]; char sHUDBuffer[64];
@ -114,5 +114,5 @@ public void OnGameFrame()
BfWriteByte(hMessage, 1); BfWriteByte(hMessage, 1);
BfWriteString(hMessage, sHUDFormat); BfWriteString(hMessage, sHUDFormat);
EndMessage(); EndMessage();
} }*/
} }

View File

@ -13,7 +13,7 @@
#include <sourcemod> #include <sourcemod>
#include <entWatch_core> #include <entWatch_core>
#define MESSAGEFORMAT "\x07%s[entWatch] \x07%s%s \x07%s(\x07%s%s\x07%s) %t \x07%s%s" //#define MESSAGEFORMAT "\x07%s[entWatch] \x07%s%s \x07%s(\x07%s%s\x07%s) %t \x07%s%s"
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -37,9 +37,9 @@ public void OnPluginStart()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void EW_OnClientItemDrop(any[] itemArray, int client, int index) public void EW_OnClientItemDrop(int client, int index)
{ {
if (itemArray[item_display] & DISPLAY_CHAT) /* if (itemArray[item_display] & DISPLAY_CHAT)
{ {
char sName[32]; char sName[32];
GetClientName(client, sName, sizeof(sName)); GetClientName(client, sName, sizeof(sName));
@ -49,15 +49,15 @@ public void EW_OnClientItemDrop(any[] itemArray, int client, int index)
CRemoveTags(sName, sizeof(sName)); CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "E562BA", "B2B2B2", sAuth, "E562BA", "Item Drop", itemArray[item_color], itemArray[item_name]); CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "E562BA", "B2B2B2", sAuth, "E562BA", "Item Drop", itemArray[item_color], itemArray[item_name]);
} }*/
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void EW_OnClientItemDeath(any[] itemArray, int client, int index) public void EW_OnClientItemDeath(int client, int index)
{ {
if (itemArray[item_display] & DISPLAY_CHAT) /* if (itemArray[item_display] & DISPLAY_CHAT)
{ {
char sName[32]; char sName[32];
GetClientName(client, sName, sizeof(sName)); GetClientName(client, sName, sizeof(sName));
@ -67,15 +67,15 @@ public void EW_OnClientItemDeath(any[] itemArray, int client, int index)
CRemoveTags(sName, sizeof(sName)); CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Death", itemArray[item_color], itemArray[item_name]); CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Death", itemArray[item_color], itemArray[item_name]);
} }*/
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void EW_OnClientItemPickup(any[] itemArray, int client, int index) public void EW_OnClientItemPickup(int client, int index)
{ {
if (itemArray[item_display] & DISPLAY_CHAT) /* if (itemArray[item_display] & DISPLAY_CHAT)
{ {
char sName[32]; char sName[32];
GetClientName(client, sName, sizeof(sName)); GetClientName(client, sName, sizeof(sName));
@ -85,15 +85,15 @@ public void EW_OnClientItemPickup(any[] itemArray, int client, int index)
CRemoveTags(sName, sizeof(sName)); CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "C9EF66", "B2B2B2", sAuth, "C9EF66", "Item Pickup", itemArray[item_color], itemArray[item_name]); CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "C9EF66", "B2B2B2", sAuth, "C9EF66", "Item Pickup", itemArray[item_color], itemArray[item_name]);
} }*/
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void EW_OnClientItemDisconnect(any[] itemArray, int client, int index) public void EW_OnClientItemDisconnect(int client, int index)
{ {
if (itemArray[item_display] & DISPLAY_CHAT) /* if (itemArray[item_display] & DISPLAY_CHAT)
{ {
char sName[32]; char sName[32];
GetClientName(client, sName, sizeof(sName)); GetClientName(client, sName, sizeof(sName));
@ -103,15 +103,15 @@ public void EW_OnClientItemDisconnect(any[] itemArray, int client, int index)
CRemoveTags(sName, sizeof(sName)); CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Disconnect", itemArray[item_color], itemArray[item_name]); CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Disconnect", itemArray[item_color], itemArray[item_name]);
} }*/
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void EW_OnClientItemActivate(any[] itemArray, int client, int index) public void EW_OnClientItemActivate(int client, int index)
{ {
if (itemArray[item_display] & DISPLAY_USE) /* if (itemArray[item_display] & DISPLAY_USE)
{ {
char sName[32]; char sName[32];
GetClientName(client, sName, sizeof(sName)); GetClientName(client, sName, sizeof(sName));
@ -121,5 +121,5 @@ public void EW_OnClientItemActivate(any[] itemArray, int client, int index)
CRemoveTags(sName, sizeof(sName)); CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "67ADDF", "B2B2B2", sAuth, "67ADDF", "Item Activate", itemArray[item_color], itemArray[item_name]); CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "67ADDF", "B2B2B2", sAuth, "67ADDF", "Item Activate", itemArray[item_color], itemArray[item_name]);
} }*/
} }

View File

@ -41,6 +41,8 @@ public SharedPlugin __pl_entWatch_core =
native int EW_GetItemCount(); native int EW_GetItemCount();
native CItem EW_GetItemData(int index);
forward void EW_OnClientItemDrop(int client, int index); forward void EW_OnClientItemDrop(int client, int index);
forward void EW_OnClientItemDeath(int client, int index); forward void EW_OnClientItemDeath(int client, int index);
forward void EW_OnClientItemPickup(int client, int index); forward void EW_OnClientItemPickup(int client, int index);