• Help with nocolide
    11 replies, posted
Hi all. I am doing lua script for my gamemode. Help with nocolide players,i have lua script ,he is work,but bad (lags when 1 player touch 2 player). Code: function ShouldCollideHook( ply ) if ( ply:IsPlayer() and ply:IsPlayer() ) then return false end end hook.Add( "ShouldCollide", "ShouldCollideHook", ShouldCollideHook )
I'm pretty sure that hook has been broken for a while, I tried to use it about a month ago with no results.
How then can I do nocolide players?
[b][url=wiki.garrysmod.com/?title=Gamemode.ShouldCollide]Gamemode.ShouldCollide [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] has 2 arguments, Entity 1 and Entity 2. You are returning false if the first entity is a player and if the first entity is a player.
same
Your example nocollides the player with [b]everything[/b], you should add a second argument and change one ply:IsPlayer() to that argument name, like maybe ply2.
if (ply:IsPlayer() && ply2:IsPlayer()) then return false end I still think the hook is broken.
[QUOTE=Drew P. Richard;28547731] I still think the hook is broken.[/QUOTE] It's not broken, if you are referring to that props are sometimes bouncing up and down when using this hook, then thats caused by returning two different states (true/false) for the same entities. It's a known issue. However if you are saying that the hook isn't even called, then you're doing something wrong. ([i]Keep in mind that some gamemodes overrides this hook directly and returns true on everything [/i])
I'm just telling you, I think I would know if it was being called or not. The last time I tried to use this it was not even being called, I tried printing the arguments, nothing.
As I said, some gamemodes override this completely by doing (I might be wrong in what priority the hooks are to the gamemode table, unsure) [lua] function GM:ShouldCollide(ent1, ent2) return true end [/lua]
I overwrote it in my gamemode, it didn't do shit. I'm going to go try it again. Fuck me, it does get called, I dunno why it didn't work last time.
It is not called at the actual collision but rather at the intersection of the objects' bounding boxes [editline]11th March 2011[/editline] Kinda
Sorry, you need to Log In to post a reply to this thread.