[release][b]Utility Blocks[/b]
I present to you my first real Lua project. I've made other small scripts before this, but I believe that this is big enough to call a project. Since it is my first though, I understand that there'll most likely be areas where I can improve or optimise my methods, so, I'm open to suggestions and comments. (Yep, the title kinda sucks, I couldn't think of anything else to call it.)
The original purpose of this was to block players from getting to certain areas in maps by repelling, or killing them, however, it has grown much further than that, and is very easy to edit yourself to add new functions for blocks.
Blocks are placed using a simple SWEP, and can be saved on a per-map basis and loaded with the map each time it is run. The current method of saving is in the data/exploit folder, however eventually I want to change this, perhaps to use SQL.
[b]Usage:[/b]
To spawn the swep, if in a sandbox-derived gamemode it can simple be spawned from the Q menu, however if in another gamemode, such as Fretta, use the "blockexploits" command.
Mouse 1 = Place block
Mouse 2 = Increase Size
Shift + Mouse 2 = Decrease Size
Shift + Mouse 1 = Change block type
E + Mouse 1 = Open menu
R = Remove nearby blocks (around you, and around crosshair HitPos)
Shift = Highlight nearby blocks black (useful to see which blocks'll be removed)
_writeblocks - Saves blocks to file.
[b]Types of block:[/b]
[i]Repel up / down[/i] - Forcefully pushes the player out of said block.
[i]Death[/i] - Kills player.
[i]Hurt[/i] - Damages player with more damage as they move to the center of the block.
[i]Gimp[/i] - Gimps the player (PlayerSay)
[i]Light[/i] - Creates a gmod_light entity with the box. (Looking for a better way to do this, since the entity only exists in Sandbox, and when copied into Fretta, it still did not work.)
[i]Heal[/i] - Heals the player.
[i]Teleport[/i] - Odd number always teleports to the next even number, and even number teleports to the previous odd number. Teleport blocks can teleport to any block, not just other Teleport ones.
[i]Warning[/i] - Does nothing apart from print a message to the players chat, to warn them that they shouldn't be around this area.
[b]Screenshots:[/b]
[quote][url=http://cloud.steampowered.com/ugc/595813290838423798/EC1F85F7CF5809FB4EEFBF41943643713C6236D3/]Menu preview
[img]http://cloud.steampowered.com/ugc/595813290838423798/EC1F85F7CF5809FB4EEFBF41943643713C6236D3/[/img][/url][/quote]
[quote][url=http://cloud.steampowered.com/ugc/595813290847965164/D0DACE4B5629271BF9922E44934D59516DFEB349/]Some placed blocks
[img]http://cloud.steampowered.com/ugc/595813290847965164/D0DACE4B5629271BF9922E44934D59516DFEB349/[/img][/url][/quote]
[b]Download:[/b]
Well here you go, a first release. I'm going to label this a Beta, as although it's been through some rigorous testing the past few weeks on my Fretta server, there's probably some things we missed, and I plan to do a lot more with this, so again, suggestions and comments are welcome.
I apologise if there's any indentation mishaps. Notepad++ seems to do things oddly, and when the file is opened in regular notepad, some indentations are off.
Here's a download link:
[url]http://dl.dropbox.com/u/3287852/exploitblock.rar[/url] (Addon format)
(Should always be the latest version. Not planning to put it on garrysmod.org just yet. I'm sure there's things I could improve beforehand.)
[b]Credits:[/b]
Fantym420 - Helping out tremendously with the render beam drawing.
Overv - Server side chat.AddText()
ToNi - draw.Blur() function (from the WDYNHW thread)
[/release]
Looks useful, I'll have to try it out when i'm done with my contest entry, and thanks for the credit.
Before I even start looking at the code: Why not googlecode, why rar, aaahhhh.
Otherwise nice job with the concept. I was planning on making something remotely similar but just haven't found the motivation...for the past two years I think.
[QUOTE=Python1320;30280950]Before I even start looking at the code: Why not googlecode, why rar, aaahhhh.
[/QUOTE]
No real reason. Perhaps I'll move over to googlecode, but since this was originally just something I was using on my own server, it was much easier to simply have a dropbox folder junctioned directly into the server addons folder, so I could edit it from my home computer and it be updated in both locations.
Great work I love it :D and you <3
Amazing, thank you so much
[editline]6th June 2011[/editline]
A prop delete option would be nice, or a no-spawning zone with prop remover
DataStreamClient: Unhandled stream BlocksTable!
[lua]
datastream.Hook("BlocksTable",function(_,_,_,info)
if !info[1] then return end
if type(info[1]) != "table" then return end
MapBlocks = info[1]
end)
[/lua]
Works fine for me...
Perhaps the version I packed in the .rar has some syntax error in the client side file. Get any other errors? Try a lua_openscript_cl autorun/client/exploit.lua ?
I'm testing with debug messages now. Running it provided no errors clientside
[editline]6th June 2011[/editline]
I've been editing the clientside stuff on FTP and it isn't generating a cache on reboot
[editline]6th June 2011[/editline]
Also, it appears there isn't anything adding the materials to FastDL
[editline]6th June 2011[/editline]
I see why, AddCSLuaFile starts at the lua folder, not current directory
[QUOTE=Banana Lord.;30294381]I'm testing with debug messages now. Running it provided no errors clientside
[editline]6th June 2011[/editline]
I've been editing the clientside stuff on FTP and it isn't generating a cache on reboot
[editline]6th June 2011[/editline]
Also, it appears there isn't anything adding the materials to FastDL
[editline]6th June 2011[/editline]
I see why, AddCSLuaFile starts at the lua folder, not current directory[/QUOTE]
Right, the materials aren't added to any download list, forgot to do that, since I had them myself.
I thought AddCSLuaFile() was relative to the current dir, but as you can see, I did multiple of them, since I wasn't sure. It worked for me and other admins on my server, so I don't quite see why it wouldn't work for you ... how strange.
You have it adding lua/client/exploit.lua and lua/exploit.lua
it should be lua/autorun/client/exploit.lua
[editline]6th June 2011[/editline]
Well, this sucks. I've been trying to get it to work for at least 30 minutes now, so much for this :(
[QUOTE=Banana Lord.;30294645]You have it adding lua/client/exploit.lua and lua/exploit.lua
it should be lua/autorun/client/exploit.lua
[editline]6th June 2011[/editline]
Well, this sucks. I've been trying to get it to work for at least 30 minutes now, so much for this :([/QUOTE]
I don't really know what to suggest. I'll take a closer look tomorrow, but this has worked perfectly for multiple weeks on my server. Has anyone else got it to function correctly, or are others too having problems?
I'd just mention I was trying this in a listen server and a dedicated server and both had an issue where the clientside wasn't initializing (MapBlocks was nil)
[QUOTE=Banana Lord.;30301040]I'd just mention I was trying this in a listen server and a dedicated server and both had an issue where the clientside wasn't initializing (MapBlocks was nil)[/QUOTE]
Yeah... I'll take a closer look tonight after class. As of right now, I just can't see why this wouldn't work as it's been working for me for weeks, both on my dedicated server, and on my listen when I've been testing and developing. Just out of curiosity though, is any of the client side file initializing? For example, does e + left click with the tool tell you about an unhandled umsg?
Can't test it now since I'm leaving, but I added for i=1,100 MsgN(tostring(i)) end to the top of the client exploit.lua after fixing the AddCSLua and it seems to be initializing
Using [b][url=http://wiki.garrysmod.com/?title=G.DynamicLight]G.DynamicLight [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] would fix your lighting issues.
[QUOTE=Loures;30304150]Using [b][url=http://wiki.garrysmod.com/?title=G.DynamicLight]G.DynamicLight [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] would fix your lighting issues.[/QUOTE]
Thanks for that, very helpful.
Going to take a look into Banana Lord's issue shortly since I'm home again, but my first tests worked fine (removed all instances of the addon from my machine, downloaded the rar, and extracted.) I'd like to hear if anyone else is having the same issues, or if otherd have got it to work?
Double check that all your variables that can be local are, there might be a conflict with another addon. I haven't looked at the code i'm just guessing.
I haven't tried this yet, but it seems efficient at blocking off areas. An update would be to maybe add several "modes" to one block? So you can both warn, and hurt him. Just hurting him would probably just make him confused, and whine.
Also, is the boxedges seen for normal players?
[QUOTE=Fantym420;30306126]Double check that all your variables that can be local are, there might be a conflict with another addon. I haven't looked at the code i'm just guessing.[/QUOTE]
Right, I'll do that.
[QUOTE=Donkie;30306244]I haven't tried this yet, but it seems efficient at blocking off areas. An update would be to maybe add several "modes" to one block? So you can both warn, and hurt him. Just hurting him would probably just make him confused, and whine.
Also, is the boxedges seen for normal players?[/QUOTE]
Each block will print a message in the players chat, every 3 seconds, if they are still inside it.
The block edges can only be seen when you have the tool equipped.
Also, your overwriting chat.AddText will break many chatboxes including mine :(
[QUOTE=Banana Lord.;30313003]Also, your overwriting chat.AddText will break many chatboxes including mine :([/QUOTE]
I'm not overriding anything. It's a server side function, which normally doesn't exist, created by Overv. It just allows the use of chat.AddText() server side.
An update on your issue Banana:
I can't reproduce it, no matter what I do. It works for everyone on my server, and fine for me in my local server. Is anyone else experiencing the same problems / could people try it out when they get a chance?
Dropped straight onto a DarkRP server running wire + stuff like door tool, precision etc. No chat box or ui edits.
Client side error spam:
[lua]
[@weapons\blockexploits\shared.lua:180] bad argument #1 to 'pairs' (table expected, got nil)
[/lua]
Server side on map load:
[lua]
[addons\exploitblock\lua\autorun\client\exploit.lua:22] '(' expected near '.'
[addons\exploitblock\lua\autorun\util.lua:2] ERROR PARSING CLIENTSIDE FILE: 'autorun/client\exploit.lua'
[addons\exploitblock\lua\autorun\client\exploit.lua:22] '(' expected near '.'
[addons\exploitblock\lua\autorun\util.lua:3] ERROR PARSING CLIENTSIDE FILE: 'autorun\client\exploit.lua'
[/lua]
[editline]7th June 2011[/editline]
Edit/Merge:
Should you not add credit for
[url]http://www.facepunch.com/threads/1068418-What-do-you-need-help-with-V2?p=29862757&viewfull=1#post29862757[/url]
:)
[editline]7th June 2011[/editline]
Another edit/Merge
I made function draw.Blur( panel ) a global instead of local, fixed it instantly *_*. No idea why, maybe I had to double restart the server for the cache, although I can't see why it wouldn't generate it properly.
either way, it works fine now I changed the function to global. Now I shall remove it as I don't need it atm, I was just bored and randomly helpful *_*
Thanks a lot Pantho. Indeed I should add credit for that function, completely forgot to. To be honest, I don't think I actually ended up using it anywhere, but still included it anyways ;)
Updated download.
[img]http://gyazo.com/f031b74e43d9a0cc6c62b39edad2d2fe.png[/img]
Testing the new one on my server now. You still have the bad AddCSLuas in there :(
[editline]7th June 2011[/editline]
Also nothing adding resources still
[editline]7th June 2011[/editline]
Download from the OP that you said was updated throwing errors
[img]http://gyazo.com/2dc0e716baeb6da725e31678f5339b0c.png[/img]
:<
[QUOTE=Banana Lord.;30318335][img]http://gyazo.com/f031b74e43d9a0cc6c62b39edad2d2fe.png[/img]
Testing the new one on my server now. You still have the bad AddCSLuas in there :(
[editline]7th June 2011[/editline]
Also nothing adding resources still[/QUOTE]
The resources don't actually _matter_. All the materials are, is the VGUI icon in the spawnmenu. I'll write it down to include in the next update though.
If you still get errors; I don't know what to say. It works for Pantho it seems (after the silly errors of mine), and it works for all of the users of it in my server. Perhaps it's something really specific that I haven't thought of.
EDIT:
Those errors indicate to me that the client side file isn't being run... I don't know why. I just tested the version I uploaded and it works fine for me... What other addons and things do you have running, as I can only assume this issue is unique to your setup, since no one else has reported such a problem. (Pantho's errors were caused because the client side file had a syntax error. After fixing that, the errors no longer occurred, so thus, it only makes sense that the client side file is not initialising for you, for whatever reason.)
[QUOTE=Banana Lord.;30319146]addons
[img]http://gyazo.com/ea9d85f2df45b21dfafe9fec6c809c5d.png[/img][/QUOTE]
Nothing screams out at me, but then again, I don't know any of those well enough to make any real conclusions. Do me a huge favour and rename your addons folder to addons_old or something, and only run this? That'll quickly determine if there is any kind of confliction.
Well uhm, I'd have to lock my server, which I'd rather not, but I guess I can.
On the bright side, this works in a listen server!!
[img]http://gyazo.com/f4faa0456b56540536c172a54e5206db.png[/img]
[QUOTE=Banana Lord.;30319390]Well uhm, I'd have to lock my server, which I'd rather not, but I guess I can.
On the bright side, this works in a listen server!!
[img]http://gyazo.com/f4faa0456b56540536c172a54e5206db.png[/img][/QUOTE]
Fantastic to hear. For me, it works fine both in my listen server, and dedicated. At least we're getting somewhere though, eh? :p (Side note, but those render beams seem to be drawn, oddly in your screenshots. Perhaps it's just the quality, or resizing, or something.)
I do apologise if I'm not being of much help; I'm new to this whole Lua scene, and especially new to releasing my work publicly.
Sorry, you need to Log In to post a reply to this thread.