Hi.
I want to deactivate the Voice Chat in TTT
So I scripted this:
[Lua] for i, ply in pairs(self:GetAlivePlayers()) do
hook.Add( “PlayerCanHearPlayersVoice”, “Maximum Range”, function( listener, talker )
if listener:GetPos():Distance( talker:GetPos() ) > 0 then return false end
end )[/Lua]
This runs Serverside
And this is the Error I´ve got:
[ERROR] addons/ttt antirandomat/gamemodes/terrortown/entities/weapons/weapon_ttt_antirandomat/shared.lua:143: attempt to index global ‘self’ (a nil value)
- unknown - addons/ttt antirandomat/gamemodes/terrortown/entities/weapons/weapon_ttt_antirandomat/shared.lua:143
- AntiRandomEvent - addons/ttt antirandomat/gamemodes/terrortown/entities/weapons/weapon_ttt_antirandomat/shared.lua:123
3. unknown - addons/ttt antirandomat/gamemodes/terrortown/entities/weapons/weapon_ttt_antirandomat/shared.lua:104
Line 143 is this: " hook.Add( “PlayerCanHearPlayersVoice”, “Maximum Range”, function( listener, talker )"
Line 123 is an “end” of a function that triggers randomly an event. So the Code above , too.
Line 104 is the same function as in Line 123, that is triggered when the player uses SWEP:PrimaryAttack
I didn´t use PlayerCanHearPlayersVoice before.
Thanks for help.