Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CMAULTOP authored Apr 10, 2021
1 parent cfff864 commit 4a57dcf
Show file tree
Hide file tree
Showing 44 changed files with 4,025 additions and 0 deletions.
37 changes: 37 additions & 0 deletions lua/autorun/cmenu_load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

PIS = {}

local function Load()
local loader = Nexus:Loader()
loader:SetName("CMenu")
loader:SetColor(Color(48, 100, 255))
loader:SetAcronym("PIS")
loader:RegisterAcronym()
loader:SetLoadDirectory("infl_cmenu")
loader:Load("config", "SHARED", true)
loader:Load("core", "SHARED", true)
loader:Load("vgui", "CLIENT", true)
loader:Load("misc", "SHARED", true)
loader:Load("gamemodes", "SHARED", true)

for i, v in pairs(PIS.Gamemodes) do
if (v:GetDetectionCondition()()) then
PIS.Gamemode = v
end
end

if (!PIS.Gamemode) then
for i, v in pairs(PIS.Gamemodes) do
if (v:GetID() == "backup") then
PIS.Gamemode = v

break
end
end
end

loader:Register()
end

if (Nexus) then Load()
else hook.Add("Nexus.PostLoaded", "CMenu", Load) end
27 changes: 27 additions & 0 deletions lua/autorun/nexus_load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Nexus = {}

hook.Run("Nexus.PreLoaded")

if (CLIENT) then
include("nexus_framework/core/load.lua")
elseif (SERVER) then
include("nexus_framework/core/load.lua")
AddCSLuaFile("nexus_framework/core/load.lua")
end

local loader = Nexus:Loader()
loader:SetName("Framework")
loader:SetColor(Color(208, 53, 53))
loader:SetAcronym("Framework")
loader:RegisterAcronym()
loader:SetLoadDirectory("nexus_framework")
loader:Load("core", "SHARED", true, {
["load.lua"] = true
})
loader:Load("database", "SERVER", true)
loader:Load("vgui", "CLIENT")
loader:Load("vgui/modules", "CLIENT", true)
loader:Load("vgui/components", "CLIENT", true)
loader:Register()

hook.Run("Nexus.PostLoaded")
186 changes: 186 additions & 0 deletions lua/infl_cmenu/config/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@

PIS.Config = {}
PIS.Config.Pings = {}
PIS.Config.PingsSorted = {}
PIS.Config.PingSets = {}

local Color = Color

local yellow = Color(200, 200, 30)
local red = Color(200, 30, 30)
local blue = Color(30, 30, 200)
local ocean = Color(0,133,255)
local green = Color(30,200,30)
local info = Color(92,107,192)
local white = Color(255,255,255)
local black = Color(0,0,0)
local redy = Color(236, 136, 22)
local greeny = Color(87, 255, 3)
local violet = Color(160, 0 , 160)

function PIS.Config:AddMenu(id, mat, text, col, commands,cc)
self.Pings[id] = {
mat = mat,
text = text,
color = col,
commands = commands,
customcheck = cc,
id = id
}

table.insert(self.PingsSorted, id)
end


PIS.Config.Colors = {
Green = Color(46, 204, 113),
Red = Color(230, 58, 64)
}
PIS.Config.BackgroundColor = Color(44, 44, 44)
PIS.Config.HighlightTabColor = Color(200, 25, 35)
PIS.Config.HighlightColor = Color(193, 70, 40)

PIS.Config.DefaultSettings = {
PingSound = 1,
PingOffscreen = 1,
PingPulsating = 2,
PingOverhead = 1,
PingIconSet = 1,
Scale = 1,
DetectionScale = 1,
PingAvatarVertices = 30,
WheelDelay = 0.1,
WheelKey = MOUSE_MIDDLE,
InteractionKey = KEY_F,
WheelBlur = 1,
WheelScale = 1,
WheelMonochrome = 1
}


PIS.Config.WheelColors = {
[1] = { "Disabled", "none" },
[2] = { "White", color_white },
[3] = { "Blue", blue },
[4] = { "Red", red },
[5] = { "Green", Color(128, 177, 11) }
}


--[[
Синтаксис AddMenu:
1. id - делать таким же, как и название
2. иконка - писать только название, берется из materials/ping_system/
3. название - чек 1
4. цвет иконки - цвета есть на самом верху, но ничего не мешает тебе сделать их самому с помощью Color
5. действие: если сделать это массивом (чек Деньги), то кнопка будет включать в себя меню, если функцией - одно действие
6(необ). customCheck - в каких случаях игроку доступна кнопка
]]



local LeadCP = {}

hook.Add("loadCustomDarkRPItems","inflexible.CMenu",function()

LeadCP = {
[TEAM_MAYOR] = true,
[TEAM_CHIEF] = true,
}

end)



--[[-------------------------------------------------------------------------
Обьяснение функций
PIS.OpenTextBox - Заголовок,Вопрос игроку, команда (здесб пользователь вписывает нужные данные в поле)
PIS.OpenPlyBox - Заголовок, Вопрос игроку, команда (в отличии от OpenTextBox, здесь пользователь выбирает игрока из списка)
PIS.OpenPlyReasonBox - Заголовок,Вопрос игроку,Второй вопрос игроку, команда (полезно для команд по типу wanted, demote etc)
---------------------------------------------------------------------------]]

PIS.Config:AddMenu("Деньги", "money", "Деньги", green, {

{name = "Передать деньги", mat = "money_cheque", col = green, func = function() PIS.OpenTextBox("Передача денег","Сколько денег вы хотите дать этому игроку?", "/give") end},
{name = "Бросить деньги", mat = "money_drop", col = green, func = function() PIS.OpenTextBox("Бросить деньги на пол","Сколько денег вы собираетесь бросить на пол?","/dropmoney") end},
--{name = "Выписать чек", mat = "money", col = green, func = function() PIS.OpenPlyReasonBox("Выписать чек","Кому выписать чек?","На какую сумму?","/cheque") end},
{name = "Продать предмет", mat = "sell", col = green, func = function() RunConsoleCommand("say","/sell") end},


})

PIS.Config:AddMenu("RP Действия", "action", "RP Действия", red, {


{name = "Выбросить оружие", mat = "gun", col = red, func = function() RunConsoleCommand("say","/drop") end},
{name = "Реклама", mat = "broadcast", col = red, func = function() PIS.OpenTextBox("Реклама","Укажите текст рекламы","/advert") end},
{name = "Казино", mat = "casino", col = red, func = function() RunConsoleCommand("mcasino") end},
{name = "Dark WEB", mat = "darkweb", col = red, func = function() RunConsoleCommand("say", "!darkweb") end},
{name = "Заказать убийство", mat = "hitman", col = red, func = function() RunConsoleCommand("say","/rhit_openmenu") end},
{name = "Уволить", mat = "demote", col = red, func = function() PIS.OpenPlyReasonBox("Уволить игрока","Кого вы хотите уволить?","Укажите корректную причину увольнения","/demote") end},

--
--


})

PIS.Config:AddMenu("Экстренные службы", "emergency", "Экстренные службы", blue, {

{name = "Полиция", mat = "police", col = blue, func = function() inflexible.CallGuard.DoCall("cp") end},
{name = "Скорая помощь", mat = "medic", col = red, func = function() inflexible.CallGuard.DoCall("medic") end},



})

PIS.Config:AddMenu("Остальное", "mill", "Остальное", violet, {


{name = "Продать все двери", mat = "door", col = violet, func = function() RunConsoleCommand("say","/unownalldoors") end},
{name = "Смена имени", mat = "name", col = violet, func = function() PIS.OpenTextBox("Смена имени персонажа","Как Вас будут звать?","/rpname") end},
{name = "Случайное число", mat = "dice", col = violet, func = function() RunConsoleCommand("say","/roll") end},
{name = "Третье лицо", mat = "third_person", col = violet, func = function() RunConsoleCommand("third_person") end},
{name = "Пожаловаться на игрока", mat = "admin", col = violet, func = function() RunConsoleCommand("say","/r") end},
{name = "Emotes", mat = "emotes", col = violet, func = function() RunConsoleCommand("emotes") end},


})




PIS.Config:AddMenu("Flex-Pass", "money_bag", "Flex-Pass", yellow, function() RunConsoleCommand("say","/donate") end)

PIS.Config:AddMenu("Ссылки", "info", "Ссылки", info, {




{name = "Вконтакте", mat = "vk", col = ocean, func = function() inflexible.util:OpenURL("https://vk.com/im") end},
{name = "Контент", mat = "steam", col = black, func = function() inflexible.util:OpenURL("https://steamcommunity.com/sharedfiles") end},
{name = "Discord", mat = "discord", col = white, func = function() inflexible.util:OpenURL("https://discord.gg/11111") end},
{name = "Правила", mat = "document", col = white, func = function() inflexible.util:OpenURL("https://docs.google.com/document/d111") end},


})

PIS.Config:AddMenu("Меню полиции", "police", "Меню полиции", blue, {


{name = "Подать в розыск", mat = "police", col = red, func = function() PIS.OpenPlyReasonBox("Обьявить в розыск","Кого обьявить в розыск?","По какой причине?","/wanted") end},
{name = "Выдать ордер", mat = "police", col = red, func = function() PIS.OpenPlyReasonBox("Выдача ордера","Кому вы хотите выдать ордер?","Обьясните свой выбор.","/warrant") end},
{name = "Выдать лицензию", mat = "license", col = white, func = function() RunConsoleCommand("say", "/givelicense") end, customcheck = function(ply) return inflexible.LeadCP[ply:Team()] end},
{name = "Начать ком. час", mat = "warning", col = redy, func = function() RunConsoleCommand("say", "/lockdown") end, customcheck = function(ply) return ply:isMayor() && !GetGlobalBool("DarkRP_LockDown") end},
{name = "Окончить ком. час", mat = "warning", col = greeny, func = function() RunConsoleCommand("say", "/unlockdown") end, customcheck = function(ply) return ply:isMayor() && GetGlobalBool("DarkRP_LockDown") end},

},function(ply) return ply:isCP() end)



PIS.Config:AddMenu("Список заказов", "hitman", "Список заказов", red, function() RunConsoleCommand("say","/hits") end, function(ply) return ply:Team() == TEAM_HITMAN end)
22 changes: 22 additions & 0 deletions lua/infl_cmenu/core/gamemodes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PIS.Gamemodes = {}

local GAMEMODE = {}

AccessorFunc(GAMEMODE, "m_name", "Name")
AccessorFunc(GAMEMODE, "m_id", "ID")
AccessorFunc(GAMEMODE, "m_viewCondition", "ViewCondition")
AccessorFunc(GAMEMODE, "m_pingCondition", "PingCondition")
AccessorFunc(GAMEMODE, "m_commandCondition", "CommandCondition")
AccessorFunc(GAMEMODE, "m_interactionCondition", "InteractionCondition")
AccessorFunc(GAMEMODE, "m_detectionCondition", "DetectionCondition")
AccessorFunc(GAMEMODE, "m_players", "Players")
AccessorFunc(GAMEMODE, "m_onDeath", "OnDeath")
AccessorFunc(GAMEMODE, "m_displaySubtitle", "SubtitleDisplay")

function GAMEMODE:Register()
PIS.Gamemodes[self:GetID()] = self
end

function PIS:GetGamemode()
return table.Copy(GAMEMODE)
end
63 changes: 63 additions & 0 deletions lua/infl_cmenu/core/sql.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
if (SERVER) then return end

function PIS:GetServerID()
return game.GetIPAddress() or "192.168.0.0:27015"
end

function PIS:CreateSQLTables()
sql.Query([[
CREATE TABLE IF NOT EXISTS nexus_psi_settings (
id TEXT(50),
settings TEXT(4000),
PRIMARY KEY (id)
)
]])
end

function PIS:LoadSettings(ply)
local id = sql.SQLStr(PIS:GetServerID())

local result = sql.Query([[
SELECT * FROM nexus_psi_settings
WHERE id = ]] .. id
)

if (istable(result) and #result > 0) then
PIS:SetSettings(ply, util.JSONToTable(result[1].settings))
end
end

function PIS:SaveSettings(ply)
local settings = sql.SQLStr(util.TableToJSON(self:GetSettings(ply)))
local id = sql.SQLStr(PIS:GetServerID())

local result = sql.Query([[
SELECT * FROM nexus_psi_settings
WHERE id = ]] .. id
)

if (istable(result) and #result > 0) then
sql.Query([[
UPDATE nexus_psi_settings
SET settings = ]] .. settings .. [[
WHERE id = ]] .. id
)
else
sql.Query([[
INSERT INTO nexus_psi_settings (id, settings)
VALUES (]] .. id .. [[, ]] .. settings .. [[)
]])
end
end

hook.Add("Initialize", "PIS.SQLCreation", function()
PIS:CreateSQLTables()
end)

hook.Add("HUDPaint", "PIS.LoadSettings", function()
hook.Remove("HUDPaint", "PIS.LoadSettings")

timer.Simple(3, function()
PIS:LoadSettings(LocalPlayer())
end)
end)
38 changes: 38 additions & 0 deletions lua/infl_cmenu/gamemodes/backup.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
local GAMEMODE = PIS:GetGamemode()
GAMEMODE:SetName("Backup")
GAMEMODE:SetID("backup")
GAMEMODE:SetDetectionCondition(function()

return false
end)
GAMEMODE:SetPlayers(function(author)
local tbl = {}

for i, v in pairs(player.GetAll()) do
if (v == author) then continue end

table.insert(tbl, v)
end

return tbl
end)
GAMEMODE:SetSubtitleDisplay(function(player)
return player:GetUserGroup():sub(1, 1):upper() .. player:GetUserGroup():sub(2)
end)
GAMEMODE:SetViewCondition(function(author, target)
return true
end)
GAMEMODE:SetPingCondition(function(author)
return author:Alive()
end)
GAMEMODE:SetCommandCondition(function(author)
return true
end)
GAMEMODE:SetInteractionCondition(function(author)
return author:Alive()
end)
GAMEMODE:SetOnDeath(function(author)

end)

GAMEMODE:Register()
Loading

0 comments on commit 4a57dcf

Please sign in to comment.