Gamemode: [url]http://www.garrysmod.org/downloads/?a=view&id=133166[/url]
I've tried this..
[code]
// 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
[/code]
..but with no results.
I have copied many codes from different threads on LP but I can't seem to find a working one.
I really need to get this going as I had a bunch of players but most of them were pissed off due to the fact they did not "go through" their teammates which resulted in many people blocking each others ways. I had to stop the server and now I am requesting help from you. Anything is appreciated.
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa58d.html[/url]
Unless they're on different teams, this should work.
That doesn't work.
Put it in the Player Spawn hook, there's no way it doesnt work unless you have them set on different teams.
It doesn't work no matter where I put it. Player spawn hook or whatever, it still doesn't work.
Paste the code and how you're doing it.
I have tried this:
[code]
function GM:PlayerSpawn( ply )
if ply:Team() == TEAM_SPECTATOR then
ply:Spectate(OBS_MODE_ROAMING)
return
end
function NoCollidePeople( teamID )
for _, ply in pairs( team.GetPlayers( teamID ) ) do
ply:SetNoCollideWithTeammates( true )
end
end
self.BaseClass:PlayerSpawn( ply )
ply:StripWeapons()
ply:SetHealth( 100 )
ply:SetArmor( 0 )
ply:SetJumpPower(200)
ply:SetWalkSpeed( ply:GetRunSpeed() )
if not table.HasValue(randomModels, ply:GetModel()) then ply:SetModel(table.Random(randomModels)) end
ply:Give( "weapon_crowbar" )
ply:SetColor( ply:Team() == 2 and Color( 255, 0, 0, 255 ) or Color( 255, 255, 255, 255 ) )
ply:SetPos( table.Random(ents.FindByClass( ply:Team() == TEAM_RUNNER and "info_player_counterterrorist" or "info_player_terrorist" )):GetPos() )
-- I somehow fucked up the spawning (or did it incorrectly), so I'll just go ahead and force spawnpoints.
end
[/code]
I have also tried this:
[code]
function GM:PlayerSpawn( ply )
if ply:Team() == TEAM_SPECTATOR then
ply:Spectate(OBS_MODE_ROAMING)
return
end
self.BaseClass:PlayerSpawn( ply )
ply:StripWeapons()
ply:SetHealth( 100 )
ply:SetArmor( 0 )
ply:SetJumpPower(200)
ply:SetWalkSpeed( ply:GetRunSpeed() )
if not table.HasValue(randomModels, ply:GetModel()) then ply:SetModel(table.Random(randomModels)) end
ply:Give( "weapon_crowbar" )
ply:SetColor( ply:Team() == 2 and Color( 255, 0, 0, 255 ) or Color( 255, 255, 255, 255 ) )
ply:SetPos( table.Random(ents.FindByClass( ply:Team() == TEAM_RUNNER and "info_player_counterterrorist" or "info_player_terrorist" )):GetPos() )
-- I somehow fucked up the spawning (or did it incorrectly), so I'll just go ahead and force spawnpoints.
end
function NoCollidePeople( teamID )
for _, ply in pairs( team.GetPlayers( teamID ) ) do
ply:SetNoCollideWithTeammates( true )
end
end
[/code]
I am dumb when it comes to Lua I know and I have been rated so every single time, but that is how I understood your "Put it in the Player Spawn hook".
You rarely ever put a function inside of a function. since it's already in player spawn, its going to be called on every player spawn, so you don't need to select every player.
[lua]function GM:PlayerSpawn( ply )
if ply:Team() == TEAM_SPECTATOR then
ply:Spectate(OBS_MODE_ROAMING)
return
end
self.BaseClass:PlayerSpawn( ply )
ply:StripWeapons()
ply:SetHealth( 100 )
ply:SetArmor( 0 )
ply:SetJumpPower(200)
ply:SetWalkSpeed( ply:GetRunSpeed() )
if not table.HasValue(randomModels, ply:GetModel()) then ply:SetModel(table.Random(randomModels)) end
ply:Give( "weapon_crowbar" )
ply:SetNoCollideWithTeammates( true )
ply:SetColor( ply:Team() == 2 and Color( 255, 0, 0, 255 ) or Color( 255, 255, 255, 255 ) )
ply:SetPos( table.Random(ents.FindByClass( ply:Team() == TEAM_RUNNER and "info_player_counterterrorist" or "info_player_terrorist" )):GetPos() )
-- I somehow fucked up the spawning (or did it incorrectly), so I'll just go ahead and force spawnpoints.
end[/lua] try that.
It worked. Thank you Lerpaderp. Appreciate your help! :D
Sorry, you need to Log In to post a reply to this thread.