Thread: Script Help.
View Single Post
  #4  
Old 03-05-2015, 09:18 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko is a jewel in the roughKirko is a jewel in the rough
What am I doing wrong in this script? I can't get it to do a triggerserver in it so I can destroy once player gets it.

This is the class im using and also the weapon.
PHP Code:
// Created by *Kirko (Graal1341684)
function onCreated() {
  
showcharacter();
  
this.head = "head0.png";
  
this.body = "body.png";
  
this.colors[0] = "orange";
  
this.colors[1] = "white";
  
this.colors[2] = "blue";
  
this.colors[3] = "red";
  
this.colors[4] = "black";
  
this.shield = "no-shield.png";
  
this.dir = 2;
  
this.ani = "idle";
}

function 
onActionServerSide(){
  switch(
params[0]){
    case 
"picked":
      
this.chat = "got picked up";
      break;
  }
}

//#CLIENTSIDE
function onCreated(){
  
dontblock();
  
drawunderplayer();
  
this.zoom = .5;
  
this.noobnpc = 1;
}

public function 
GetPickedUp(){
  
triggerserver("weapon", this.name, "picked");
}

public function 
test(){
  
this.chat = "im it";
  
sleep(2);
  
this.chat = "";
  
//this.destroy();
} 
below is part of the weapon
PHP Code:
function findnpcs(){
  
temp.startx = player.x + 1.0 + vecx(player.dir) * 2;
  
temp.starty = player.y + 1.0 + vecy(player.dir) * 2;

  
temp.npcs = findareanpcs(temp.startx,temp.starty,1,1);
  for (
temp.npc: temp.npcs){
    if(
temp.npc.noobnpc == 1){
      
player.chat = "I found npc..";
      
//temp.npc.chat = "hello";
      
temp.npc.test();
      
temp.npc.GetPickedUp();
    }
  }
} 
the temp.npc.test(); works fine but not temp.npc.GetPickedUp();
Reply With Quote