Is there anyway to disable people from being able to see trails? I want to make only people on the same team as the owner of the entity able to see the trail. The trail is created using this function and it is an entity. I just need to know the function to hide the entity. Thanks
[b][url=http://wiki.garrysmod.com/?title=Entity.Visible]Entity.Visible [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Bump
Shot in the dark but could you not change the trail alpha to 0?
Not quite sure how you would go about this, but it seems to be a possible workaround
So instead of turning them off just make them invisible, If you cant edit the alpha of a trail change its length to 0 maybe?
Ive never tried this and its just a theory
Sounds like a good idea, I will try it now.
EDIT
Ok, well I keep getting an error and I don't know how to fix it."autorun\client\cl_init.lua:84: Tried to use a NULL entity!"
Before I send the usermessage the value "Index" is printed correctly, but when I usermessage and read this value it is nil clientside. Any ideas?
Serverside
[lua]
local Index = trail_entity:EntIndex()
local RP = RecipientFilter()
for k,v in pairs(player.GetAll()) do
-- if not v:Team() == ply:Team() then
RP:AddPlayer(v)
-- end
end
umsg.Start("CheckTrails", RP)
umsg.Short(Index)
umsg.End()
ply:ChatPrint("Changed trail Index is " .. Index)
[/lua]
Clientside
[lua]
usermessage.Hook("CheckTrails", function(um)
local Index = um:ReadShort()
Entity(Index):SetColor(Color(0,0,0,0))
Msg(Index)
end)
[/lua]
[lua]local Index = trail_entity:EntIndex()[/lua]
It looks like this isn't being set correctly.
[QUOTE=TommieBoy;23991316][lua]local Index = trail_entity:EntIndex()[/lua]
It looks like this isn't being set correctly.[/QUOTE]
When I ChatPrint that I get a number though, so that is working. It's just that when I send the usermessage to the client, they don't get the value.
This is my console output when I run the command "usetrail", "2"
[code]
Changed trail Index is 112
autorun\client\cl_init.lua:84: Tried to use a NULL entity!
[/code]
Oh sorry I didn't read all of it.
I don't see any errors.
[editline]07:04PM[/editline]
Sorry I don't see anything wrong with your code.
A similar thing happened the other day, is there anything else that could cause this? Do I have to "Require" user messages or anything? Thanks
Are you adding the entities correctly clientside?
Well I am using a pre-made function util.SpriteTrail() and I can see the trail clientside, it acts normally and I get no errors so I think so, but even if I didn't I should be getting a value from the user message. If I print the value of the Short I get nil so the user message isn't working. :S
Sorry, you need to Log In to post a reply to this thread.