Ulysses
General => Developers Corner => Topic started by: iViscosity on May 09, 2016, 02:34:57 PM
-
Hey guys, so I'm trying to make a script for a TTT server that I'm staff on, and what I want it to do is when I press "I" it will slap the target I'm looking at and then in the chat "Are you afk?", as a "check afk" script. What I have now is this (and I don't know if I'm doing this right, should it be in a hook or a function?):
hook.Add( "Tick", "CheckAFK", function()
local ply = LocalPlayer()
local trace = util.GetPlayerTrace( ply )
local traceRes = util.TraceLine( trace )
if traceRes.HitNonWorld then
local target = traceRes.Entity
if target:IsPlayer() then
if ply:input.WasKeyPressed( I ) then
end
end
end
end)
I don't know if this is right or not, and if it is, how do I continue it?
(If you need any clarification, just ask :) )
-
You don't need Lua for this.
Bind I "ulx slap @;say are you AFK?"
-
Oh... So the @ makes it the target player?
-
That is correct. :)
There are a couple modifiers you should know:
^ yourself
* everyone
@ your target
-
Ah I didn't know about @ thanks. :)