I've got the following setup
tc is an array of objects. Each object has a num property.
cc is another array defined earlyer as
cc = [0,0,0,0,0,0,0];
with a length == the max tc[x].num value
Code: Select all
for (var x = 0; x < tc.length; x ++)
{
cc [tc [x].num] ++;
}
I've tested and find out that the folowing code works ok. I hope it's incrementing the value as I haven't tested it throughlySFS Console says
+---------------------[ Zones & Rooms ]----------------------+
DB Manager Activated ( org.gjt.mm.mysql.Driver )
Zone: TexasHoldemUp
Saloon (id: 1, max: 4000, pass:N)
Ch Room One (id: 2, max: 12, pass:N)
Exception in thread "SmartFoxServer" java.lang.VerifyError: (class: org/mozilla/
javascript/gen/c1, method: _c84 signature: (Lorg/mozilla/javascript/gen/c1;Lorg/
mozilla/javascript/Context;Lorg/mozilla/javascript/Scriptable;Lorg/mozilla/javas
cript/Scriptable;Ljava/lang/Object;D[Ljava/lang/Object;)Ljava/lang/Object;)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mozilla.javascript.optimizer.Codegen.createScriptObject(Codegen.j
ava:81)
at org.mozilla.javascript.Context.compileImpl(Context.java:2232)
at org.mozilla.javascript.Context.compileReader(Context.java:1246)
at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.loadScri
pt(JavascriptExtension.java:303)
at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.setScrip
tFile(JavascriptExtension.java:107)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.loadExtens
ion(ExtensionHandler.java:129)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.createExte
nsion(ExtensionHandler.java:166)
at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.parse_Exte
nsions(ExtensionHandler.java:620)
at it.gotoandplay.smartfoxserver.SmartFoxServer.setupZone(SmartFoxServer
.java:1756)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.parse_Zones(ConfigRead
er.java:584)
at it.gotoandplay.smartfoxserver.lib.ConfigReader.readZoneConfig(ConfigR
eader.java:284)
at it.gotoandplay.smartfoxserver.SmartFoxServer.initServerSocket(SmartFo
xServer.java:309)
at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
558)
Code: Select all
for (var x = 0; x < tc.length; x ++)
{
cc [tc [x].num] = cc [tc [x].num] +1;
}