I've tried adding prop protection but the following code doesn't work:
[CODE]
function GM:PlayerSpawnedProp(pl, mdl, ent)
if pl:IsValid() && ent:IsValid() then
ent:SetNetworkedEntity("Owner", pl)
end
end
function GM:ShouldCollide(ent1, ent2)
if ent1:IsPlayer() && ent2:GetNetworkedEntity("Owner") != ent1 then
return false
end
end
[/CODE]
It doesn't do anything; no errors, no, no collision etc.
What is not working? Error? Console output? Be more descriptive.
There aren't any errors, sorry. Nothing happens basically.
Were are you calling this? init.lua most probably?
pp.lua which is included in init.lua.
[CODE]
hook.Add("PlayerSpawnedProp", "PropSpawned", function( ply, mdl, ent)
if(ply:IsValid())then
ent:SetNetworkedEntity('Owner', ply)
end
end)
hook.Add("ShouldCollide", "PropPlyCollided", function( ent_1, ent_2 )
if(ent_1:IsPlayer())and(!ent_2:IsPlayer())and(!ent_2:GetNetworkedEntity('Owner')==ent_1) or (!ent_1:IsPlayer())and(ent_2:IsPlayer())and(!ent_1:GetNetworkedEntity('Owner')==ent_2)then
return false
end
return true
end)
[/CODE]
still does nothing :|
Are you using sandbox?
If you mean am I using DeriveGamemode("sandbox") then yes.
/gamemodes/base/gamemode/shared.lua
[CODE]
function GM:ShouldCollide( Ent1, Ent2 )
return true
end
[/CODE]
Edit that xD, I am at a complete block at why this won't be called outside of base.
:| Need it to work on Gmod's workshop...
Bump
The ShouldCollide hook is very glitchy. It only predicts when a collision will happen (and frankly isn't very good), not when an actual collision is being made.
Why do you not want the owner of the prop to collide with it anyways?
I want it so people who aren't owners can't collide. I used != not ==. Are there any other alternatives?
Sorry, you need to Log In to post a reply to this thread.