Recent Posts

Pages: [1] 2 3 ... 10
1
Developers Corner / Re: Mute + Gag Time And Reason
« Last post by iViscosity on Yesterday at 08:24:19 PM »
One thing to always include when asking for help: What is the expected result (if not clear by the question) and what is the actual result (what actually happens).

You say it's "breaking". What exactly do you mean by that? If you mean it errors, what are the errors being given?

If it's not working as in it's not doing anything, one thing I notice right off the bat is the setOpposite, it should be { _, _, _, _, true } not { _, _, true }, but that shouldn't prevent the command itself from not working.

Also, you use "seconds > 0" when your parameter is "time".

From what I understand from the code (not the intended behaviour, but the behaviour I read from the code), you're checking if the player is not gagged, and if they aren't you create a timer that makes them gagged after a certain time. However if they are gagged, you destroy the timer you created before (if it exists) then make the player ungagged. I don't think you want to check if they player is already gagged/not gagged but instead check for whether or not you should be trying to gag them or not (using if ( should_ungag )) and then handling it from there. This is how I would tackle it:

Code: Lua
  1. function ulx.gag( calling_ply, target_plys, time, reason, should_ungag )
  2.         if ( not time ) then time = 0 end
  3.         if ( not reason ) then reason = "" end
  4.     for ( i = 1, #target_plys ) do
  5.         local ply = target_plys[ i ]
  6.         local str = ""
  7.         if ( should_ungag ) then
  8.                 v.ulx_gagged = false
  9.                 v:SetNWBool( "ulx_gagged", false )
  10.                 if ( timer.Exists( v:SteamID64() .. "ulxgag" ) ) then
  11.                         timer.Destroy( v:SteamID64() .. "ulxgag" )
  12.                 end
  13.                 str = str .. "#A ungagged #T"
  14.         else
  15.                 v.ulx_gagged = true
  16.                 v:SetNWBool( "ulx_gagged", true )
  17.                 if ( time > 0 )
  18.                         timer.Create( v:SteamID64() .. "ulxgag", time, 1, function()
  19.                                 v.ulx_gagged = false
  20.                                 v:SetNWBool( "ulx_gagged", false )
  21.                         end )
  22.                 end
  23.                 str = str .. "#A gagged #T"
  24.                 if ( time > 0 ) then
  25.                         str = str .. " for #i seconds"
  26.                 end
  27.                 if ( reason and reason ~= "" ) then
  28.                         str = str .. " (#s)"
  29.                 end
  30.         end
  31.     end
  32.     ulx.fancyLogAdmin( calling_ply, str, target_plys, reason )
  33. end
  34. local gag = ulx.command( CATEGORY_NAME, "ulx gag", ulx.gag, "!gag" )
  35. gag:addParam{ type=ULib.cmds.PlayersArg }
  36. gag:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  37. gag:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  38. gag:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  39. gag:defaultAccess( ULib.ACCESS_ADMIN )
  40. gag:help( "Gag target(s), disables microphone." )
  41. gag:setOpposite( "ulx ungag", { _, _, _, _, true }, "!ungag" )
  42.  

So I changed a couple things. Notably I made it a bit more efficient; the string is now declared at the beginning of the function, and then edited to specific needs based on whether or not we're trying to gag/ungag them. I also fixed your setOpposite to it will now properly ungag someone (you were using the wrong variable in the wrong place). I also fixed your timers. If we want to gag them, it will properly gag them and create a timer that then ungags them after a specific time.

Keep in mind I have not tested this code. It should work based on logic, but I can't guarantee that it will.
2
Developers Corner / Mute + Gag Time And Reason
« Last post by BlizzardyFire on Yesterday at 07:37:26 PM »
Hello, whenever I try doing this I somehow mess up or it doesn't work at all. I've looked all around on google but cannot find a solution. I've managed to get it to work with jailing (a reason) but i cant get a time or reason mutes + gags without it breaking, any help would be appreciated!

Code: [Select]
function ulx.gag( calling_ply, target_plys, time, reason, should_ungag )
local players = player.GetAll()
for i=1, #target_plys do
local v = target_plys[ i ]
v.ulx_gagged = not should_ungag
v:SetNWBool("ulx_gagged", v.ulx_gagged)
if not v.ulx_gagged then
timer.Create(v:SteamID64().."ulxgag", time, 1, function()
if not IsValid(v) then return end
v.ulx_gagged = not v.ulx_gagged
v:SetNWBool("ulx_gagged", v.ulx_gagged)
end)
else
timer.Destroy(v:SteamID64().."ulxgag")
v.ulx_gagged = not v.ulx_gagged
v:SetNWBool("ulx_gagged", v.ulx_gagged)
end
end

if not should_ungag then
local str = "#A gagged #T"
if seconds > 0 then
str = str .. " for #i seconds"
end
if reason and reason ~= "" then str = str .. " (#s)" end
ulx.fancyLogAdmin( calling_ply, str, target_plys, seconds, reason )
else
ulx.fancyLogAdmin( calling_ply, "#A ungagged #T", target_plys, reason )
end
end

local gag = ulx.command( CATEGORY_NAME, "ulx gag", ulx.gag, "!gag" )
gag:addParam{ type=ULib.cmds.PlayersArg }
gag:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
gag:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
gag:addParam{ type=ULib.cmds.BoolArg, invisible=true }
gag:defaultAccess( ULib.ACCESS_ADMIN )
gag:help( "Gag target(s), disables microphone." )
gag:setOpposite( "ulx ungag", {_, _, true}, "!ungag" )
3
General Chat & Help and Support / Auto sort alphabetically in CMDs menu
« Last post by PremiumSaltine on December 10, 2017, 11:03:56 PM »
My ULib/ULX versions (run "ulx version" in console):
ULib v2.61
ULX v3.71

I was wondering if its possible to have the user list automatically sorted in alphabetical order in the CMDs menu. It used to always be sorted that way, but I think maybe a gmod update broke it. Now I have to click "Name" in order to sort it that way, and it reverts back as soon as somebody joins the server, it seems.
4
Suggestions / Re: Discord / Website ULX sync ranks?
« Last post by BraveNM22 on December 10, 2017, 07:44:50 AM »
So I have no idea for Discord and it looks like people already have an idea for that
However I use mistforums and I know it has a game integration addon that you can download from the admin panel. However I use things like "headmod" as my "Head of Mod" group name in ULX and mistforums will then use "headmod" and and that's my only problem with it :P
5
Releases / Re: URS BETA - A Highly Customizeable Restriction System (or will be)
« Last post by JamminR on December 05, 2017, 07:08:05 PM »
I really don't know then. I imagine if something (ply:Nick, steamid, or another few variables) is being called and returning nil that error occurring.
Or, the logSpawn function doesn't exist when URS is loaded, but I thought the original author of this release would check for that before load. (I didn't look)
6
Releases / Re: URS BETA - A Highly Customizeable Restriction System (or will be)
« Last post by LilPeep on December 05, 2017, 12:32:34 AM »
1. The error occurs whenever I try to spawn a Weapon for myself.
2. I have not uninstalled ULX.
3. It does have a log.lua.
4. I do not believe so.
5. I have no idea why.

I will reinstall ULX now and see if that straightens things up.
7
Releases / Re: URS BETA - A Highly Customizeable Restriction System (or will be)
« Last post by JamminR on December 04, 2017, 06:49:26 PM »
LilPeep - that URS nil field error in line 153 uses a command (logSpawn) that relies on a ULX command.
(Not something we always recommend (that is, we intended ULib to be developed on, but not necessarily ULX))

When playing, when does that error occur?
Have you uninstalled ULX?
If ULX is installed, did you remove it's logs.lua module file?
If ULX is installed, do you have any other addon that might be modifying ULX logging?
Is there any reason why your server would return a nil steamid or playername when someone is online?

8
Releases / Re: URS BETA - A Highly Customizeable Restriction System (or will be)
« Last post by LilPeep on December 04, 2017, 05:14:50 PM »
I was told to post here in the URS Release Thread by a Staff Member.

So currently Admins on my server are capable of spawning in Weapons, Entities, NPC's, Vehicles and etc just fine, but I would like another ULX Group to be able to do the same, but I cannot have the group inheriting from Administrator due to me wanting them to have the same perms. I originally managed to make it work for another ULX Group using URS, however, URS began to restrict tools and shit in other groups, since I had no idea how to fix it I had to remove it.

TL:DR
How can I make another ULX Group not inherit Admin perms, but still be able to spawn in Weapons, Entities, NPC's, Vehicles and etc just like Admins, but not have URS Restrict Tools, Weapons, Entities, NPC and Vehicles from spawning?

EDIT:
Here is an error I get:

[ERROR] addons/urs-master/lua/ulx/modules/urs_server.lua:153: attempt to call field 'logSpawn' (a nil value)
  1. fn - addons/urs-master/lua/ulx/modules/urs_server.lua:153
   2. Call - addons/ulib/lua/ulib/shared/hook.lua:109
    3. unknown - gamemodes/sandbox/gamemode/commands.lua:739
     4. unknown - lua/includes/modules/concommand.lua:54
9
Off-Topic / Re: School Laptops
« Last post by BraveNM22 on December 04, 2017, 03:10:48 PM »
I think you asked for a mouse
and the Logitech M310 has been amazing. It's lasted me a whole while
computers on the other hand i dont really know much about. :\
10
Off-Topic / Re: ULX COMMAND
« Last post by BraveNM22 on December 04, 2017, 03:07:36 PM »
Pages: [1] 2 3 ... 10