Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo = {
name = "",
author = "",
description = "",
version = ""
};
enum Struct {
ArrayList:arrTest,
};
Struct g_ArrTest[Struct];
public void OnPluginStart() {
AddCommandListener(CommandListener_Callback, "test");
if (g_ArrTest[arrTest] == null) {
g_ArrTest[arrTest] = new ArrayList(1);
}
g_ArrTest[arrTest].Clear();
}
public void OnPluginEnd() {
if (g_ArrTest[arrTest] != null) {
delete g_ArrTest[arrTest];
g_ArrTest[arrTest] = null;
}
}
public Action CommandListener_Callback(int client, const char [] command, int argc) {
if (!IsPlayerAlive(client))
return Plugin_Handled;
static int iTimes = 0;
iTimes++;
PrintToServer("0x%x", g_ArrTest[arrTest]);
if (g_ArrTest[arrTest] != null) {
g_ArrTest[arrTest].Push(iTimes);
for (int x = 0; x < g_ArrTest[arrTest].Length; x++) {
PrintToServer("iTimes is \"%d\"", g_ArrTest[arrTest].Get(x));
}
PrintToServer("======================End of loop======================\n");
}
return Plugin_Handled;
}
handle 0x10000f
Error:
Code:
L 06/30/2015 - 11:32:54: [SM] Native "ArrayList.Get" reported: Invalid Handle 0 (error: 4)
L 06/30/2015 - 11:32:54: [SM] Displaying call stack trace for plugin "test.smx":
L 06/30/2015 - 11:32:54: [SM] [0] Line 51, test.sp::CommandListener_Callback()
Is it a bug ?
__________________