• SprayMesh - A better, safer replacement for gmod sprays! Also: Youtube support
    84 replies, posted
I haven't downloaded and taken a look yet, does it save over server restarts by default?
[QUOTE=Soren;47160487]Does it save over server restarts by default?[/QUOTE] If you mean do the user sprays save, they are stored in a client convar; i.e. it saves on the player's computer, not the server itself.
Update! Added SprayMesh_EnableVideos -1/0/1 Defaults to 0 1 shows video 0 shows a pretty 'video disabled, use SprayMesh_Help for more info' over the spray -1 also hides the video disabled screen, for even more fps boost if you really need it [editline]17th February 2015[/editline] whoops, published an error to workshop, fixed it
[QUOTE=BlackAwps;47158164]Seeing how gmod uses luajit (which is based off 5.1) I don't see why that matters at all.[/QUOTE] It emphasises what a useless function it is.
One of my users got this error, not sure if it's just on our end or not: [code] [ERROR] lua/autorun/spraymesh.lua:494: attempt to call method 'SteamID' (a nil value) 1. PlaceSpray - lua/autorun/spraymesh.lua:494 2. func - lua/autorun/spraymesh.lua:123 3. unknown - lua/includes/modules/net.lua:32 [/code]
Line 494 and the surrounding lines have very much nothing to do with steam IDs. Something isn't updated for him or for your server.
[QUOTE=bitches;47158945][url=http://foxcock.me/web/images/zscreen/2015_02/Screenshot-2015-02-17_14.06.24.png]Also, I'm removing gifs for this reason.[/url] [/QUOTE] You killed the link in less than 12 hours...
haha, whoops fixed it [editline]17th February 2015[/editline] basically the game engine just decides to die when met with a large number of gifs [editline]17th February 2015[/editline] (webms are fine)
non-lowercase convars are ugly [editline]17th February 2015[/editline] (music warning) [vid]https://a.pomf.se/uhrrim.mp4[/vid] help
Oops. I left a debugging thing in where I pretended any link was an animation. Fixed.
it is possible to use images from somewhere other than imgur? If not at least make it admin-only
I chose imgur because it's a well known image file host that I can ensure doesn't have any ability to redirect users to custom HTML. It's extremely easy to upload to imgur. You can copy a link, or a file, and just hit control+v at imgur.com to upload it. Letting admins use anything is just problematic. It's better to have a spray url that works on any server you go to.
Everyone go rate this up so more servers will use it and thus you can use it on more servers.
GitHub version? :smile:
[QUOTE=Ott;47167780]Everyone go rate this up so more servers will use it and thus you can use it on more servers.[/QUOTE] Once I made something really useless and easy and it got tons of attention because some gaming news site mentioned it. [editline]18th February 2015[/editline] [QUOTE=zerf;47167973]GitHub version? :smile:[/QUOTE] I get where you're coming from, but the purpose of this is to be feature-complete from the start, and standardized across servers that use it, hence the workshop.
[QUOTE=bitches;47167987]I get where you're coming from, but the purpose of this is to be feature-complete from the start, and standardized across servers that use it, hence the workshop.[/QUOTE] In that case, are you going to let the settings variables be configured via server convars at some point?
The only ones meant for changing are the default url and the delay between sprays. I could also add a new hook for people to restrict spray access with. That last one is definitely a good idea, but I don't know about opening access to those two settings. The delay is just a mimic of source's three second delay, but I could make it adhere to [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowImmediateDecalPainting]Player:AllowImmediateDecalPainting[/url]. So in thinking about it, my todo list is to definitely add in support for [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowImmediateDecalPainting]Player:AllowImmediateDecalPainting[/url], and to add a spray restriction hook. Maybe override hook.Add to redirect regular hook adding from PlayerSpray to a custom one, that way nobody has to do anything irregular to support it. I [i]could[/i] add a server convar for the default URL, but why? [editline]18th February 2015[/editline] note that, just like with regular sprays, you can code in your own delay using the PlayerSpray hook return value in combo with player.AllowImmediateDecalPainting
[QUOTE=bitches;47168253]The only ones meant for changing are the default url and the delay between sprays. I could also add a new hook for people to restrict spray access with. That last one is definitely a good idea, but I don't know about opening access to those two settings. The delay is just a mimic of source's three second delay, but I could make it adhere to [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowImmediateDecalPainting]Player:AllowImmediateDecalPainting[/url]. So in thinking about it, my todo list is to definitely add in support for [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowImmediateDecalPainting]Player:AllowImmediateDecalPainting[/url], and to add a spray restriction hook. Maybe override hook.Add to redirect regular hook adding from PlayerSpray to a custom one, that way nobody has to do anything irregular to support it. I [i]could[/i] add a server convar for the default URL, but why? [editline]18th February 2015[/editline] note that, just like with regular sprays, you can code in your own delay using the PlayerSpray hook return value in combo with player.AllowImmediateDecalPainting[/QUOTE] Is it possible to make it that the server can control if videos play by default or not (then players can still turn them off) that way with your restriction hook, we can make it so admins or VIPs can have webm sprays that play by default. As for default spray URL, why not? servers can have their own logo or something as default, i do love those cats though, unless security is too much of an issue with that.
I could let servers choose a default imgur url. I don't understand your request for letting the server choose the default video setting. The default video setting is entirely clientside, and carries from server to server. It has nothing to do with the server owner, and server owners have no business claiming ownership of client settings. It is off by default to ensure a decent framerate. The disabled sprays have a notice shown in place of them that explains how to enable them. [editline]18th February 2015[/editline] [QUOTE=icefox;47168653]we can make it so admins or VIPs can have webm sprays that play by default.[/QUOTE] this is an atrocious and poisonous idea servers have no business forcing clients to lag just so you can make a few more dollars in "donations"
[QUOTE=bitches;47168775]I could let servers choose a default imgur url. I don't understand your request for letting the server choose the default video setting. The default video setting is entirely clientside, and carries from server to server. It has nothing to do with the server owner, and server owners have no business claiming ownership of client settings. It is off by default to ensure a decent framerate. The disabled sprays have a notice shown in place of them that explains how to enable them. [editline]18th February 2015[/editline] this is an atrocious and poisonous idea servers have no business forcing clients to lag just so you can make a few more dollars in "donations"[/QUOTE] Sorry, did not mean to make it seem that way, i was just suggesting it so that way there would be fewer webm sprays in such a way that it wouldn't harm FPS.
My PC can handle a full server of webm sprays. Poor PCs can't. An old but good computer could run a handful. I expect most users would want to turn it on and see all webm sprays, given that most sprays are just static images. But all aside, like I said, it's the client's choice to see them or not. They can set the option to -1 to see a frozen version of the beginning of it instead of the info screen.
added to my server, looks really cool!
thanks let me know if you have any problems or suggestions i want this to be a thing everyone uses; i see no downsides
One issue seems to be that people can seem to edit the end of the imgur link from gif to jpg and it'll go through as a working gif
[QUOTE=bitches;47175305]thanks let me know if you have any problems or suggestions i want this to be a thing everyone uses; i see no downsides[/QUOTE] I will, thanks again. I was interested in that SprayURL addon but it had so many issues. Ever since that I was looking for an alternative that everyone could use and you answered that question for me.
Below is a ULX command that will allow sprays to be added easily using the chat command !spray *imgur URL* (e.g. !spray [url]http://imgur.com/gallery/g91EpA1[/url] or !spray [url]http://i.imgur.com/g91EpA1.jpg[/url]). There is no longer any need to remove that https:// or http:// any site link (including non-imgur sites) as the script automatically does that. It also fixes links to the gallery instead of the image such as [url]http://imgur.com/gallery/g91EpA1[/url] so you won't have to copy the exact picture URL. [b]Supported Sites[/b] -Imgur -YouTube -Gyfcat [lua]local CATEGORY_NAME = "Spray Commands" --Set Own Spray-- function ulx.spray( calling_ply, input) imglink = string.Explode("//", input) imgfix1 = string.Explode(".", input) imgfix2 = string.Explode("/", input) imgfix3 = string.Explode("?", input) local imgur = "SprayMesh_URL i.imgur.com/" local imgur2 = "SprayMesh_URL i.imgur." local youtube = "SprayMesh_URL youtube." local gfycat = "SprayMesh_URL zippy.gfycat.com/" local spry = "SprayMesh_URL " if imglink[1] == "http:" or imglink[1] == "https:" then if imgfix1[1] == "http://imgur" and imgfix2[4] ~= "topic" and imgfix2[4] ~= "r" and imgfix2[4] ~= "a" then if imgfix2[4] == "gallery" then calling_ply:ConCommand(imgur ..imgfix2[5].. ".jpg") else calling_ply:ConCommand(imgur ..imgfix2[4].. ".jpg") end elseif imgfix2[4] == "topic" or imgfix2[4] == "r" or imgfix2[4] == "a" then if imgfix2[5] == "gifs" or imgfix2[5] == "reactiongifs" or imgfix2[5] == "nsfw_gifs" then calling_ply:ConCommand(imgur ..imgfix2[6].. ".gifv") else calling_ply:ConCommand(imgur ..imgfix2[6].. ".jpg") end elseif imgfix1[2] == "youtube" then calling_ply:ConCommand(youtube ..imgfix1[3]) elseif imgfix1[1] == "http://gfycat" or imgfix1[1] == "https://gfycat" then calling_ply:ConCommand(gfycat ..imgfix2[4].. ".webm") elseif imgfix1[1] == "http://zippy" or imgfix1[1] == "https://zippy" then calling_ply:ConCommand(gfycat ..imgfix2[4]) elseif imgfix1[4] == "gif" then calling_ply:ConCommand(imgur2 ..imgfix1[3].. ".webm") elseif imgfix1[4] == "webm" then calling_ply:ConCommand(imgur2 ..imgfix1[3].. ".webm") else calling_ply:ConCommand(spry ..imglink[2]) end else if imgfix1[1] == "imgur" and imgfix2[2] ~= "topic" and imgfix2[2] ~= "r" and imgfix2[2] ~= "a" then if imgfix2[2] == "gallery" then calling_ply:ConCommand(imgur ..imgfix2[3].. ".jpg") else calling_ply:ConCommand(imgur ..imgfix2[2].. ".jpg") end elseif imgfix2[2] == "topic" or imgfix2[2] == "r" or imgfix2[2] == "a" then if imgfix2[3] == "gifs" or imgfix2[3] == "reactiongifs" or imgfix2[3] == "nsfw_gifs" then calling_ply:ConCommand(imgur ..imgfix2[4].. ".gifv") else calling_ply:ConCommand(imgur ..imgfix2[4].. ".jpg") end elseif imgfix1[2] == "youtube" then calling_ply:ConCommand(youtube ..imgfix1[3]) elseif imgfix1[1] == "youtube" then calling_ply:ConCommand(youtube ..imgfix1[2]) elseif imgfix1[1] == "gfycat" then calling_ply:ConCommand(gfycat ..imgfix2[2].. ".webm") elseif imgfix1[1] == "zippy" then calling_ply:ConCommand(gfycat ..imgfix2[2]) elseif imgfix1[4] == "gif" or imgfix1[4] == "gifv" then calling_ply:ConCommand(imgur2 ..imgfix1[3].. ".gifv") elseif imgfix1[4] == "webm" then calling_ply:ConCommand(imgur2 ..imgfix1[3].. ".webm") else calling_ply:ConCommand(spry ..imgfix3[1]) end end end local spray = ulx.command( CATEGORY_NAME, "ulx spray", ulx.spray, "!spray") spray:defaultAccess( ULib.ACCESS_ALL ) spray:addParam{ type=ULib.cmds.StringArg, hint= "Enter spray URL here!" } spray:help( "We use: YouTube, Imgur, others." )[/lua] Note: Facepunch keeps messing up the structure of the code and I can't be bothered to correct it after every update so it might look unstrictured and messy Update: Fixed a few errors and added full YouTube support :) I'll be releasing a few other utilities for SprayMesh too (maybe in it's own thread) Update: Removed duplicated if statments (Imgur update and gfycat support coming soon!) Update: Imgur links now work if even with something ?1 after the link (e.g [url]http://i.imgur.com/kCUtZxr.png?1[/url] ) Update: Fixed YouTube support issue, added more Imgur support, added gfycat support. Update: Supports gif (somewhat)! Turns most imgur gif links into a gifv (unless it's a /gallery/ pic, working on support for that). Update: Added WebM support from imgur
Very nice. The abuse of .gif->.jpg renaming needs to stop, so I may end up switching from imgur to another host, unless I can figure out a good way to determine actual file type. [editline]20th February 2015[/editline] I could also link to [url=https://gfycat.com/]gfycat[/url] in the instructions printout. It converts gif to webm. [editline]20th February 2015[/editline] I'll see about removing the requirement of stripping the http:// from the links. It's necessary because I simply have the server read the client's convar when the time comes, but something in the game engine ends up stripping all text that occurs after a //. [editline]20th February 2015[/editline] Even right inside a console command's function, text after // is removed, so I can't do anything to override it except by chat commands like that ULX one, or a UI popup for changing the URL (but you'd bring that up with a chat command or a console command, making a UI pointless). [editline]20th February 2015[/editline] Update: Added support for player.AllowImmediateDecalPainting Instructions printout references gfycat Added hook PlayerSprayMesh for compatibility; use this the same as the default gmod hook PlayerSpray to override the ability for players to spray. [editline]20th February 2015[/editline] Update: [b]Centered sprays to spray ontop of where you're actually looking[/b]
Update: GIF files are now detected even if they are renamed, and will instead display a notice telling the abuser to go to gfycat.com to convert it to a webm.
Maybe add a convar to ban specific users from using it? Like how PAC has pac_ban.
This replaces sprays with a better version, and the command to show sprayers' names is already an overstepping addition that I only did because it would best be done as a part of the addon (overlaying inside the spray's own texture). You can easily write your own spray banning code like you would without this addon, just using the PlayerSprayMesh hook instead of PlayerSpray. [editline]22nd February 2015[/editline] Update: Now supports gfycat links!
Sorry, you need to Log In to post a reply to this thread.