• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[code] table.sort(t, function(a, b) return a.one < b.one or a.two < b.two end)[/code]
Anyone know how to slow the fall speed of an entity?
[QUOTE=helix757;47207940]Anyone know how to slow the fall speed of an entity?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PhysObj/SetDragCoefficient]PhysObj:SetDragCoefficient[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetGravity]Entity:SetGravity[/url] probably the latter.
-snip-
clientside hook to change chat input before sending to server?
[QUOTE=Xaotic;47211025]clientside hook to change chat input before sending to server?[/QUOTE] I don't really see why you'd want this... Wouldn't it work to change it serverside on [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSay]GM/PlayerSay[/url]? Only thing I can think of clientside is [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatTextChanged]GM/ChatTextChanged[/url], which I've never worked with. Alternatively there's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/OnChatTab]GM/OnChatTab[/url], which would require your users to press tab but lets you change it to whatever and they would also see it.
[QUOTE=Neat-Nit;47211214]I don't really see why you'd want this... Wouldn't it work to change it serverside on [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSay]GM/PlayerSay[/url]? Only thing I can think of clientside is [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatTextChanged]GM/ChatTextChanged[/url], which I've never worked with. Alternatively there's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/OnChatTab]GM/OnChatTab[/url], which would require your users to press tab but lets you change it to whatever and they would also see it.[/QUOTE] i got my reasons *puts glasses on* i can work with the second one, thanks hon
I think you may need to use the chat-box "hack" solution so you can get the text from the box as it is typed ( different from On Chat Changed because that only returns to the function the new contents, it doesn't let you alter it ) and the Chat Tab function is so you can create a sort of auto-complete system ( so if you have @Name for private messaging or whatever, it can be coded in, if I'm reading it correctly ) which won't help because the client would need to press TAB to have the text altered. Honestly, instead of having the CLIENT manipulate data which may be important, it is much better to have the SERVER handle it in PlayerSay as mentioned before. Another alternative would be to use OnPlayerChat which is client-side BUT it is the communication the SERVER sends to all CLIENTs when a message has completed its rounds... Depending on what it is needed for, you may be able to use one or the other.. Here are how chat commands can be created with examples using PlayerSay, OnPlayerChat, and other methods of string manipulation: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/chat_commands/chat_commands.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/chat_commands/chat_commands_examples.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/chat_commands/chat_commands_other.lua.html[/url] Here's the most likely solution that would work for you because you'd be able to target the text box prior to the user pressing enter, and alter it... The down-side is that it is highly likely that this method will be removed, ie "fixed", because it is exploitable: [url]http://facepunch.com/showthread.php?t=1451374[/url]
Any assistance with planning out my Chat Box? Obviously, I need to hide the old one, but when it comes to actually creating the design; Should I use a DTextEntry to give a base typing area for the client and when finished, have it insert into a 'History' table. From there, have another [scrollable] panel that loops through 'History' and makes new Lines/Bars on a itself? On mobile right now, so kinda kept the description short, but help me think of what I'm missing. [editline]25th February 2015[/editline] Oh yes, and I need to override chat.AddText, Correct?
[url=https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/extensions/table.lua#L695-L699]table.KeyFromValue[/url] returns no value when a key isn't found. Is there any reason, at all, why it doesn't return nil? It got a bit confusing to debug, since the following code: [lua]print( type(table.KeyFromValue(tab, val)), table.KeyFromValue(tab, val) ) local a = table.KeyFromValue(tab, val) print(type(a), a)[/lua] produces (when tab doesn't have val): [code]no value nil nil[/code] Which is inconsistent. I mean, I got over it now, but shouldn't it just return nil? I mean, it's a function that returns a value, it SHOULD always return one!
my staff keeps using the !give command to give themselves weapons in darkrp even though I removed the !give command in the restrictions. How would I restrict that command entirely?
So I know there's a way to put elements on the HUD at different angles, 3D2D, but is there a way to make the entire thing curve, like a bubble?
[QUOTE=meowking1;47213054]my staff keeps using the !give command to give themselves weapons in darkrp even though I removed the !give command in the restrictions. How would I restrict that command entirely?[/QUOTE] If your staff doesn't listen to you, you should consider demoting them instead. As for the !give command, it's not a default ULX command afaik, so you could just remove the script. Restricting it on a per group basis will work, unless you're doing something wrong.
[QUOTE=Kozmic;47212747]Any assistance with planning out my Chat Box? Obviously, I need to hide the old one, but when it comes to actually creating the design; Should I use a DTextEntry to give a base typing area for the client and when finished, have it insert into a 'History' table. From there, have another [scrollable] panel that loops through 'History' and makes new Lines/Bars on a itself? On mobile right now, so kinda kept the description short, but help me think of what I'm missing. [editline]25th February 2015[/editline] Oh yes, and I need to override chat.AddText, Correct?[/QUOTE] This isn't everything, but it's the start: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/chat_box/creating_custom_chatbox.lua.html[/url] I'd recommend looking at the wiki... Try to incorporate all existing hooks into the new chat-box so it will support all other mods. Besides, then the functions are put to use and not wasted space. And, yes... I would recommend overwriting chat.AddText ( but keep the functionality ), etc... [editline]26th February 2015[/editline] [QUOTE=meowking1;47213054]my staff keeps using the !give command to give themselves weapons in darkrp even though I removed the !give command in the restrictions. How would I restrict that command entirely?[/QUOTE] If you removed it from being restricted then it is unrestricted.. You'd need to restrict access so they do not give themselves weapons or as ms333 says, demote them... If they go behind your back to use admin abilities to spawn themselves things... they're not trustworthy. Here's a console command tracking system if you're interested: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_utilities/concommand_logger_.lua[/url] You can add give to the command_blacklist table. It can either be a function if you want to allow yourself or you can simply add give = true; in the command_blacklist table and it'll be blocked for everyone.. There is a hook you can override though so a simple hook.Add CanPlayerRunConCommand with args for player, command, args in table format, args in string format... [editline]26th February 2015[/editline] [QUOTE=Neat-Nit;47212802][url=https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/extensions/table.lua#L695-L699]table.KeyFromValue[/url] returns no value when a key isn't found. Is there any reason, at all, why it doesn't return nil? It got a bit confusing to debug, since the following code: [lua]print( type(table.KeyFromValue(tab, val)), table.KeyFromValue(tab, val) ) local a = table.KeyFromValue(tab, val) print(type(a), a)[/lua] produces (when tab doesn't have val): [code]no value nil nil[/code] Which is inconsistent. I mean, I got over it now, but shouldn't it just return nil? I mean, it's a function that returns a value, it SHOULD always return one![/QUOTE] While I agree that functions should be standardized.. not all of them are. Not all of them need to return a value but, personally, a getter should return either a default value if it's that type of getter, or false if no data found, etc... Although, because nil is "nothing", meaning it doesn't exist... you can easily test... if ( !table.KeyFromVale( ... ) ) then ... nothing found ... end
Does gmod support .otf fonts or only .ttf ? (I can't try it myself right now and am curious)
Is [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/NoClipping]PANEL/NoClipping[/url] not working for anyone else?
[QUOTE=wh1t3rabbit;47216064]Does gmod support .otf fonts or only .ttf ? (I can't try it myself right now and am curious)[/QUOTE] I ran into issues with OTF fonts, but you may have different results. It may have just been my own fuck up. (TTFs have worked fine though.)
Is there a way to fix nextbot eyes? What I mean is that this is way too spooky for me. [IMG]http://i.imgur.com/sF75DwH.png[/IMG] I would prefer them to just stare directly forward. Edit: woops. SetEyeTarget() does the job.
[QUOTE=Acecool;47211874]will be removed, ie "fixed", because it is exploitable[/QUOTE] It most likely will not be removed since they have already fixed the exploit in the dev branch.
[QUOTE=Wyozi;47219223]Is there a way to fix nextbot eyes? What I mean is that this is way too spooky for me. [IMG]http://i.imgur.com/sF75DwH.png[/IMG] I would prefer them to just stare directly forward. Edit: woops. SetEyeTarget() does the job.[/QUOTE] god mom get out of my room
I'm trying to upload an addon to the workshop. This is the folder that I am trying to upload using gmpu 2.2. [IMG]http://puu.sh/gdVqH/8d1e6f8e5e.png[/IMG] (alteredmap being the folder I am uploading) When I upload I get an Error! Exit Status (1) when I try and execute the program. The whole program: [url]http://puu.sh/gdVDE/538fdea99d.png[/url] The icon is 512x512 jpeg, it should work. Here is the error log: [CODE][CONFIG] Logging Initiallized. Retreving list of Addons. ID: 295400181 Name: "Deathrow Trooper" ID: 260822975 Name: "MLG 420 BLAZE IT GUN" ID: 276601948 Name: "National Guard Player Models" ID: 311241022 Name: "NYPD Cops Player Models" ID: 273550760 Name: "Resident Evil SWAT Player Models + Bodygroups + Vector" ID: 217217705 Name: "Set Game Speed - Slow Motion Addon" ID: 197240202 Name: "Simplicity HUD" ID: 274555791 Name: "Suits and Robbers Player Models" Retrieval Finished! Image for icon selected. Loading and Checking Image... Image is 512x512. Loading preview... Preview Loaded. Executing queue. Creating addon from C:\Users\Sal\Desktop\alteredmap... Creating temporary addon.json. Creating temporary gma. Garry's Addon Creator 1.0 Looking in folder "C:/Users/Sal/Desktop/alteredmap/" maps/rp_downtown_altered.bsp maps/rp_downtown_altered.nav maps/rp_downtown_altered.png File index: maps/rp_downtown_altered.bsp [CRC:1480892096] [Size:75.4 MB] File index: maps/rp_downtown_altered.nav [CRC:1749577880] [Size:2.4 MB] File index: maps/rp_downtown_altered.png [CRC:2816903861] [Size:24.1 KB] Adding maps/rp_downtown_altered.bsp Adding maps/rp_downtown_altered.nav Adding maps/rp_downtown_altered.png Successfully saved to "temp.gma" [77.8 MB] Garry's Workshop Publisher 1.0 [Compiled Jun 8 2014 - 17:16:08] Storage Quota: 1.0 GB total, 994.8 MB free Opening temp.gma Compressing.. [77.8 MB] => [23.5 MB] Sending Addon to Steam.. Couldn't load icon - is it a jpeg? ..\tier1\fileio.cpp (4002) : Assertion Failed: m_nNumRegisteredWriters == 0 Deleting temporary gma... Temporary gma deleted. Deleting temporary addon.json... Temporary addon.json deleted. [WARNING] Creation Failed! Finished running queue. Refreshing addon list. Retreving list of Addons. ID: 295400181 Name: "Deathrow Trooper" ID: 260822975 Name: "MLG 420 BLAZE IT GUN" ID: 276601948 Name: "National Guard Player Models" ID: 311241022 Name: "NYPD Cops Player Models" ID: 273550760 Name: "Resident Evil SWAT Player Models + Bodygroups + Vector" ID: 217217705 Name: "Set Game Speed - Slow Motion Addon" ID: 197240202 Name: "Simplicity HUD" ID: 274555791 Name: "Suits and Robbers Player Models" Retrieval Finished! Finished refreshing addon list.[/CODE] Anybody have any solutions?
Anybody know how to stop this from stacking: [code] function GM:HUDPaint() local Target for k,v in pairs(player.GetAll()) do Target = v end if Target:Team() == LocalPlayer():Team() then if Target == LocalPlayer() then return end if !Target:IsValid() then return end draw.RoundedBox(0, 25, ScrH()-137.1 * 4, 200, 35, Color(25, 25, 25, 150)) draw.SimpleText(Target:Nick(), "Trebuchet22",40, ScrH()-136 * 4, Color(255, 255, 255)) draw.SimpleText(Target:Nick() , "Trebuchet22",40, ScrH()-127 * 4, Color(255, 255, 255)) end end [/code] It shows as: [img]http://i.imgur.com/2LANJui.png[/img] Where it should show as: [img]http://i.imgur.com/ZsRFLuS.png[/img]
[QUOTE=Pawsative;47219929]It shows as: [img]http://i.imgur.com/2LANJui.png[/img] Where it should show as: [img]http://i.imgur.com/ZsRFLuS.png[/img][/QUOTE] Perhaps I'm missing the point, but those look exactly the same except the background. Edit: oh, I see it. Rate me dumb! Edit: you're setting a value in a for loop but only using it outside the for loop. That means you're only using the LAST value that it was set to. Put the rest of the code inside the loop, like so: [lua]function GM:HUDPaint() local Target for k,v in pairs(player.GetAll()) do Target = v if Target:Team() == LocalPlayer():Team() then if Target == LocalPlayer() then return end if !Target:IsValid() then return end draw.RoundedBox(0, 25, ScrH()-137.1 * 4, 200, 35, Color(25, 25, 25, 150)) draw.SimpleText(Target:Nick(), "Trebuchet22",40, ScrH()-136 * 4, Color(255, 255, 255)) draw.SimpleText(Target:Nick() , "Trebuchet22",40, ScrH()-127 * 4, Color(255, 255, 255)) end end end[/lua] Also for the love of code, properly tab your lines.
[QUOTE=Neat-Nit;47220252]Perhaps I'm missing the point, but those look exactly the same except the background. Edit: oh, I see it. Rate me dumb![/QUOTE] It's supposed to say 'Bot06' without me doing draw.SimpleText("Bot06"
just making sure you don't miss this, I edited an answer up above ^ :)
[QUOTE=Procrastinate;47219704]I'm trying to upload an addon to the workshop. This is the folder that I am trying to upload using gmpu 2.2. [IMG]http://puu.sh/gdVqH/8d1e6f8e5e.png[/IMG] (alteredmap being the folder I am uploading) When I upload I get an Error! Exit Status (1) when I try and execute the program. The whole program: [url]http://puu.sh/gdVDE/538fdea99d.png[/url] The icon is 512x512 jpeg, it should work. Here is the error log: [CODE]--snip-- Sending Addon to Steam.. Couldn't load icon - is it a jpeg? ..\tier1\fileio.cpp (4002) : Assertion Failed: m_nNumRegisteredWriters == 0 --snip-- [/CODE] Anybody have any solutions?[/QUOTE] [B]Couldn't load icon - is it a jpeg?[/B] The filetype is PNG according to your screenshot. EDIT: Oh, that's the icon for the map in the screenshot. Sorry I misunderstood.
[QUOTE=Procrastinate;47219704]I'm trying to upload an addon to the workshop. This is the folder that I am trying to upload using gmpu 2.2. [IMG]http://puu.sh/gdVqH/8d1e6f8e5e.png[/IMG] (alteredmap being the folder I am uploading) When I upload I get an Error! Exit Status (1) when I try and execute the program. The whole program: [url]http://puu.sh/gdVDE/538fdea99d.png[/url] The icon is 512x512 jpeg, it should work. Here is the error log: [CODE][CONFIG] Logging Initiallized. Retreving list of Addons. ID: 295400181 Name: "Deathrow Trooper" ID: 260822975 Name: "MLG 420 BLAZE IT GUN" ID: 276601948 Name: "National Guard Player Models" ID: 311241022 Name: "NYPD Cops Player Models" ID: 273550760 Name: "Resident Evil SWAT Player Models + Bodygroups + Vector" ID: 217217705 Name: "Set Game Speed - Slow Motion Addon" ID: 197240202 Name: "Simplicity HUD" ID: 274555791 Name: "Suits and Robbers Player Models" Retrieval Finished! Image for icon selected. Loading and Checking Image... Image is 512x512. Loading preview... Preview Loaded. Executing queue. Creating addon from C:\Users\Sal\Desktop\alteredmap... Creating temporary addon.json. Creating temporary gma. Garry's Addon Creator 1.0 Looking in folder "C:/Users/Sal/Desktop/alteredmap/" maps/rp_downtown_altered.bsp maps/rp_downtown_altered.nav maps/rp_downtown_altered.png File index: maps/rp_downtown_altered.bsp [CRC:1480892096] [Size:75.4 MB] File index: maps/rp_downtown_altered.nav [CRC:1749577880] [Size:2.4 MB] File index: maps/rp_downtown_altered.png [CRC:2816903861] [Size:24.1 KB] Adding maps/rp_downtown_altered.bsp Adding maps/rp_downtown_altered.nav Adding maps/rp_downtown_altered.png Successfully saved to "temp.gma" [77.8 MB] Garry's Workshop Publisher 1.0 [Compiled Jun 8 2014 - 17:16:08] Storage Quota: 1.0 GB total, 994.8 MB free Opening temp.gma Compressing.. [77.8 MB] => [23.5 MB] Sending Addon to Steam.. Couldn't load icon - is it a jpeg? ..\tier1\fileio.cpp (4002) : Assertion Failed: m_nNumRegisteredWriters == 0 Deleting temporary gma... Temporary gma deleted. Deleting temporary addon.json... Temporary addon.json deleted. [WARNING] Creation Failed! Finished running queue. Refreshing addon list. Retreving list of Addons. ID: 295400181 Name: "Deathrow Trooper" ID: 260822975 Name: "MLG 420 BLAZE IT GUN" ID: 276601948 Name: "National Guard Player Models" ID: 311241022 Name: "NYPD Cops Player Models" ID: 273550760 Name: "Resident Evil SWAT Player Models + Bodygroups + Vector" ID: 217217705 Name: "Set Game Speed - Slow Motion Addon" ID: 197240202 Name: "Simplicity HUD" ID: 274555791 Name: "Suits and Robbers Player Models" Retrieval Finished! Finished refreshing addon list.[/CODE] Anybody have any solutions?[/QUOTE] Resave the icon in Paint or Paint.NET. Just not photoshop.
[QUOTE=Robotboy655;47220425]Resave the icon in Paint or Paint.NET. Just not photoshop.[/QUOTE] Worked. Thanks much.
[QUOTE=Robotboy655;47220425]Resave the icon in Paint or Paint.NET. Just not photoshop.[/QUOTE] [QUOTE=Procrastinate;47220619]Worked. Thanks much.[/QUOTE] Why is that?
[QUOTE=bobbleheadbob;47221204]Why is that?[/QUOTE] [IMG]http://puu.sh/geFxi/956b5b4122.png[/IMG] ?
Sorry, you need to Log In to post a reply to this thread.