Author Topic: Garrysmod update, perhaps broke IsMuted?  (Read 4478 times)

0 Members and 1 Guest are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Garrysmod update, perhaps broke IsMuted?
« Reply #15 on: April 26, 2013, 02:14:44 PM »
Ambro,
Have you searched all your lua files to see if perhaps the IsMuted is being overwritten in another mod/gamemode?
Besides Megiddo's suggestion that it's a client leaves while command is executing bug of some sort (which, would seem random like you say), it's possible another mod/gamemode is in someway overwriting, forcing nil when called by our code.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Garrysmod update, perhaps broke IsMuted?
« Reply #16 on: April 26, 2013, 04:46:37 PM »
Hellfox, great! I wouldn't have thought of that but it does make sense, I've noticed that if you try to call certain functionality too soon within an event, it will act as if the function itself doesn't exist, rather annoying!

I look forward to your work-around.

Cheers.
------------------------------------------
Fix 1 - This is the way you want to try first, the second method was me deciding to start thinking like Garry to fix a Garry glitch.
------------------------------------------
Just try changing Line 66...
Code: [Select]
if not user_to_gag:IsMuted() or was_gagged then return end to...
Code: [Select]
if not (v.gimp == 2) or was_gagged then return end
-----------------------------------------
Fix 2 - The insane/unstable way.
------------------------------------------
Okay here is the code, so I wanted to replicate the ULX freeze command and make one that takes an extra var where you can choose if it silently freezes the player or just says "Someone froze Jacob"

Any way here is the code for it...

Code: [Select]
function ulx.gunfreeze( calling_ply, target_plys, should_unfreeze, hide_echo, isFrozen )
if( SERVER ) then -- This part right here is what interests you! (At least it worked for me as a fix.)
local affected_plys = {}
for i=1, #target_plys do
if not should_unfreeze and ulx.getExclusive( target_plys[ i ], calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_plys[ i ], calling_ply ), true )
else
local v = target_plys[ i ]
if v:InVehicle() then
v:ExitVehicle()
end

if not should_unfreeze then
v:Lock()
v.frozen = true
ulx.setExclusive( v, "frozen" )
else
v:UnLock() --The error was happening here where UnLock() would "not exsist".
v.frozen = nil
ulx.clearExclusive( v )
end

v:DisallowSpawning( not should_unfreeze )
ulx.setNoDie( v, not should_unfreeze )
table.insert( affected_plys, v )

if v.whipped then
v.whipcount = v.whipamt -- Will make it remove
end
end
end

if not hide_echo then
if not should_unfreeze then
ulx.fancyLogAdmin( calling_ply, "#A froze #T", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A unfroze #T", affected_plys )
end
else
if not should_unfreeze then
ulx.fancyLogAdmin( calling_ply, true, "#A froze #T", affected_plys )
elseif( isFrozen ) then
ulx.fancyLogAdmin( calling_ply, true, "#A unfroze #T", affected_plys )
end
end
end
end
local gunfreeze = ulx.command( CATEGORY_NAME, "ulx gunfreeze", ulx.gunfreeze, "!gunfreeze" )
gunfreeze:addParam{ type=ULib.cmds.PlayersArg }
gunfreeze:addParam{ type=ULib.cmds.BoolArg, invisible=true }
gunfreeze:defaultAccess( ULib.ACCESS_ADMIN )
gunfreeze:help( "Used for freezing players with the physgun!" )
gunfreeze:setOpposite( "ulx ungunfreeze", {_, _, true}, "!ungunfreeze" )

In short what you want to do is take that module and make it run on shared then change this line (Line 66) "if not user_to_gag:IsMuted() or was_gagged then return end" to "if SERVER and not (user_to_gag:IsMuted() or was_gagged) then return end".


Disclaimer: Both of these are just guesses based on my own experience, I hope they help you.
I cry every time I see that I am not a respected member of this community.