Alright guys,
I want to add a timer to my game, to limit players to a set amount of time.
How should this be done server side?
As a room variable or server variable.
And how is the best way to do it?
Thanks.
Whats the best way to do "timers"
What if my interval never got cleared?
I get this error 2007/09/06 10:41:21.672 - [ WARNING ] [id: 46] (JavascriptExtension$IntervalExecutor.run): SetInterval Error: Wrapped java.lang.NullPointerException (gm_Test.as#230)
I restarted SFS through the admin tool but it still logs every second. I was trying to destroy a room this way:
The interval did not get cleared because there seemed to be a problem with var zone = _server.getCurrentZone() i think // should have done this in init?
So the log shows the error message every 5 secs. Is there a good way to kill intervals globally? Or can i restart smartfox fully through admin tool?
I am using smartfox remotely and do not have access to the batch file. How i restart smartfox is using admin tool. So if I click on Halt, I will need to wait for system admin to run it back again Any solutions?
I get this error 2007/09/06 10:41:21.672 - [ WARNING ] [id: 46] (JavascriptExtension$IntervalExecutor.run): SetInterval Error: Wrapped java.lang.NullPointerException (gm_Test.as#230)
I restarted SFS through the admin tool but it still logs every second. I was trying to destroy a room this way:
Code: Select all
if (evt.name == "userExit" || evt.name == "userLost") {
trace(evt.name);
// get the user id
var uId = evt["userId"];
// get the playerId of the user we have lost
// var oldPid = evt["oldPlayerIndex"];
var u = users[uId];
// Let's remove the player from the list
delete users[uId];
numPlayers--;
gameStarted = false;
if (numPlayers < 1) {
// destroy this room
trace("numPlayers: " + numPlayers);
clearInterval(countdown);
delete countdown;
destroyMe = setInterval("deleteMe", 5000); // this is line 230 in gm_Test.as
}
}
}
function deleteMe(){
var zone = _server.getCurrentZone();
var ok = _server.destroyRoom(zone, currentRoomId);
trace("Destroy room id: " + currentRoomId + " in Zone: " + zone.getName());
trace("Destroyed? : " + ok);
if(ok){
clearInterval(destroyMe);
}
}
The interval did not get cleared because there seemed to be a problem with var zone = _server.getCurrentZone() i think // should have done this in init?
So the log shows the error message every 5 secs. Is there a good way to kill intervals globally? Or can i restart smartfox fully through admin tool?
I am using smartfox remotely and do not have access to the batch file. How i restart smartfox is using admin tool. So if I click on Halt, I will need to wait for system admin to run it back again Any solutions?
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 35 guests