VMF CopyGun - by aVoN aka System of a pWne!^
Copyright (C) 2006 Klaus Zipfel

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


Thanks to:
H-=NooB=- 
	  for coding some parts for me and helping,
	  his XME menu-engine and the _Hud library
Anders1
	  for allowing me to add his DBLoader to this script

visit my Server: www.fredbert.de:27016 - System of a pWn's

###############################################################
###############################################################
###############################################################
###############################################################


**** Installation
Windows:
Execute the file "VMFCopyGun - Installer.exe" to install the script to your gmod9 folder. It will find the correct folder automaticly, when you have installed steam corrrectly.

Linux/Windows dedicated servers:
Simply copy all content of the zip files "source" folder to your dedicated server's "gmod9" folder.


**** Configuration
There are 4 configuration files

VMFCopyGun\config\config.ini
	Stores all configuration datas inside. Open it with any text editor and change the neccessary values. All you need to 
	know is documentated in that file.

VMFCopyGun\config\groups.ini
	Defines the groups, where users can get put into.
	To add a group, simply add a new line at the bottom of the file, which starts with '[group]' and add one of the keys below.
	The groups have different keys.
		name							-	Defines the groups name
		flag							-	A single character like e.g. "a". Any user with the same flag as the group has, will get into this group
											BUT MENTION! This is case-sensitive. The flag "a" is not the same as the flag "A". And it's only ONE character!
		access						-	The access, people in this group will have. Anything you need to know for this is explained in the 'groups.ini'!
		spawntimeout				-	The time, people in this group have to wait, until they can spawn a next copy.
		maxpreviewammount		-	When set, the users in this group have a limited preview. But they can select more props! (for performance)
		maxsaveammount			-	Maxammount of selectable and savable props. Users can't select more props as defined in here
		minsaveammount 		- Minimum of props needed for a save. This is added to reduce 5-Second saves
		accessfunction			-	You can also define an accessfunction for a group. This Lua-function gets automaticly called by the script 
											and sets any person into this group, when it returns true on his userid. Here is an example for the ULX
											function 'hasAccess':
												accessfunction=hasAccess(userid,"a")
											Any user, who has the ULX flag "a" will get into this group now. The variable 'userid' will get automaticly
											replaced by the script with the user's id, who gets checked.
	

VMFCopyGun\config\users.ini
	To add a user, simply add a new line at the bottom of the file, which starts with '[user]'
	Then, add one of the keys, which are the same as the one in the groups.
	You can use all keys, except the accessfunction key, which is for groups only.


VMFCopyGun\config\defines\vehiclescripts.ini
	This file stores the vehiclescripts for special vehicles like gmow3,vmod or cmod in it. You can add more custom vehicles to it
	by adding a new line with '[vehicle]'. Now, set the 'model' key to the new vehicle's model and the 'vehiclescript' key to the vehicle's script


**** Ingame usage

Public commands
	vmfcg_swep <1-6>			- Spawns the selecttools. 1 = Select Tool, 2 = Sphere Select Tool, 3 = Quad Select Tool, 4 = SmartSelect tool, 5 = VMFRemover, 6 = All tools
	vmfcg_menu					- Opens the pattern menu.
	vmfcg_mymenu				- Opens the private pattern menu, where all your own patterns are located
	vmfcg_vmfmenu				- Loads the VMFLoader menu
	vmfcg_load <name>			- Loads a pattern
	vmfcg_save <name>			- Saves a pattern
	vmfcg_asave <name>		- Saves a selectin absolutely
	vmfcg_xsave <name>		- Saves a maps whole props
	vmfcg_rotate <0-360>		- Rotates a pattern
	vmfcg_height <number>	- Changes patterns spawnheight
	vmfcg_delete <name>		- Deletes a pattern
	vmfcg_restore <name>		- Restores a pattern

Admin only
	vmfcg_reload					- Reloads the script
	vmfcg_kreload					- Kills the script and reloads it
	

All commands above are for console only. To use them in chat, add a '!' infront of it. Example: !vmfcg_save <file>
But since version 0.45 RC2, there are several chatcommands in a short form. They are !save,!asave,!xsave,!load,!rotate,!height,!menu,!mymenu,!vmfmenu,!delete,!restore


When opened the menu, navigate with the movement keys up and down to cycle threw the entrys and use left and right to skip from one
menu to another


**** Problems
Make sure, these files exists and have content:

Open gmod9/lua/include:

    * backcompat.lua
    * concommands.lua
    * defines.lua
    * eventhook.lua
    * events.lua
    * luathink.lua
    * misc.lua
    * player.lua
    * timers.lua
    * vector3.lua

Then, go to gmod9/lua/init and open the init.lua
What's it's content? It HAS to look like this:

########### INIT.LUA START ###########

-- !! DO NOT edit this script. !!
 
-- Any scripts dropped into the init/ folder are automatically run on startup.
 
-- This is the only script called when the game starts up
-- It should be used to initialize and call other scripts
 
-- Do not use the default LUA method to call other scripts
--  because it will be trying to open the files from the
--  folder with hl2.exe in it.
-- Instead use the function _OpenScript( <scriptname> )
_OpenScript( "includes/defines.lua" );
_OpenScript( "includes/concommands.lua" );
_OpenScript( "includes/backcompat.lua" );
_OpenScript( "includes/vector3.lua" );
_OpenScript( "includes/luathink.lua" );
_OpenScript( "includes/player.lua" );
_OpenScript( "includes/misc.lua" );
_OpenScript( "includes/events.lua" );
_OpenScript( "includes/timers.lua" );
_OpenScript( "includes/eventhook.lua" );
 
-- Open the default game script incase one isn't run later.
_OpenScript( "gamemodes/default/init.lua" ); 

########### INIT.LUA END ###########

When one or more of these files do not exist or have empty content, reinstall gmod. Or the script WILL NOT work!