• Print

Author Topic: [TUTORIAL] Admin and Public VMF patterns using VMFCopyGun  (Read 5920 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
[TUTORIAL] Admin and Public VMF patterns using VMFCopyGun
« on: November 03, 2006, 10:29:45 am »
I think the default setup for VMFCopyGun and VMFLoader is perfectly horrible unless you're watching your server every waking moment, since it's so easy to flood out other users and spam props.

This tutorial will help you make two folders for VMF patterns: One that everyone can see, and one that only admins can see. You will be able to freely move props between these folders, add more, remove, etc.

So, here's a better alternative that I personally use.

Step 1: Preparation
Obviously, make sure you have VMFCopyGun installed and running properly... In these instructions, I was using VMFLoader v0.15 and VMFCopyGun v1.2 Final. I make no guarantees this will work with other versions.

Some lua programmer decided it would be a good idea to have a "virtual lua filesystem", which can contain entire directories in one file. This is all well and good unless you need to modify or move these files, which is exactly what we will be doing.

So, delete all files in lua/vmfloader/packs. You'll also need to delete the "contraptions" folder in the gmod9 root. Don't worry, you'll get the patterns that these files hold back in a moment.

For anyone who's interested, here's the code to extract from these "virtual filesystems". Simply set path to the folder containing the files to extract.

Code: Lua
  1. local path = "lua/vmfloader/packs"
  2. local files = _file.Find( path .. "/*.vpk" );
  3. for _, file in files do
  4.         obj = LuaVFS:new( path .. "/" .. file );
  5.         obj:extractFiles( path .. "/" .. string.sub( file, 1, -5 ) )
  6. end



Step 2: Installation
Grab the file http://ulyssesmod.net/betterVmfOrganization.zip and extract it to the gmod9 folder. You'll notice it contains the folder "admin contraptions" and "public contraptions". These folders represent their functionality just as you would expect.

Now, we need to configure VMFCopyGun and VMFLoader to recognize these new folders.



Step 3: Configuration
Go to lua/vmfloader/config.lua and find this line in it:
Code: Lua
  1. Folder:Add( "contraptions", "Contraptions", "" );

Replace that line with these:
Code: Lua
  1. Folder:Add( "public contraptions", "Public Contraptions", "" );
  2. Folder:Add( "admin contraptions", "Admin Contraptions", "h" );

The "h" from the admin contraptions line tells VMFLoader that the user must have access "h" to access these VMFs, change it to whatever you'd like.



Step 4: Testing
Go into your server and try the VMFCopyGun menu. If all is successful, you'll notice that if you're an admin, you see the admin and public patterns in the same section of the menu, but the admin patterns are a lighter shade of blue than the public ones.

Congrats! You're done!



Step 5: Fiddling
Since you don't have those awful virtual filesystems anymore, you can freely move things between the admin and public folder.

One thing you'll quickly notice, don't have a folder by the same name in both the public and admin folders, because it will have the same name in the menu as well and confuse you, the admin.

Have fun, and let me know if there's something missing from the tutorial!
« Last Edit: November 03, 2006, 08:56:16 pm by Megiddo »
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: [TUTORIAL] Admin and Public VMF patterns using VMFCopyGun
« Reply #1 on: November 03, 2006, 05:08:24 pm »
Megiddo - He may not make all the scripts you use, but he sure as can make most of them better.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print