CUPack -- Official Release

[release]
Name: CUPack - Cow’s Useful Pack

Description: A serverside script pack for Garry’s Mod, makes adding scripts easy.

Created By: Chaotic Cow & Polly aka raBBish

Note: Yes I am “Chaotic Cow”
[/release]

[release]Features:
-Loads of useful/Fun Commands

-Use either “!” or “/” to start the command!

-Easy plugin creation {Easily make it admin only command, Easily give it a chat command without making the function look for it, Adds itself to command list, and etc.}

-Easy plugin deletion {Just delete the plugin you don’t want! When a plugin is deleted it removes itself from the command list}

-Send custom errors to chat {return “Sorry, only admins have access to that!”}

-Every command gets a Console Command { All ConCmds start with “cup” – Example: cup roll 9999 }

-Updates Via SVN
[/release]

[release]
Plugins that come with the pack:
afk - Away From Keyboard
bhop - Hop like a bunny
burp - Buuuurrrppp!
chat - Chat with color! Example: /chat ^900 Hello! --Will Display Hello! in RED!–{RGB Scale is 0-9}
flip - Flip a coin!
credits - See a list of people who contributed!
setspawn - Set a custom spawn point!
resetspawn - Reset your spawn point!
roll - Roll a die and get a random interger!
dyk - Get a random Did You Know question!
dropwep - Drop the weapon you are holding!
explode - Explode yourself or others!
freeze - HALT! Freeze people in place!
sid - Get somebody’s steamid!
ghost - Ghost a prop!
help - Either display command list or information on a command!
boost - Break the sound barrier! Increase your sprint speed!
jboost - Achieve escape velocity! Increase jump velocity!
pos - Teleport to world position of your choice!
poslocal - Teleport to local position of your choice!
suicide - Die with some honor!
setmodel - Set your player model!
warp - Woosh! Teleport to where you are looking!
uptime - See how long the server has been up!
time - Get current time!
tent - Name a prop then teleport to it!
reload - Reload the plugins!
[/release]

[release]
DO NOT DELETE:
notify.lua
info.lua
Deleting these plugins will break the addon!
[/release]

[release]
Download:
SVN: http://subversion.assembla.com/svn/cupack
GMOD.ORG: http://www.garrysmod.org/img/?t=dll&id=68838

** Bug Reporting & Contributing:**
http://www.assembla.com/spaces/cupack/tickets
[/release]

[release]
Creating Plugins & Plugin Format:
Wiki: http://www.assembla.com/wiki/show/bpDj0aprmr3Qs_eJe5aVNr

Plugin Format:
[lua]CUPack:ChatPrint( ply, Color(255, 128, 0), “Text here”, Color(128,128,0), “More text”, etc. )
–Prints coloured text in player’s chat
–Almost the same syntax as with chat.AddText
–First argument can be either a single player or a table of players
CUPack:ConPrint( ply, “Text here” )
–Prints text in player’s console
–Either single player or a table

CUPack:Version()
–Returns two values, first CUPack core revision, second plugin revision

–Giving an error in plugin:
return “Error text”

–Or to end without an error:
return “”[/lua]

Example Plugin:
[lua]local tyme = {}

tyme.name = “The Time” --Print name
tyme.cmd = “time” --Command (ie. “cup time” in console or “/time” in chat

tyme.adminsOnly = false --Are non-admins able to use this
tyme.reqArgs = 0 --Minimum amount of arguments

tyme.help = {} --Help text to be printed with help command
tyme.help[1] = “Displays current time!”

tyme.help[2] = “Usage: [!/]time”
tyme.help[3] = "Admins only: " … tostring(tyme.adminsOnly) … ", required arguments: " … tyme.reqArgs

–Function to be called
function tyme.Function(ply, args)
CUPack:ChatPrint(player.GetAll(), Color(255,255,0), os.date(“The time is %I:%M:%S %p”) )
end

–Adds the table in plugins
CUPack:AddCommand(tyme)
[/lua]

Example plugin using targeting helper:
[lua]
local sid = {}

sid.name = “Get SteamID”
sid.cmd = “sid”

sid.adminsOnly = false
sid.reqArgs = 1

sid.needTarget = true --If true, the function will have a third argument, target

sid.help = {}
sid.help[1] = “Gets SteamID of given player!”

sid.help[2] = “Usage: [!/]sid <name>”
sid.help[3] = "Admins only: " … tostring(sid.adminsOnly) … ", required arguments: " … sid.reqArgs

–Still the function to be called
function sid.Function(ply, args, target)
–Third argument is the player found with text someone typed
–Example: “/sid pol” would find someone named Polly
–"/sid @me" targets the caller

local sid = target:SteamID()
local name = target:GetName()

if sid != "" then  
	CUPack:ChatPrint(ply, name.."'s SteamID is : "..sid)
end

end

CUPack:AddCommand(sid)
[/lua]

Example using restricted gamemode access for commands:
[lua]
local dropwep = {}

dropwep.name = “Drop Weapon”
dropwep.cmd = “dropwep”

dropwep.adminsOnly = false
dropwep.reqArgs = 0

–Allows command to be only used in Gamemodes choosen!
– In this example this command can only be used in Sandbox or darkRP
–You can add as many gamemodes as you like.
– Remove it completely to allow all Gamemodes!

dropwep.gm = {“sandbox”,“darkrp”}

dropwep.help = {}
dropwep.help[1] = “Buttery Fingers! Drop your current weapon!”
dropwep.help[2] = “Usage: [!/]dropwep”
dropwep.help[3] = "Admins only: " … tostring(dropwep.adminsOnly) … ", required arguments: " … dropwep.reqArgs

function dropwep.Function(ply, args)
local wep = ply:GetActiveWeapon():GetClass()
CUPack:ChatPrint(ply, Color(100, 255, 50, 255), "You dropped your ",Color(255, 100, 50, 255), wep, “!”)
if (ply:GetActiveWeapon():IsValid()) then
ply:DropWeapon(ply:GetActiveWeapon())
end
end
CUPack:AddCommand(dropwep)
[/lua]

** Adding a Hook:**
[lua]
local notify = {}

–This cmd.name is used as hook ID
notify.name = “Spawn Notify”

notify.cmd = “notify”
–Hook name here
notify.hook = “PlayerInitialSpawn”

–Function the hook calls
function notify.Function(ply)
CUPack:ChatPrint(ply, Color(0,255,0,255), "Hi! Welcome to ", Color(255,0,0,255), GetHostName(), “!”)

CUPack:ChatPrint(ply, Color(0,255,0,255), "The server's gamemode is ", Color(255,0,0,255),GAMEMODE.Name,"!")

CUPack:ChatPrint( ply, Color(0,255,155,255), "Type [!/]help for information and a list of the commands!" )

end
–Adds the hook in CUPack tables
CUPack:AddCommand(notify)
[/lua]

[/release]

[release]
Special Thanks To:
http://gmodengineers.com
For letting us use their server for testing purposes.
[/release]

Does this conflict with NewAdmin? (Just wondering and If it does’nt then… GREAT!)

Btw good job. It looks really good :D.

No it does not.

BUT

If a server has NewAdmin you have to use “/” and not “!” because NewAdmin won’t let people use commands starting with “!” unless it’s part of NewAdmin.

Just to let everyone know. I updated CUPack. Fixed a few typos and stuff. Nothing Major.

So I Uploaded the new version onto GMOD.ORG

I dont get it. So is it like a admin mod? Or what

No. It’s an addon with a bunch of mini-scripts.

It allows easy way to add a script to a server with lots of options.

Like: Gamemode Only, Admin Only ,etc.