SHOW:
|
|
- or go back to the newest paste.
| 1 | -- All of this is from my admin mod | |
| 2 | Hats = {}
| |
| 3 | -- RegisterPlugin | |
| 4 | -- Not really necessary, but helps to make it simpler to add shit | |
| 5 | function Hats.RegisterHat(name, tab) | |
| 6 | name=name or tab.Name or nil | |
| 7 | if !name then return end | |
| 8 | Hats.hatdatabase[name]=tab | |
| 9 | print("poo")
| |
| 10 | end | |
| 11 | ||
| 12 | --Example plugin | |
| 13 | ||
| 14 | ||
| 15 | -- Loading files from a folder | |
| 16 | function Hats.LoadHats() | |
| 17 | for f, v in pairs(file.Find( "autisme/gamemode/hats/*.lua", LUA_PATH )) do | |
| 18 | AddCSLuaFile("autisme/gamemode/hats/"..v)
| |
| 19 | include("autisme/gamemode/hats/"..v)
| |
| 20 | end | |
| 21 | end | |
| 22 | ||
| 23 | hook.Add("Initialize", "loadhatPlugins", function()
| |
| 24 | MsgN("======================")
| |
| 25 | Hats.LoadHats() | |
| 26 | MsgN("======================")
| |
| 27 | Hats.InitPluginsLoaded=true | |
| 28 | end) | |
| 29 | ||
| 30 | -- this is in a separate file in autisme/gamemode/hats | |
| 31 | ||
| 32 | local hat={}
| |
| 33 | ||
| 34 | hat.Name="brotato" | |
| 35 | hat.Price=9001 | |
| 36 | hat.Model="potato.mdl" | |
| 37 | - | hat.RegisterHat("brotato", hat) |
| 37 | + | Hats.RegisterHat("brotato", hat) |