View Single Post
  #4  
Old 09-18-2010, 12:43 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Please, please, please don't do this.
PHP Code:
this.join("level_link");
this.6;
this.1;
//#CLIENTSIDE
this.6;
this.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.6;
  
this.1;
}
//#CLIENTSIDE
function onCreated() {
  
this.6;
  
this.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(cmddata) {
  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.xlink.width|) || ! (player.y in |link.ylink.height|)) {
      return; 
// this might need some tweaking
    
}
    
    
player.setLevel2(link.lvllink.warpxlink.warpy;
  }
}

//#CLIENTSIDE
function onTouchLevelLink(link) {
  
// it's preferable to pass data as parameters rather than client. variables
  
triggerServer("gui"this.name"warp", {link.xlink.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.
__________________
Reply With Quote