View Single Post
  #12  
Old 09-03-2012, 03:44 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by ffcmike View Post
While that would be fine for a weapon script, there is no 'this.name' within a local NPC on Clientside. You can however store it as an attr Serverside. The first parameter should also be 'npc' rather than 'gui'.

PHP Code:
function onCreated(){
  
this.attr[1] = this.name;
}
//#CLIENTSIDE
function sendTrigger(){
  
triggerserver("npc"this.attr[1], mousexmousey);

I was using it in a Weapon Script. I was just showing how I was placing them.. now oddly. I can drag the npc.. it changes the chat above the npc.. but its not sending the right cords or something.. every time i move it it says the same x/y...

PHP Code:
function onActionServerside(commandnxny) {
  if ( 
command == "move" ) {
    
nx;
    
ny;
    
chat "moved" SPC nx SPC ny;
  }
}


//#CLIENTSIDE
function onCreated() {
  
this.catchEvent(GraalControl"onMouseDragged""onMouseDragged");
  
setshape(1getimgwidth(this.image), getimgheight(this.image));
  
this.oox this.x;
  
this.ooy this.y;
}

function 
onMouseDown() {
  if ( 
mousex in |x,x+getimgwidth(this.image)/16| && mousey in |y,y+getimgheight(this.image)/16| ) {
    
this.ox mousex x;
    
this.oy mousey y;
    
this.candrag true;
  }
}

function 
onMouseUp() {
  if ( 
this.candrag == true ) {
    
this.candrag fasle;
    
triggeraction(this.oox .5this.ooy +.5"Serverside""move"this.nnxthis.nny);
  }
}

function 
onMouseDragged(objmodmxmy) {
  if ( 
this.candrag == true ) {
    
mousex this.ox;
    
mousey this.oy;
    
this.nnx mousex this.ox;
    
this.nny mousey this.oy;
  }

First time it's moved it fine after that it breaks.
Reply With Quote