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
+16
View File
@@ -52,6 +52,7 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int erro
g_bLate = bLate;
CreateNative("EW_GetItemCount", Native_GetItemCount);
CreateNative("EW_GetItemData", Native_GetItemData);
RegPluginLibrary("entWatch-core");
return APLRes_Success;
@@ -616,4 +617,19 @@ public Action OnWeaponTouch(int client, int weapon)
public int Native_GetItemCount(Handle hPlugin, int numParams)
{
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));
}