TeamNoCollide Not Working | Please Assist!

Background:

I’m am developing a deathrun server for the latest version of GMOD (13) and it seem’s that none of the the previous code for Team No Collide works with the gamemode. Here are some of the code I have tried



function NoCollidePeople( teamID )
    for _, ply in pairs( team.GetPlayers( teamID ) ) do
        ply:SetNoCollideWithTeammates( true )
    end
end




function GM:ShouldCollide( ent1, ent2 )

    if ent1:IsPlayer() and ent2:IsPlayer() then 
        return (ent1:Team() != ent2:Team())
    end

    return true

end


Resolved:

Still not resolved, if anyone could please help me with this problem that would be much appreciated!

This should probably be in the LUA section, located here: http://www.facepunch.com/forumdisplay.php?f=65

But, here is the solution.
[lua]// First, set custom collision checks on their initial spawn, we only have to set it once.
function GM:PlayerInitialSpawn(pl)
pl:SetCustomCollisionCheck( true )
end

// Next, we can run your function here
function GM:ShouldCollide( ent1, ent2 )
if ent1:IsPlayer() and ent2:IsPlayer() then
return (ent1:Team() != ent2:Team())
end

return true

end
[/lua]

Instead of making a function like “NoCollidePeople” just call “ply:SetNoCollideWithTeamMates( true )” in PlayerSpawn.

Edit: By the way, try avoiding the ShouldCollide hooks you should try to use collision hooks and setnocollidewithteammates instead.