Compare commits

...

1 Commits

Author SHA1 Message Date
bb27299d3c Prepare for github & add license 2020-01-22 15:25:58 +01:00
17 changed files with 211 additions and 1 deletions

89
.gitignore vendored Normal file
View File

@ -0,0 +1,89 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.gitignore.io/api/windows,visualstudiocode,lua
# Edit at https://www.gitignore.io/?templates=windows,visualstudiocode,lua
### Lua ###
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/windows,visualstudiocode,lua
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

7
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"cSpell.words": [
"Vogel",
"garrysmod",
"pointshop"
]
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 David Vogel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28
README.md Normal file
View File

@ -0,0 +1,28 @@
# D3stats
A simple addon managing map statistics and player levels.
- It outputs statistics about the win ratio of a map at the begging of a round
- It gives the players a level, XP and permission to use or buy the hammer
- XP is earned by gaining pointshop points as human or by killing humans as zombie
- Player levels increase after gathering a certain amount of XP
- Permissions are given after a specific level is reached
- All those things are freely configurable
## State
It works, but the addon is not finished, and probably will not be finished in the forseeable future.
## Usage
- Create a folder called `d3stats` inside of your addon folder of your Garry's Mod server
- Copy files by either:
- Clone the repository inside the created folder
- If you download the repository as zip, move the **content** of `D3bot-master` inside the created folder
- You should get a folder structure like: `.../garrysmod/addons/d3stats/lua`
- You can change settings as you wish inside of `.../garrysmod/addons/d3stats/lua/d3stats/sh_settings.lua"`
- Done
## License
[MIT](LICENSE)

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
if SERVER then
include("d3stats/init.lua")
else

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
-- Delete HUD and redo if already existent. This will reset the displayed values until the next update from the server
if D3stats.D3statsOverlay then
D3stats.D3statsOverlay:Remove()

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
D3stats = D3stats or {}
-- Includes

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
net.Receive("D3stats_UpdateXP", function()
local XP = net.ReadUInt(32)

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
--[[
Any "zombie survival" gamemode specific code goes in here

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
--[[
XP and statistics addon for the "Zombie Survival" gamemode

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
if SERVER then
concommand.Add("D3stats_clearall", function(ply, cmd, args, argsString)

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
-- Calculate the level from the given XP
function D3stats.CalculateLevel(XP)
local Level = 1

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
--[[
Settings and level definitions are stored in here
@ -7,7 +12,7 @@ Settings and level definitions are stored in here
-- Permissions
-- - Everything not in this list will be allowed by default
-- - AllowIfLessThan: If the amount of players who have the permission is lower than this number, allow it anyway
-- - Team: AllowIfLessThan only counts the specified team. In ZS: TEAM_SURVIVOR = 4,
-- - Team: Only counts "AllowIfLessThan" in the specified team. In ZS: TEAM_SURVIVOR = 4,
D3stats.Permissions = {
--["Buy_Hammer"] = {AllowIfLessThan = 4, Team = 4},
--["Use_Hammer"] = {AllowIfLessThan = 4, Team = 4},

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
function D3stats.Map_Message(roundend, ply)
local map = game.GetMap()
local count, wins, avg_players = D3stats.Storage.Map_Get(map)

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
util.AddNetworkString("D3stats_UpdateXP")
local meta = FindMetaTable("Player")

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
--[[
Storage stuff

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2020 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local PANEL = {}
function PANEL:Init()