Recent Posts

Pages: 1 2 [3] 4 5 ... 10
First, ignore my name its a joke. So I have ulx usergroups for tmods, moderators, and modplus and I want to know how to only allow them to (ulx) noclip themselves when they are playing as the job I made called "Moderator on Duty". Basically I want my staff members to also be able to roleplay but I dont wanna have to risk them abusing their noclip powers during rp. I don't want them to be able to toggle noclip on others just themselves. Keep in mind I don't mean the Sandbox noclip, I mean the ulx noclip. I tried the sandbox one and I had too many problems with it. Here is the code I tried with the sbox noclip:

adminJobs = {["TEAM_MODERATOR"] = true}
hook.Add( "PlayerNoClip", "noclipThing", function( ply )return ply:Team() == TEAM_MODERATOR
end )
hook.Add("PlayerShouldTakeDamage", "godmodeAdmin", function(ply, ent)returnnot (ply:Team() == TEAM_MODERATOR)

Developers Corner / Re: Noclip for specific darkrp jobs
« Last post by Taylorr<3/only.fans on July 04, 2020, 09:13:52 AM »
Well, not quite like you ask using a hook specific to noclip.
I think of two ways quickly. Both reasonably complex. My fellow coders could probably look and say "why not just do x" and x would be 20x easier than my thoughts.
When player joins a job, grant them "ulx noclip ^" access. ULib/ULX don't just limit commands to groups - you can grant access to individual players.
The "^" would make sure they don't noclip anyone else, as ^ means only themself.
Challenges to this, you'd need to watch job changes and player disconnects/bans/etc to remove that access so they wouldn't keep it.
Additional complexity if you ever purposely wanted someone to have that individual access and were NOT part of that job. It could easily get removed when using code to ensure cleanup of the job noclip players.

2) (this would be what I do, but I like ULib challenges)
ULib, that ulx is built on, has a *sever side only* hook called
It can be used to monitor for any function used within ULib (including ulx functions)
I imagine using it to monitor for "ulx noclip", then check job, if job matches, use the direct function "ulx.noclip" rather than using "ULX access check included" command "ulx noclip"
My example pseudo code logic -

Code: [Select]
function noclip_job_check(calling_ply, cmd, args)
if cmd == "ulx noclip" and job == match then ulx.noclip(calling_ply, calling_ply) -- skip "ulx noclip" checks, go straight to noclip ulx function (ulx.noclip)
elseif cmd == "ulx noclip" then return -- if above logic didn't match, act normal, allow ULX to do it's normal access checks to determine if player/group player is in has normal noclip access.

hook.Add(ULibCommandCalled, "noclip check", noclip_job_check)

Where would I put this code for it to work and where do I specify which job I want it to affect? I have a job called Moderator on Duty and I want to set it to where you can only noclip if you are playing as that job so staff don't abuse noclip powers during roleplay. I found a way to do this before but it used the sandbox noclip. I'm looking for a way to allow ulx noclip on only the player playing as the job so they cant toggle noclip on others. Thx also, ignore my name, it was a joke...
Developers Corner / Re: Force respawn and bring command?
« Last post by JamminR on July 01, 2020, 03:27:35 PM »
We're usually not a request forum, at least, most of us.
Most of the folks here would rather help you with what code you've tried, and assist in understanding errors you get when you try your own code.
All the code examples you'd need are actually within the two functions you're trying not to have to use; the best way for you to learn would be to try to figure out how to combine them into one command.

What have you tried?
Have you even tried making your own ulx lua module file?

Developers Corner / Re: File.Read/Write help.
« Last post by Timmy on July 01, 2020, 04:25:02 AM »
Start of conversation on Discord: https://discord.com/channels/158022958940553216/599649577381003265/727820293363728414

Exactly! The file library reads/writes files depending on the Lua state. For example: calling file.Read on the server will read a file on the server, while calling file.Read on the client will read a file on the client.

Props to you for providing detailed info and all the relevant code, which made it trivial to troubleshoot!
Developers Corner / Re: File.Read/Write help.
« Last post by Manix84 on July 01, 2020, 04:18:14 AM »
So, very kindly, Timmy gave me some help on the Discord server.

The core of my problem is that i'm using a read-write command on the Server in `lua/autorun/shared.lua`, and then attempting to do the same read-write on the client side in `lua/ulx/xgui/settings/discord.lua`. Meaning the latter was read-writing on my own machine, rather than the remote server (I suspect).

The solution is to use https://wiki.facepunch.com/gmod/net.Receive to pass the table from the server side to the client side for modification, which I will be doing later tonight :).
Developers Corner / Force respawn and bring command?
« Last post by Taylorr<3/only.fans on June 30, 2020, 11:53:20 PM »
(Ignore my name it was a joke) So I am pretty new to this coding stuff. I found a lot of custom commands for force respawning a player but can someone please make a ulx command that spawns a player if they are dead and brings them? If a player isn't alive, you can bring them and I don't want players to have to run 2 commands to get a dead player tped to them. I'm looking for a command like !fbring to forcefully bring a player if they are dead. I don't want it to freeze them, just spawn them and bring them. (!fbring player)

Developers Corner / File.Read/Write help.
« Last post by Manix84 on June 30, 2020, 07:28:13 AM »
Hi All,
I'm going to try to describe this as best I can, but I'm aware it's both a complex and unusual problem. Here we go...

Some background, to help explain how I got here... I have a script (https://github.com/manix84/discord_gmod_addon/blob/master/lua/autorun/shared.lua) which stores a Table as JSON, containing {"SteamID":"DiscordID"}. This table drives a bot which Mutes players in Discord when they die in TTT/TTT2/Murder/etc. I've finished the script and I'm relatively happy with it, even if it needs some major cleanup. This is my first GMod addon, and my first time playing with (G)Lua.

Recently I've been trying to add ULX menu support. I successfully managed to add the commands (see: https://imgur.com/Mm17dmY), which gave me something of a boost in confidence, as I've been mostly reading other developers code, and trying to understand it. My next step was to try to introduce a settings menu (similar to how the TTT and Randomat ULX menus work). After some trial and error, I actually managed it, and added a new menu under Settings (see: https://imgur.com/qjtIImn). Again, I was elated, as this was hugely laborious work, reading through other examples, and even the source code for ULX itself.

The issue came when I tried to create a user friendly method for Admin's to add Discord ID's against Steam ID's, in the ULX menu system. What I want to do, is add a list of users who are connected, with the Discord ID listed next to there names (see: https://imgur.com/ZDkKIOU, sorry i scrubbed my ID for reasons). This works so far, when I hard code the ID JSON (EG: {"SteamID":"DiscordID"}). However, inside (https://github.com/manix84/discord_gmod_addon/blob/master/lua/ulx/xgui/settings/discord.lua), when I try to collect the cache of ID's from the file system, I get back Nil. Even when using the exact same util function (see: https://github.com/manix84/discord_gmod_addon/blob/master/lua/utils/connectionTable.lua) from the Shared.lua script. However, if I write to the file first, and then read from it, I can see the JSON, but it doesn't match the JSON in the file on the server.

What seems to be happening is File.Read/Write and ULib.fileRead/fileWrite, when in the XGUI folder, seem to be writing to some kind of Memcache layer. I don't know if this is true or not, as my experience is very small, but the evidence is pointing to that.

Side Note on why I want admins to add the connections manually from the menu: The issue comes from my own experience running a server for after work games, and a lot of these extremely intelligent programmers, don't understand how to type "!discord MyDiscordName" into chat without a lot of hand holding. Night now, I have to manually edit the connections_cache.json file and add the SteamID: DiscordID connections for new team members playing. I wanted to get away from that if I could.

If ANYONE can give me a hand figuring this out, I would be extremely grateful.
-Manix84  :)

TL;DR: I want to read and write a json file on my server. I can't seem to read/write the same file from inside lua/autorun/shared.lua and lua/ulx/xgui/settings/discord.lua. I'm really confused. For a better explanation, read above.
Developers Corner / Re: [HELP] Need to disable specific TEAMIDS from being joinable
« Last post by Regen on June 29, 2020, 12:34:10 PM »
Small update, after making 4 factions on server start; the rest after are damangeable, tried using team.setup to make teams automatically and for some reason didn't do the trick
Developers Corner / [HELP] Need to disable specific TEAMIDS from being joinable
« Last post by Regen on June 29, 2020, 12:31:55 PM »
Hey my server has been having issues where certain npcs like zombies cannot damage people in 1-4 teams ( same issue as this except robotboys fix does not work and breaks half the gamemode https://github.com/Facepunch/garrysmod-issues/issues/1820) my gamemode is basewars, just wondering if there is a way i can set teamids 1-4 to be NONJOINABLE or useable in any form or shape; i've already managed to set the default team to 5 so people without a faction can be damaged but i guess the first 4 factions will not be able to so i was wondering if anyone could help me out here
Pages: 1 2 [3] 4 5 ... 10