Posts: 313
Threads: 32
Joined: Feb 2012
Thanks: 98
Given 14 thank(s) in 13 post(s)
New bug (?) - OnPlayerMove hook is called even if player stand still. It's just equivalent to Tick(), except it has Player as an argument (so it's equivalent to ForEachPlayer, called inside ForEachWorld inside Tick())
Is it supposed to behave so? Because name's somewhat misleading then - I wasn't expecting this hook to be called when player not moves...
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
The hook is called whenever the client sends a PlayerMove packet. And I think the client moves the player all the time - if you switch on the debug screen (F3), you'll see that the coords keep changing even when the view seems to have stopped, in inrcrements of 0.000000001 etc. That might be the issue.
I'm not sure whether the server should be doing anything about that; I think your plugin should live with this - instead of checking for (non-)movement, why not check if the player has been inside the area for the specified amount of time?
Posts: 313
Threads: 32
Joined: Feb 2012
Thanks: 98
Given 14 thank(s) in 13 post(s)
I'm trying to make items teleportation right now. Looks like "delete at one place, create in another" is a good tactics.
However, I got a "noob" question: how do I know if given cEntity is actually cPickup?) (I assume ForEachEntityInChunk will cycle through all cEntity Descendants too, am I right about it?)
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
09-10-2012, 01:30 AM
(This post was last modified: 09-10-2012, 01:31 AM by FakeTruth.)
Use cEntity:IsA("cPickup") or cEntity:GetClass() and compare it with cPickup
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Even better: use cEntity:GetEntityType() and compare to eEntityType_Pickup. This is the most effective way.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
True, but those do not cover all entity classes
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
They cover enough. And I think we should make them cover everything - checking a string to see if a class is of a given type is a terrible way.