Raised This Month: $ Target: $400
 0% 

New API and Syntax


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-29-2015 , 23:56   Re: New API and Syntax
Reply With Quote #11

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 ?
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode