Blockland Forums > Modification Help

Need help scripting.

Pages: << < (21/31) > >>

elm:

Try learning from this:


function serverCMDShootRayCast(%client)
{
   //Define the client's variables
   //--
   %player = %client.player;
   %name = %client.name;
   //--
   
   %eyeVector = %player.getEyeVector();
   %eyePoint = %player.getEyePoint();
   %range = 100;
   %rangeScale = VectorScale(%eyeVector, %range);
   %rangeEnd = VectorAdd(%eyePoint, %rangeScale);
   %raycast = containerRayCast(%eyePoint,%rangeEnd,$TypeMasks::PlayerObjectType, %player);
   %object = %raycast.getId();

   if(isObject(%object) && %object.getClassname() $= "Player")
   {
      //Define the player who we are looking at's variables
      //--
      %objectName = %object.client.name;
      %objectClient = %object.client;
      //--
     
      messageClient(%client,'',"\c2You are looking at "@%objectName@".");
      messageClient(%objectClient,'',"\c2"@%name@" is looking at you.");
   }
}

zefoo:


--- Quote from: elm on June 27, 2012, 08:12:32 PM ---
{
   if(isObject(%object) && %object.getClassname() $= "Player")
   {
      //Define the player who we are looking at's variables
      //--
      %objectName = %object.client.name;
      %objectClient = %object.client;
      //--
     
      messageClient(%client,'',"\c2You are looking at "@%objectName@".");
      messageClient(%objectClient,'',"\c2"@%name@" is looking at you.");
   }
}

--- End quote ---

And if i wanted to see if the object im looking at is not a player or not anything i would do this right?

--- Code: ---        if(!isObject(%object) && %object.getClassname() $= "Player")
        {
            
        }
--- End code ---


elm:

No, you should change the $TypeMasks type. Go into your console and type $Typemasks then hit Tab until you see what you want. Alternatively you can do $TypeMasks::All I believe, then configure the if statement to filter out anything you don't want.

zefoo:


--- Quote from: elm on June 27, 2012, 08:22:35 PM ---No, you should change the $TypeMasks type. Go into your console and type $Typemasks then hit Tab until you see what you want. Alternatively you can do $TypeMasks::All I believe, then configure the if statement to filter out anything you don't want.

--- End quote ---
Would this be the compare not equal sign?
$!

elm:


--- Quote from: zefoo on June 27, 2012, 08:24:47 PM ---Would this be the compare not equal sign?
$!

--- End quote ---

To compare strings:

$=
!$=

To compare anything else:

==
!=

Pages: << < (21/31) > >>

Go to full version