Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   class onActionServerside? (https://forums.graalonline.com/forums/showthread.php?t=134264586)

gaben 09-18-2011 09:23 PM

class onActionServerside?
 
I've made a 'block' script, but I want to set the head of the player as the block so I've been trying out unique ways thus far and this is the way that I've came up with that ought to work. Basically, if I can set temp.stringhead as player.head it ought to get the player's head however I cannot use temp.head serverside and I don't think onActionServerside works either.

PHP Code:

function onCreated(){
  
setHead(temp.stringhead);
}

// don't use this.head, it refers to the object outside of scope

function setHead(temp.head){
  
setimgpart(temp.head0643232);
  
setshape(13232);
  
this.allowed = {"Graal788446"};
}

function 
onActionGrab(){
  if (
player.account in this.allowed && player.chat != NULL){
    
this.OldChat player.chat;
    
this.chat player.chat;
    
this.account player.communityname
  } else if(
this.account != NULL){
    
this.chat "(" "placed by " this.account ")";
    
sleep(3);
    
this.chat this.OldChat;


}

function 
onActionDestroy(){
  if (
player.account in this.allowed){
    
destroy();
  }
}

//#CLIENTSIDE

function onCreated(){
  
temp.stringhead player.head;


this class is really only activated when they try to 'place' a block, so it ought to just get the player.head of the placer

fowlplay4 09-18-2011 09:31 PM

In your block layer I imagine you have some sort of code like this:

PHP Code:

function onActionServerSide() {
  if (
params[0] == "createblock") {
    
temp.block putnpc2(params[1], params[2], "");
    
temp.block.headblock player.head;
    
temp.block.join("your_block_class");
  }


Then in your class you can use this.headblock as your image name.

gaben 09-18-2011 09:32 PM

Thanks FP4! +rep

Edit: Too much rep given to FP4 within a short timespan!


All times are GMT +2. The time now is 10:40 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.