Please, please,
please don't do this.
PHP Code:
this.join("level_link");
this.w = 6;
this.h = 1;
//#CLIENTSIDE
this.w = 6;
this.h = 1;
this.lvl = "level name it links to.nw";
this.lvlx = 24;
this.lvly = 1;
This is so much nicer and far preferable:
PHP Code:
function onCreated() {
this.join("level_link");
this.w = 6;
this.h = 1;
}
//#CLIENTSIDE
function onCreated() {
this.w = 6;
this.h = 1;
this.lvl = "level name it links to.nw";
this.lvlx = 24;
this.lvly = 1;
}
Also, your weapon script is
extremely insecure. If that script is in use, I could easily warp to any level on Ruins with Cheat Engine. Heck, it's less secure than traditional links. The server should never accept data from the client (such as a level name).
I would probably do it like so (unimportant parts omitted):
PHP Code:
// link class
function onCreated() {
// establish a way to refer to it via coordinates serverside
this.level.link.(@ this.x @ "_" @ this.y) = this;
}
//#CLIENTSIDE
function onPlayerTouchsMe() {
// setup the x,y so the server can find the link
interfaceVisuals.trigger("touchLevelLink", this);
}
and in the link weapon (fading bits omitted):
PHP Code:
function onActionServerSide(cmd, data) {
if (cmd == "warp") {
// find the relevant link
temp.link = player.level.link.(@ data[0] @ "_" @ data[1]);
if (link.lvl == null) {
// level not defined
return;
}
// check if the player's x/y are in the link
if (! (player.x in |link.x, link.x + width|) || ! (player.y in |link.y, link.y + height|)) {
return; // this might need some tweaking
}
player.setLevel2(link.lvl, link.warpx, link.warpy;
}
}
//#CLIENTSIDE
function onTouchLevelLink(link) {
// it's preferable to pass data as parameters rather than client. variables
triggerServer("gui", this.name, "warp", {link.x, link.y});
}
Since the level data would be stored serverside instead of clientside there's no chance that the client can manipulate them to warp to any level except the level you've defined.