PDA

View Full Version : Passing parameters to login event handler



piffa
02-02-2005, 04:01 PM
Hi Jobe,

we're still waiting the details from you on how to pass parameters to the login event handler, modified in ES version 3.6.7(see http://www.electro-server.com/forum/?f=2&m=1524).

Furthermore only the Mx 2004 version of ElectroServerAS3.as has been modified to support the new functionality, while we need to use the other one.
We tried to make the modification by ourself, but unsuccessfully... :sad:

Here the modifies as1 class:
function login(tempUsername, tempPassword, variables) {
username = tempUsername;
if (username == undefined || username == null) {
username = "";
}
if (tempPassword == undefined) {
password = "";
} else {
password = tempPassword;
}
var action = "Login";
var parameters = "<Name>"+username+"</Name>"+password+"</Password>";
if (variables != undefined) {
parameters += "<EventHandlerVariables>";
for (var i in variables) {
parameters += "<EventHandlerVariable>";
parameters += "<Name>"+i+"</Name>";
parameters += "<Data>"+variables[i]+"</Data>";
parameters += "</EventHandlerVariable>";
}
parameters += "</EventHandlerVariables>";
}
this.send(action, parameters);
}

...and this is the script we use to call the login:
_root.pass = "";
var ob_login = new Object();
ob_login.sid = _root.sid;
ob_login.cid = _root.contestid;
ob_login.mpid = _root.mpid;
_root.es.login(_root.username, _root.pass, ob_login);

Thank you for yor help
Regards

Piffa