Hey, I'm working on a prop protection for my flood server. I tried to write a code, but it won't work. There are no errors, just it doesn't do what it's intended to do. Here is the code.
[code]
function GM:Move(ply)
if tr.Entity:IsValid() then
if tr.Entity:GetNetworkedEntity("Owner") == ply || table.HasValue(tr.Entity:GetNetworkedEntity("Owner").Friends, string.Replace(ply:SteamID(),":","_")) then
--Do nothing.
else
ply:SetVelocity(ply:GetForward() * 100 + Vector(0, 500, 500)
end
end
end
[/code]
Pretty much what I am trying to do is, if a player isn't on someones prop protection to push the player off the prop. Is there something that I am missing? I appreciate any help that you give, just please give some useful information. THANK YOU!
[lua]ply:SetVelocity(ply:GetForward() * 100 + Vector(0, 500, 500))[/lua]
you missed an ')'! :)
tr is nil
[lua]function GM:Move(ply)
local tr = ply:GetEyeTrace()
if tr.Entity:IsValid() then
if tr.Entity:GetNetworkedEntity("Owner") == ply || table.HasValue(tr.Entity:GetNetworkedEntity("Owner").Friends, string.Replace(ply:SteamID(),":","_")) then
--Do nothing.
else
ply:SetVelocity(ply:GetForward() * 100 + Vector(0, 500, 500))
end
end
end[/lua]
Oh i get it now,
[b][url=http://wiki.garrysmod.com/?title=Entity.GetGroundEntity]Entity.GetGroundEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Sorry, you need to Log In to post a reply to this thread.