Author Topic: Can't find player position?  (Read 1319 times)

So I've been trying to make an autobridge script, but it can't find the client's player, shown in console.

Code:

package autobridgetick
{
   function bridgetick(%client, %position, %plantposition)
   {
      if ($bridging == 1)
      {
      schedule(32,0,bridgetick, %client, %Position, %PlantPosition);
      %Position = %client.player.getPosition();
      %PlantPosition = vectorSub(%Position,"0 0 1");
      bridgePlayer(%client,%position,%plantposition);
      }
   }
}; activatePackage(autobridgetick);

What's the error, if any? Post the full code and error log please.

Getposition isn't a function. Use .getTransform, the first three numbers returned by it are the coordinates.

Getwords(%player.gettransform(),0,2);

Getposition isn't a function.

Yeah it is, a default one even.

The problem probably isn't in this part of the code.

I also have an auto bridge script made by Truce a long time ago if you want that.

Yeah it is, a default one even.

The problem probably isn't in this part of the code.
Yay I'm an idiot

I also have an auto bridge script made by Truce a long time ago if you want that.
He's doing this for practice i bet. Said on my server he hadn't done anything particularly difficult scripting-wise and i told him to challenge himself.

Lol someone needs to write a tutorial on how to debug/use echos/errors, etc in their code.

BloxersPost, put an echo to see if %client is an actual client. There are multiple ways you can do this, that's the first step you need to take.

If the client is valid, then you will check if the player is valid. Once you know the player is valid, check that the position is returning correctly and voila you've debugged your own code and saved you a lot of time.


If the client is not valid, then there is something wrong with whatever is calling that function you have in the package and you need to debug there.

He's doing this for practice i bet. Said on my server he hadn't done anything particularly difficult scripting-wise and i told him to challenge himself.

Yeah, I've been thinking of what you told me for the past few days, and have been staying up until like 10 am coding.

Lol someone needs to write a tutorial on how to debug/use echos/errors, etc in their code.

BloxersPost, put an echo to see if %client is an actual client. There are multiple ways you can do this, that's the first step you need to take.

If the client is valid, then you will check if the player is valid. Once you know the player is valid, check that the position is returning correctly and voila you've debugged your own code and saved you a lot of time.

Thanks, that's a good idea. I knew how, I just didn't think of it lmao.