• Checking if a player is dormant or not (LUA)
    7 replies, posted
Hi, long ago someone posted code that would return true/false if a player was dormant. Currently IsDormant doesnt work, and I cannot find any other way to get it to work. I know of modules such as [url]http://pastebin.com/mF5hN8LB[/url] but I wish to use pure lua, if possible.
dormant?
[QUOTE=AnonTakesOver;44856918]dormant?[/QUOTE] If a player is dormant it means they aren't being networked to you (pretty sure this only affects position).
[QUOTE=AnonTakesOver;44856918]dormant?[/QUOTE] If you ever wall hacked or had something that goes through the wall, notice how a player stops moving after x distance? It means they're dormant, its set this way by the engine. I wish to have a func that will return true or false on if they are or not.
Doesn't Visible( ) return whether or not they're in the PVS or not?
Ent.Visible is serverside and he wants this for his hax
[QUOTE=Acecool;44858325]Doesn't Visible( ) return whether or not they're in the PVS or not?[/QUOTE] visible =/= dormant. Different things. [QUOTE=DropDeadTed;44862139]Ent.Visible is serverside and he wants this for his hax[/QUOTE] Wish to try and eliminate lag client-side
[QUOTE=zerothefallen;44862403]visible =/= dormant. Different things. Wish to try and eliminate lag client-side[/QUOTE] Well, have you noticed that this hook gets called when an entity is no longer being updated on the client? :: EntityRemoved It was the source of one of my networking bugs because I ran the code shared for when an entity is removed it would remove the networked information -- when players left the area to the point you couldn't see them / they wouldn't update, it would call it and I'd lose their info; I had to make the system SERVER-side and network to the client when something is removed to "fix" it. I haven't tried OnEntityCreated to see if it is fired when it comes back into view; but I'd imagine it would because it calls EntityRemoved when out of the area... You could create a simple system which takes advantage of that: [lua]// CLIENT-side... // local META_ENTITY = FindMetaTable( "Entity" ); // // // function META_ENTITY:IsDormant( ) return self.__Dormant || false; end // // // hook.Add( "EntityRemoved", function( _ent ) _ent.__Dormant = true; end ); // // // hook.Add( "OnEntityCreated", function( _ent ) _ent.__Dormant = false; end );[/lua]
Sorry, you need to Log In to post a reply to this thread.