This repository has been archived by the owner on Apr 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Hookpoints: UpdateServer
D1G1T4L3CH0 edited this page Mar 5, 2015
·
2 revisions
This event is fired on every server update. This is about every 16ms. Use care when using this one since it could really make a large performance hit on the server if you have it doing a lot.
There is no object returned.
Lua
This demonstrates how you can find out the actions the player is performing in real time. Printing it to the console is not the best use though.
function YourPlugin:Initialized()
export.Hooks = {}
export.Hooks.UpdateServer=
{
Call = export.OnUpdateServer,
}
end
function YourPlugin:Enabled()
test.plyr = Tools.GetPlayerByName("PlayerName") -- This simply gets the player object for "PlayerName". I put it in Enabled() for the example, but you probably would want it elsewhere.
end
function YourPlugin:OnUpdateServer()
if test.plyr ~= nil then
if test.plyr.controlRight then
Tools.WriteLine("RIGHT")
elseif test.plyr.controlLeft then
Tools.WriteLine("LEFT")
elseif test.plyr.controlUp then
Tools.WriteLine("UP")
elseif test.plyr.controlDown then
Tools.WriteLine("DOWN")
end
end
end