• SprayMesh - A better, safer replacement for gmod sprays! Also: Youtube support
    84 replies, posted
[B]DOWNLOAD: Click image! [/B][url=http://steamcommunity.com/sharedfiles/filedetails/?id=394091909][img]http://cloud-4.steamusercontent.com/ugc/28482212351203570/A94848F6701E31C95D46E55329927C4CE39BA204/[/img][/url] [B]DOWNLOAD: Click image! [/B] [url]http://steamcommunity.com/sharedfiles/filedetails/?id=394091909[/url] copypasty from the workshop page: Now your server's players can have sprays again! And BETTER! If you didn't know, having sv_allowupload and sv_allowdownload on are security holes. Malicious players can gain access to any custom files you have, such as your server.cfg, and can even upload things to your server. So, if you haven't already, you should set these to 0. This breaks default gmod sprays! This addon replaces default sprays with a safe version. You should still set the two server convars to 0. This addon lets your players easily use URLs for images. It creates a map-conforming mesh to display the sprays on. This does not hurt anyone's framerate (with special options for really bad PCs). This supports videos, such as webm, gifv, and even youtube URLs (which are muted). All you have to do is add this workshop item to your server, or subscribe if you're a user wanting this for singleplayer. This overrides the spray bind to create a SprayMesh, and informs users how to use it! [t]http://cloud-4.steamusercontent.com/ugc/28482212351221423/5AFCAE2E45AB57FFA0DB2234F522E17218649BAE/[/t][t]http://cloud-4.steamusercontent.com/ugc/28482212351222031/35BABB67871E1E28EF1DD924AF3C0B82A98B0E11/[/t][t]http://cloud-4.steamusercontent.com/ugc/28482212351223666/66683A40EC783E0B7AD6D2DA129BEC7E8DA7BF96/[/t] [t]http://cloud-4.steamusercontent.com/ugc/28482212351224082/B7C3E0FA9AB029ED18704043965B708C6C3BF12D/[/t] [media]http://www.youtube.com/watch?v=ZT6M8mG1rQ8[/media] Tell me if you have any issues in this thread. [b]Compatibility:[/b] * This supports [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowImmediateDecalPainting]Player:AllowImmediateDecalPainting[/url] * If you want to override a player's access to spraying, use the hook PlayerSprayMesh. This works the same as [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSpray]GM/PlayerSpray[/url]. If any of your server's scripts contain the PlayerSpray hook, you should replace that hook with PlayerSprayMesh.
Holy Jesus yes. Thank you for this. I'll be putting this on my server immediately. Does this check whether the player is alive when spraying? I couldn't find that anywhere in the code. [editline]16th February 2015[/editline] No, it doesn't. I patched it myself by putting a check in SprayMesh.SendSpray and it seems to work just fine. [editline]16th February 2015[/editline] It doesn't seem to work for me. It would just spray the regular spray. I tried it using a flashlight hook instead and it works with the flashlight, just not the regular spray button (impulse 201) [editline]16th February 2015[/editline] -snip- I didn't know there was a distance function because I'm pathetic :v:
[QUOTE=zeaga;47156186] [code] math.sqrt( math.pow( tr.HitPos[1] - tr.StartPos[1], 2 ) + math.pow( tr.HitPos[2] - tr.StartPos[2], 2 ) + math.pow( tr.HitPos[1] - tr.StartPos[3], 2 ) ) [/code][/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/Distance]Vector:Distance[/url] Also, math.pow is deprecated ( and removed ) since the release of Lua 5.3.
[QUOTE=zeaga;47156186]Holy Jesus yes. Thank you for this. I'll be putting this on my server immediately. Does this check whether the player is alive when spraying? I couldn't find that anywhere in the code. [editline]16th February 2015[/editline] No, it doesn't. I patched it myself by putting a check in SprayMesh.SendSpray and it seems to work just fine. [editline]16th February 2015[/editline] It doesn't seem to work for me. It would just spray the regular spray. I tried it using a flashlight hook instead and it works with the flashlight, just not the regular spray button (impulse 201) [editline]16th February 2015[/editline] There's also no distance check. I'll just leave this here. [code] math.sqrt( math.pow( tr.HitPos[1] - tr.StartPos[1], 2 ) + math.pow( tr.HitPos[2] - tr.StartPos[2], 2 ) + math.pow( tr.HitPos[1] - tr.StartPos[3], 2 ) ) [/code][/QUOTE] What are you talking about? The game itself checks the spray distance, because the spray hook only runs when using the spray bind on a nearby surface. The spray bind also works, for me. I'm installing it same as you, from the workshop.
[QUOTE=bitches;47156364]What are you talking about? The game itself checks the spray distance, because the spray hook only runs when using the spray bind on a nearby surface. The spray bind also works, for me. I'm installing it same as you, from the workshop.[/QUOTE] I did not know the spray hook only runs when you're able to spray. My bad. Anyway, I've tried it on about 3 different machines now and it's not working. I couldn't tell you why that is, but it's gotta be something on my end for sure. I'll keep snooping around.
Is it your edited version that doesn't work, or the workshop?
I tried my edited version on my main server and the workshop version on the other two servers. [editline]16th February 2015[/editline] Now I've tried the workshop on the main server, too, and it still won't work. I'm running Terrortown, so maybe another gamemode will work.
I've updated the workshop to check if the player is alive. [editline]17th February 2015[/editline] try it in singleplayer subscribed to it
[QUOTE=bitches;47156392]try it in singleplayer subscribed to it[/QUOTE] I am. That's how I got the decompiled code.
also no wonder it sprayed the regular spray you used the wrong hook [editline]17th February 2015[/editline] i meant, tell me if it works in singleplayer mode
[QUOTE=bitches;47156400]also no wonder it sprayed the regular spray you used the wrong hook [editline]17th February 2015[/editline] i meant, tell me if it works in singleplayer mode[/QUOTE] I used the wrong hook after the "right hook" only sprayed the regular spray. I wanted to see if it would do it in a different hook. Ah, ok. I'll try it now.
The right hook, PlayerSpray, [b]always[/b] disables the default gmod spray in my script. Something is broken on your end. A conflicting script, perhaps.
[QUOTE=bitches;47156408]The right hook, PlayerSpray, [b]always[/b] disables the default gmod spray in my script. Something is broken on your end. A conflicting script, perhaps.[/QUOTE] [QUOTE=zeaga;47156370]I couldn't tell you why that is, but it's gotta be something on my end for sure. I'll keep snooping around.[/quote] It [i]does[/i] work in singleplayer, so it's gotta be my server. I'll look around for something fucking up the spray hook or something. [editline]hi mom[/editline] All fixed now. Thanks!
I've updated the workshop to force my version of the hook to override all others, by apparent necessity. Make sure it's updated on your server, and try again. [editline]17th February 2015[/editline] you're using this, right? [url]http://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url] [editline]17th February 2015[/editline] i'm going to bed while you figure out what's fucked
[QUOTE=bitches;47156420]you're using this, right? [url]http://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url][/QUOTE] No. I can't change the settings of the addon if I use the workshop item, although I did do that for the testing servers. I've got it all fixed now, thanks.
With a bit more advanced techniques you can extract the actual map geometry instead of doing a million traces. It gets you more accurate and optimized results, compared to your mesh builder code. [img_thumb]https://dl.dropboxusercontent.com/u/7659139/phys_cut.PNG[/img_thumb] The only downside is that it does not support displacements as it is. It relies on Entity(0):GetMeshConvexes(). In theory you could add displacement support but that requires parsing the map .bsp file by hand...
Do you think you can add a feature that allows admins to see the owner of a certain spray, just in case "unsavory" content is sprayed? Also, the help guide in console... There are two problems with it. Firstly, it doesn't fit in smaller resolutions (like 1366x768) without expanding the console. Not a big issue, but I'm mentioning it because the text doesn't loop around. Secondly, it says at the bottom that gifv and webm support is coming soon, but it's already implemented.
I can seem to be able to spray as a spectator. How can I fix this?
The only other real complaint I have about this is that sprays don't fade out over a distance, so if you're far away they're still rendered. This might not be ideal due to videos, anyhow, but can it still be an option?
[QUOTE=Baron von Hax;47157167]I can seem to be able to spray as a spectator. How can I fix this?[/QUOTE] this is intentional [editline]17th February 2015[/editline] [QUOTE=WitheredPyre;47157212]The only other real complaint I have about this is that sprays don't fade out over a distance, so if you're far away they're still rendered. This might not be ideal due to videos, anyhow, but can it still be an option?[/QUOTE] Why? Having many of these sprays drawing at the same time gives me no framerate impact. [editline]17th February 2015[/editline] update: added client command: SprayMesh_Clear clears all local sprays
[QUOTE=bitches;47157378]this is intentional [editline]17th February 2015[/editline] Why? Having many of these sprays drawing at the same time gives me no framerate impact. [editline]17th February 2015[/editline] update: added client command: SprayMesh_Clear clears all local sprays[/QUOTE] Unless I'm incorrect, this is the functionality of regular sprays, and with videos, it actually impacts FPS for some clients (including mine) significantly, to the point that I had to disable webm, gifv, and youtube on my server. While this wouldn't be solved outright by limiting the range, it WOULD reduce overall lag by making the source of it only occur in one location (which can then be cleared by the client with the new command). Even if there's no FPS impact, anyhow, it'd be a good optimization measure to do such a thing, or at least obey visleafs.
It wouldn't be feasible without making the source html panels close and later reopen based on distance, which conflicts with how I optimize by making all identical URL sprays be drawn by the same panel. It isn't worth it to cut back the functionality for toasters. edit: [QUOTE=bitches;47160669]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[/QUOTE]
[QUOTE=bitches;47157627]It wouldn't be feasible without making the source html panels close and later reopen based on distance, which conflicts with how I optimize by making all identical URL sprays be drawn by the same panel. It isn't worth it to cut back the functionality for toasters.[/QUOTE] Fair enough, I guess. Can I get some feedback on the 'identifying sprays' idea? I think that'd be useful.
[QUOTE=bitches;47157378]this is intentional [editline]17th February 2015[/editline] Why? Having many of these sprays drawing at the same time gives me no framerate impact. [editline]17th February 2015[/editline] update: added client command: SprayMesh_Clear clears all local sprays[/QUOTE] How can I disable it?
[QUOTE=Willox;47156359]Also, math.pow is deprecated ( and removed ) since the release of Lua 5.3.[/QUOTE] Seeing how gmod uses luajit (which is based off 5.1) I don't see why that matters at all.
[QUOTE=WitheredPyre;47157640]Fair enough, I guess. Can I get some feedback on the 'identifying sprays' idea? I think that'd be useful.[/QUOTE] Added this for you, a new console command that shows info on all sprays for ten seconds. [t]http://foxcock.me/web/images/zscreen/2015_02/Screenshot-2015-02-17_12.17.58.png[/t][t]http://foxcock.me/web/images/zscreen/2015_02/Screenshot-2015-02-17_12.17.53.png[/t]
[QUOTE=bitches;47158314]Added this for you, a new console command that shows info on all sprays for ten seconds. [t]http://foxcock.me/web/images/zscreen/2015_02/Screenshot-2015-02-17_12.17.58.png[/t][t]http://foxcock.me/web/images/zscreen/2015_02/Screenshot-2015-02-17_12.17.53.png[/t][/QUOTE] Thanks!
[QUOTE=bitches;47156142][B]DOWNLOAD: Click image! [/B][url=http://steamcommunity.com/sharedfiles/filedetails/?id=394091909][img]http://cloud-4.steamusercontent.com/ugc/28482212351203570/A94848F6701E31C95D46E55329927C4CE39BA204/[/img][/url] [B]DOWNLOAD: Click image! [/B] copypasty from the workshop page: Now your server's players can have sprays again! And BETTER! If you didn't know, having sv_allowupload and sv_allowdownload on are security holes. Malicious players can gain access to any custom files you have, such as your server.cfg, and can even upload things to your server. So, if you haven't already, you should set these to 0. This breaks default gmod sprays! This addon replaces default sprays with a safe version. You should still set the two server convars to 0. This addon lets your players easily use URLs for images. It creates a map-conforming mesh to display the sprays on. This does not hurt anyone's framerate. This supports animated images, such as gifs, webms, gifv, and even youtube URLs (which are muted). All you have to do is add this workshop item to your server, or subscribe if you're a user wanting this for singleplayer. This overrides the spray bind to create a SprayMesh, and informs users how to use it! [t]http://cloud-4.steamusercontent.com/ugc/28482212351221423/5AFCAE2E45AB57FFA0DB2234F522E17218649BAE/[/t][t]http://cloud-4.steamusercontent.com/ugc/28482212351222031/35BABB67871E1E28EF1DD924AF3C0B82A98B0E11/[/t][t]http://cloud-4.steamusercontent.com/ugc/28482212351223666/66683A40EC783E0B7AD6D2DA129BEC7E8DA7BF96/[/t] [t]http://cloud-4.steamusercontent.com/ugc/28482212351224082/B7C3E0FA9AB029ED18704043965B708C6C3BF12D/[/t] Tell me if you have any issues in this thread.[/QUOTE] Could you add a convar on the clientside to allow the playing of sounds?
How much safer is this than that other spray addon? and then default sprays?
[QUOTE=Leystryku;47158932]Could you add a convar on the clientside to allow the playing of sounds?[/QUOTE] This is a replacement of source sprays, not a projector entity. I'm about to restrict youtube to admins only for performance reasons anyway. [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] [editline]17th February 2015[/editline] [QUOTE=icefox;47158944]How much safer is this than that other spray addon? and then default sprays?[/QUOTE] That other addon uses framerate-hurting flat 3D2D panels, and is bad at checking link security. This means users could load custom html pages on it that iframe the server IP address, which can get all connected players banned via what the server perceives as incorrect RCON spam. My addon works fine, and is increasingly being updated to prevent framerate loss. Default sprays require sv_allowupload and sv_allowdownload to be set to 1, which as noted in my OP, is totally unsafe.
Sorry, you need to Log In to post a reply to this thread.