CL menu mis a jours avec background
local scale = ScrH() / 1080
if ScrH() == 2160 then
scale = 2
end
function surface.SetMaterialEx(a, clr)
local ok = a and not a:IsError()
if ok then
surface.SetMaterial(a)
end
if clr then
surface.SetDrawColor(clr)
end
return ok
end
function surface.AdaptiveScale(a)
return a * scale
end
local resources = {}
local path = "materials/elysion/cmenu/"
local function a(b)
return path .. b
end
local resources_list = {
["background"] = a("background.png"),
["logo"] = a("welcome_elysion.png"),
["discordbox"] = a("background_discord.png"),
["button_big"] = a("button_big_background.png"),
["button_small"] = a("button_little_background.png"),
["i_afkfarm"] = a("icon_afkfarm.png"),
["i_view"] = a("icon_changerdevue.png"),
["i_admin"] = a("icon_contacterunadmin.png"),
["i_money"] = a("icon_jeterargent.png"),
["i_cases"] = a("icon_menucaisses.png"),
["i_bonus"] = a("icon_menurecompenses.png"),
["i_sound"] = a("icon_stopsound.png"),
["i_workshop"] = a("icon_telechargerlacollection.png"),
["i_youtube"] = a("icon_tutoriels.png"),
["i_boutique"] = a("icon_voirlaboutique.png"),
["discord_prisonrp"] = a("discord_prisonrp.png"),
["discord_police_elysion"] = a("discord_police_elysion.png"),
["discord_elysion"] = a("discord_elysion.png"),
}
local s = surface.AdaptiveScale
local pad = s(13)
for k, v in pairs(resources_list) do
resources[k] = Material(v)
end
surface.CreateFont("cmenu.buttons", {
font = "Montserrat ExtraBold",
size = s(19),
weight = 400,
extended = true
})
surface.CreateFont("cmenu.discordtitle", {
font = "Montserrat Bold",
size = s(21),
weight = 400,
extended = true
})
surface.CreateFont("cmenu.discord", {
font = "Montserrat SemiBold",
size = s(19),
weight = 400,
extended = true
})
local buttons = {
{
name = "CONTACTER UN ADMIN",
icon = "i_admin",
type = 1,
OnClick = function()
RunConsoleCommand("say", "/// J'aurais besoin d'un Staff s'il-vous-plaît.")
end
},
{
name = "MENU RECOMPENSES",
icon = "i_bonus",
type = 2,
OnClick = function()
if connexion then
connexion.OpenMenu()
local menu = connexion.menu
menu:SetDisableBlur(true)
menu.AddonsBox:SetVisible(false)
menu.YTBox:SetVisible(false)
menu.DiscordBox:SetVisible(false)
menu.NouveauBox:SetVisible(false)
end
end
},
{
name = "MENU CAISSES",
icon = "i_cases",
type = 2,
OnClick = function()
RunConsoleCommand("say", "!caisse")
end
},
{
name = "CHANGER DE VUE (1ER / 3EME PERSONNE)",
icon = "i_view",
type = 1,
OnClick = function()
RunConsoleCommand("thirdperson_toggle")
end
},
{
name = "JETER DE L'ARGENT",
icon = "i_money",
type = 2,
OnClick = function()
Derma_StringRequest("Drop money", "Enter amount to drop", "", function(s)
LocalPlayer():ConCommand("darkrp dropmoney " .. s)
end)
end
},
{
name = "AFK FARM",
icon = "i_afkfarm",
type = 2,
OnClick = function()
RunConsoleCommand("say", "/afkfarm")
end
},
{
name = "STOPSOUND",
type = 2,
icon = "i_sound",
OnClick = function()
RunConsoleCommand("stopsound")
end
},
{
name = "TUTORIELS",
type = 2,
icon = "i_youtube",
OnClick = function()
gui.OpenURL("")
end
},
{
name = "TELECHARGER LA COLLECTION",
icon = "i_workshop",
type = 1,
OnClick = function()
gui.OpenURL("
https://steamcommunity.com/workshop/filedetails/?id=2946236868")
end
},
{
name = "VOIR LA BOUTIQUE",
icon = "i_boutique",
type = 1,
OnClick = function()
gui.OpenURL("
lien ou image supprimée")
end
},
}
local discord_links = {
{ "", "", "" },
{ "JustRP", "discord_police_elysion", "
https://discord.gg/AvpkbF5B" },
{ "", "", "" },
}
local blur = Material("pp/blurscreen")
local function DrawBlur(panel, amount)
local scrW, scrH = ScrW(), ScrH()
local x, y = panel:LocalToScreen(0, 0)
surface.SetDrawColor(255, 255, 255)
surface.SetMaterial(blur)
for i = 1, 3 do
blur:SetFloat("$blur", (i / 3) * (amount or 6))
blur:Recompute()
render.UpdateScreenEffectTexture()
surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
end
end
if IsValid(g_ElysionContext) then
g_ElysionContext:Remove()
end
local function createContext()
g_ElysionContext = vgui.Create("EditablePanel")
g_ElysionContext:SetSize(s(656), ScrH())
g_ElysionContext:AlignRight(0)
g_ElysionContext:MakePopup()
g_ElysionContext:SetKeyboardInputEnabled(false)
g_ElysionContext.Paint = function(self, w, h)
DrawBlur(self, 12)
if surface.SetMaterialEx(resources.background, color_white) then
surface.DrawTexturedRect(0, 0, w, h)
end
end
g_ElysionContext.Header = g_ElysionContext:Add("EditablePanel")
g_ElysionContext.Header:SetPos(0, s(50))
g_ElysionContext.Header:SetSize(g_ElysionContext:GetWide(), s(315))
g_ElysionContext.Header.Paint = function(_, w, h)
if surface.SetMaterialEx(resources.logo, color_white) then
local px, py = s(359), s(315)
surface.DrawTexturedRect(w / 2 - px/2, h / 2 - py / 2, px, py)
end
end
g_ElysionContext.Body = g_ElysionContext:Add("EditablePanel")
g_ElysionContext.Body:SetPos(s(30), g_ElysionContext.Header.y + g_ElysionContext.Header:GetTall() + s(54))
g_ElysionContext.Body:SetSize(g_ElysionContext:GetWide() - s(60), g_ElysionContext:GetTall() - g_ElysionContext.Body.y)
local line, half = 0
local function newline() line, half = line + 1, 0 end
local function nexthalf() half = half + 1 if half > 1 then newline() end end
local full_wide = g_ElysionContext.Body:GetWide()
local half_wide = g_ElysionContext.Body:GetWide() / 2 - s(4)
for _, button in ipairs(buttons) do
local new_button = g_ElysionContext.Body:Add("EditablePanel")
new_button:SetCursor("hand")
new_button.Paint = function(b, w, h)
local background = button.custom_background or (button.type == 1 and resources.button_big or resources.button_small)
if surface.SetMaterialEx(background, color_white) then
surface.DrawTexturedRect(0, 0, w, h)
end
surface.SetFont("cmenu.buttons")
local text = string.upper(button.name)
local tw, th = surface.GetTextSize(text)
local pw, ph = s(34), s(28)
local size_total = tw + (button.icon and pw + s(5) or 0)
local sx = w / 2 - size_total / 2
if button.icon and surface.SetMaterialEx(resources[button.icon], color_white) then
surface.DrawTexturedRect(sx, h / 2 - ph/2 + (button.offset and button.offset or 0), pw, ph)
end
draw.SimpleText(text, "cmenu.buttons", sx + (button.icon and s(5) + pw or 0), h / 2, color_white, 0, 1)
end
new_button.OnMousePressed = function(_, key)
if key == MOUSE_LEFT then
button.OnClick()
timer.Simple(.1, function() chat.PlaySound() end) -- stopsound my a55
end
end
new_button:SetPos(0, line * s(61))
if button.type == 1 then
new_button:SetSize(full_wide, s(53))
newline()
elseif button.type == 2 then
new_button:SetSize(half_wide, s(53))
new_button.x = half == 0 and 0 or half_wide + s(8)
nexthalf()
end
end
local ds_color = Color(131, 136, 139)
g_ElysionContext.DiscordHolder = g_ElysionContext.Body:Add("EditablePanel")
g_ElysionContext.DiscordHolder:SetSize(g_ElysionContext.Body:GetWide(), s(160))
g_ElysionContext.DiscordHolder:AlignBottom(s(55))
g_ElysionContext.DiscordHolder.Paint = function(_, w, h)
draw.DrawText("REJOIGNEZ NOS DISCORDS", "cmenu.discordtitle", w / 2, 0, ds_color, 1)
end
local discordbox = g_ElysionContext.DiscordHolder:Add("EditablePanel")
discordbox:SetSize(s(468), s(131))
discordbox:SetPos(0, s(30))
discordbox:CenterHorizontal()
discordbox.Paint = function(discordbox, w, h)
if surface.SetMaterialEx(resources.discordbox, color_white) then
surface.DrawTexturedRect(0, 0, w, h)
end
end
local spacer = discordbox:GetWide() / #discord_links
local offset = spacer / 2 - (spacer - s(95))/2
local x = offset
for k, v in pairs(discord_links) do
local link = discordbox:Add("EditablePanel")
link:SetSize(s(95), s(110))
link:SetPos(x, s(14))
link:SetCursor("hand")
link.Paint = function(_, w, h)
if v[2] and surface.SetMaterialEx(resources[v[2]], color_white) then
local px, py = s(86), s(79)
surface.DrawTexturedRect(w/2 - px / 2, s(5), px, py)
end
draw.DrawText(v[1], "cmenu.discord", w / 2, h - s(20), color_white, 1)
end
link.OnMousePressed = function() gui.OpenURL(v[3]) end
x = x + link:GetWide() + offset
end
end
hook.Add("ContextMenuOpened", "ElysionCMenu", function()
if not IsValid(g_ElysionContext) then
createContext()
end
g_ElysionContext:MoveToFront()
g_ElysionContext:SetVisible(true)
g_ElysionContext:SetPos(ScrW(), 0)
g_ElysionContext:MoveTo(ScrW() - g_ElysionContext:GetWide(), 0, 0.3, 0, -1)
end)
hook.Add("ContextMenuClosed", "ElysionCMenu", function()
if IsValid(g_ElysionContext) then
g_ElysionContext:SetVisible(false)
end
end)