Jump to content

Frozen koordinates in '


Koregan

Recommended Posts

I am programming for our server a custom-charactername-displaying-mod.

 

So i use 'player=getOnlinePlayers():get(i)' to get the players which could eventually be seen by the users character, and i use 'ownplayer:CanSee(player)' to check if they can be seen, or if they are hidden by some walls for example.

 

As i noticed while testing it on our running RP-server, there are not all connected players listed in the 'getOnlinePlayers()'-table. I think that just the players in a certain distance are in this table. I dont know if this is how it is supposed to be, but this is not the problem why i started this topic.

 

But I found a huge problem (at first only) with admin-characters on my local server:

If the admin-character is visible, then he can be seen by users with 'ownplayer:CanSee(player)' (ownplayer is user, player is admin in this cause).

With 'player:getCurrentSquare():getX()' / ~Y / ~Z his koordinates are correctly refreshed.

 

But as soon as he turns to invisible, ':CanSee(player)' stays true and also the Koordinates do not change again (until the admin is visible again). Even when the admin relogs to the server, the last position-coordinated where he was seen visible appear back.

 

In my mod this results in the admins name still being displayed above the admins last visible position.

Always when the player can see this square, and the admin is online, the name is displayed on screen above the square.

 

While testing the mod as admin on our RP-server, the same problems appeared with some players i was spying (myself being invisible). I lost them first and walked around to find them again, then on a streets corner the names of the players appeared on the screen.

The coordinates were frozen (did not change) until i was near enough to them again.

Then the names were displayed on the right position again.

 

Has anyone some ideas how i could fix this problem?

Or is it a bug in general? (The non changing player-positions of invisible persons and 'cansee' staying true?)

 

I already thought about checking the time the player-ccordinates didn't change and not display the names after a while.

But if a player stands on the same place a longer time (f.ex. while reading a book, the user being afk, etc.) then the names would also be not displayed any more, even the character really stands on this position.

 

This is one of the points where i hate programming.

It is nearly finished, but there are some tiny but annoying bugs, why i don't want to release it yet.

 

(If some more code is needed, i will post some parts of it. But because of the complex structure and own variables just copying some lines without commenting them doesn't help a lot, because it is a general problem and not because of mistakes in the script.)

 

It would be nice to get some help here...

 

 

[Edit: Could any moderator rename the title in:

'Cansee(player)' / Frozen koordinates in 'getOnlinePlayers()'

(I wanted to press backspace but also hit enter while typing the title. Sorry)

Link to comment
Share on other sites

Okay, in the meanwhile i continued trying to get the error away.

 

Now after including another check 'if player:getCurrentSquare() then ...' i could handle the error.

getCurrentSquare is nil, while the coordinates still exist and cansee is true.

 

I will close this topic in some days, if i do not get this errors back.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...