ULX

Author Topic: Banning Larger Props  (Read 17644 times)

0 Members and 1 Guest are viewing this topic.

Offline Beans2

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Banning Larger Props
« 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

Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Banning Larger Props
« Reply #1 on: January 26, 2007, 04:10:37 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

I thought ULX already did this.
If you doubt your powers you bring powers to your doubts.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Banning Larger Props
« Reply #2 on: January 26, 2007, 06:42:05 PM »
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.


"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Beans2

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Banning Larger Props
« Reply #3 on: January 26, 2007, 10:02:38 PM »
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?

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Banning Larger Props
« Reply #4 on: January 28, 2007, 10:47:31 AM »
Code: [Select]
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 have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Banning Larger Props
« Reply #5 on: January 28, 2007, 01:59:33 PM »
Code: [Select]
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. =)
If you doubt your powers you bring powers to your doubts.

Offline Zyklus

  • Full Member
  • ***
  • Posts: 109
  • Karma: 1
Re: Banning Larger Props
« Reply #6 on: January 29, 2007, 01:03:09 PM »
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.

Offline Beans2

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Banning Larger Props
« Reply #7 on: February 03, 2007, 12:13:28 AM »
Code: [Select]
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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Banning Larger Props
« Reply #8 on: February 03, 2007, 12:19:56 AM »
Always, always, always use linux notation on anything anywhere unless specifically stated otherwise.
Experiencing God's grace one day at a time.

Offline Beans2

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Banning Larger Props
« Reply #9 on: February 03, 2007, 12:24:34 AM »
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
« Last Edit: February 03, 2007, 01:07:38 AM by Beans2 »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Banning Larger Props
« Reply #10 on: February 03, 2007, 09:47:17 AM »
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Dr.Roxor

  • Newbie
  • *
  • Posts: 10
  • Karma: 2
Re: Banning Larger Props
« Reply #11 on: February 03, 2007, 08:18:03 PM »
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):

Code: [Select]
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.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Banning Larger Props
« Reply #12 on: February 04, 2007, 01:15:05 AM »
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.
Code: [Select]
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 )
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Dr.Roxor

  • Newbie
  • *
  • Posts: 10
  • Karma: 2
Re: Banning Larger Props
« Reply #13 on: February 04, 2007, 06:05:16 AM »
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.

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Banning Larger Props
« Reply #14 on: February 04, 2007, 06:52:56 AM »
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.
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage