Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: Beans2 on January 25, 2007, 01:18:04 PM
-
Hi, im pretty sure theres a way to do this but i want to be able to ban larger props (i.e. Towers, Trains, larger buildings, and anything that just makes servers lag) but at this point im not sure how to do that. Any suggestions would be great.
Thnx
Beans
-
Hi, im pretty sure theres a way to do this but i want to be able to ban larger props (i.e. Towers, Trains, larger buildings, and anything that just makes servers lag) but at this point im not sure how to do that. Any suggestions would be great.
Thnx
Beans
I thought ULX already did this.
-
I don't think since ULX v1.something.
It had a prop protect, and I think also had a block item table.
When v2 came out, one was never written in. Many reported problems (I myself had them) with the one included with v1.
I think Megiddo considered writing another one, or at least a plug in, but think that PropProtector for Gmod9 was popular enough that he didn't.
-
But the only problem with that is.... well lots of people have switched over to Gmod 10. I was thinking but havent tested it yet that I could just go into the list of props and either make the problem props comments or rename them. Has anyone else tried this?
-
local models = { "path to model1", "path to model2", ... }
local function blockmodels( ply, mdl )
for _,v in ipairs( models ) do
if mdl == v then
return false
end
end
end
hook.Add( "PlayerSpawnProp", "blockmodels", blockmodels )
Copy and paste the above code into notepad and save it to the "lua/autorun/server" folder with extension ".lua".
Add your models in the models table.
Note: This is untested.
-
local models = { "path to model1", "path to model2", ... }
local function blockmodels( ply, mdl )
for _,v in ipairs( models ) do
if mdl == v then
return false
end
end
end
hook.Add( "PlayerSpawnProp", "blockmodels", blockmodels )
Copy and paste the above code into notepad and save it to the "lua/autorun/server" folder with extension ".lua".
Add your models in the models table.
Note: This is untested.
I suggest making that script let you spawn a prop at least once a minute. =)
-
I think the easiest way is to test for bounding boxes. If the bounding box of a model that is going to be spawned exceeds (x, y, z), then block the spawn and notify server admin for permission to spawn a prop this size.
-
local models = { "path to model1", "path to model2", ... }
local function blockmodels( ply, mdl )
for _,v in ipairs( models ) do
if mdl == v then
return false
end
end
end
hook.Add( "PlayerSpawnProp", "blockmodels", blockmodels )
Copy and paste the above code into notepad and save it to the "lua/autorun/server" folder with extension ".lua".
Add your models in the models table.
Note: This is untested.
Could you by chance tell me what path syntax i should use for the script?
Beans
-
Always, always, always use linux notation on anything anywhere unless specifically stated otherwise.
-
Ya i got that but relative to where? game root? system root?
I attempted to use models/Effects/splode.mdl in the script and
it didn't work.
Beans
-
Beans, paste all of what you have in your 'banned' lua file here, including the actual script.
I'd like to see, test it myself.
Enclose it in the code tag for us. Thanks.
-
Hi.
Beans is one of our admins and he was actually helping me out with this issue. Since it requires a little more granular discussion, I decided to register.
First, Thanks for the professional code. You guys have worked hard and it shows.
Here is the implementation of the script as I have tried it, based on your post(s):
local models = { "models/Effects/splode.mdl" }
local function blockmodels( ply, mdl )
for _,v in ipairs( models ) do
if mdl == v then
return false
end
end
end
hook.Add( "PlayerSpawnProp", "blockmodels", blockmodels )
That was the example we tried. Had it been successful, we'd have added more to the model table.
We saved it as: lua/autorun/server/blockmodels.lua and restarted the srcds server binary. When the server was initializing, I saw no console evidence of an error. Interestingly, I also saw nothing to confirm that the script was even being loaded, and when I tried to spawn the splode.mdl, it let me.
On a slightly different note, I am looking to hire a lua coder for the prevailing wages, and we have more than 50 hours of work, easily. Anyone here interested, let me know via PM. Thanks for all your feedback and help with this.
Regards-
PS: I am assuming this post is within your TOS here, but if not please scrap it and accept my apologies.
-
Dr. Roxor,
This shouldl work. Worked for me. Not tested with many other scripts though, there may be conflicts.
Doesn't truly stop it before its loaded, but, will hopefully do the trick for you.
I didn't have time to research actual prevention. Though I think spbogie's code should work, I couldn't get it to.
I've included extra 'Spawn' hooks to look out for. (Vehicles,Ragdolls,SENTS,Props,Effects)
Regarding the root location, far as I can tell, you just add to the table the path that shows up when you hold your mouse over the client button.
If you have problems, let us know.
local models = { "models/Effects/splode.mdl", }
local function blockmodels( ply, mdl, ent )
for _,v in ipairs( models ) do
if string.lower(mdl) == string.lower(v) then
ent:Remove()
end
end
end
Msg("********** Simple Model Blocker Loaded\n*\n")
hook.Add( "PlayerSpawnedProp", "blockprops", blockmodels )
hook.Add( "PlayerSpawnedEffect", "blockeffects", blockmodels )
hook.Add( "PlayerSpawnedVehicle", "blockvehicles", blockmodels )
hook.Add( "PlayerSpawnedSENT", "blocksents", blockmodels )
hook.Add( "PlayerSpawnedRagdoll", "blockragdoll", blockmodels )
-
OKAY- IT'S OFFICIAL:
You sir, are a good eSamaritan. ;D Thanks for the patience and thanks for the help.
I will try the script again with your edits. I noticed you added the comma to the end of the table (right before the closing bracket), was not having that my problem perhaps?
Anyways, we'll give her a shot and see what happens.
Cheers.
-
JamminR, the problem with what you just posted is that not all PlayerSpawned... hooks pass the same thing. (ie. Vehicle only passes the player and the vehicle entity, same with SENT.)
Dr.Roxor, I will spend some time later testing and try to get something together that works for you.
-
Bah. So ent:Remove would error out, and the hook would be removed.
Sorry Dr. Roxor.
I learn as I go.
Garry's mod wiki (and seemingly, all other www (not forum) sites of GMod) was down when I tried visiting, so I couldn't check the passed information.
(Yes, I could have tested, but it was ~4am my time, and I had work to do from home @ noon today. App Server upgrades, gotta love them)
-
Ok, I've had time to sit down and test a little and have come up with a working script.
local models = { "models/Effects/splode.mdl", "crane_frame.mdl" } --All or part of model name.
local function blockPropsEffects( ply, mdl )
for _, v in pairs( models ) do
if string.find( mdl, v ) then
return false
end
end
end
hook.Add( "PlayerSpawnProp", "blockProps", blockPropsEffects )
hook.Add( "PlayerSpawnEffect", "blockEffects", blockPropsEffects )
Essentaily the same as the origional one I posted, but effects need a seperate hook. It also now accepts any part of the model name, so you don't need the full. If you wanted you could block an entire folder.
-
Hi Guys!
Thanks for the effort on this. Sorry, work has had me doing other things besides GMOD stuff lately, hence the delay to respond.
Maybe now we can ban the use of huge-assed buildings and other server-crashers that spammers like to use in our Fight servers.
I will go try this code right now and then let you know my results. How Exciting!!!
Regards-
-
Implemented, tested, passed!
This method seems fairly lightweight being under what, 25 lines or so. My next question is regarding the use of this in high-slot public GMOD servers, particularly when I am blocking dozens of props. I am concerned that if I declare 100+ props in the model table, I will be making the script overhead begin to impact performance. Is this me just being paranoid? Maybe I can eliminate some of the overhead from parsing a huge model table by taking your advice and add entire folders. Thoughts?
An example of the server environment:
24 player slots
Sandbox mode
ULX v3.02 (of course)
WCA SoundPak v1.1
BlockProps.lua (authored by you guys, thanks again!)
No other scripts running.
PS- I also wanted to ask your permission to share this script with others, maintaining your credits of course. I am certain that many of our regular players would like to try the script on their servers. :)
-
Lua for loops and tables are (as many other code languages are) well optimized.
Though blocking folders would give you better performance over all, I'm thinking only micro, or at worst milli, seconds in time would be saved.
It's really up to you though.
I'll let spbogie speak as to sharing. I'm 98% sure he won't mind, as it's not ground breaking, it just fits our motto "Strinving for Simplicity"
-
>:( Don't you dare steal my script! >:(
;D JK, feel free to share it, modify it, claim it's yours, whatever. A script like this most any GMod scripter could have put together. It's just a matter of taking a little time to figure out the undocumented hooks. I think I'm actually going to use this for the example in the wiki documentation.
-
Hi,
Thanks for the grant. I know it is a small script, but it wasn't authored by me so I was compelled to ask. ;D
I'll try this in larger scale and let you know how it does with a full server. Thanks again for your help!
Regards-
-
Hi, i try to block the Naquada Bomb Entity.
local models = { "bomb.mdl" }
local function blockmodels( ply, mdl, ent )
entmdl = ent:GetModel()
for _,v in ipairs( models ) do
if string.find(entmdl, v, 1, true ) then
ent:Remove()
end
end
end
hook.Add( "PlayerSpawnedProp", "blockprops", blockmodels )
hook.Add( "PlayerSpawnedEffect", "blockeffects", blockmodels )
hook.Add( "PlayerSpawnedVehicle", "blockvehicles", blockmodels )
hook.Add( "PlayerSpawnedSENT", "blocksents", blockmodels )
hook.Add( "PlayerSpawnedRagdoll", "blockragdoll", blockmodels )
Its a Sent who is spawnable with a Stool.
I want restrict, that nonadmins cant spawn this Sent with the Adv Dupe.
But i didnt found the hook.
PlayerSpawnedSENT didnt worked.
Sry, bad English, im german.
Thanks DrTight
-
DrTight, see http://forums.ulyssesmod.net/index.php/topic,922.0.html
-
Doesnt work. Uppl and Targetfinder crashed the Server.
I need the Hook, whos called when a player spawn the Sent Naquadah Bomb.
DrTight