Message

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

surface.

CreateFont("GrandlineRP:Font:Medium:25", {
font = "Montserrat Medium",
extended = false,
size = 25,
weight = 500
})

function RX(x)
return x / 1920 * ScrW()
end

function RY(y)
return y / 1080 * ScrH()
end

local function GrandlineWallet()


if IsValid(WalletGRandline) then return end
local WalletGRandline = vgui.Create("DFrame")
WalletGRandline:SetSize(RY(500), RX(200))
WalletGRandline:Center()
WalletGRandline:SetTitle("")
WalletGRandline:ShowCloseButton(false)
WalletGRandline:MakePopup()

WalletGRandline:SetDraggable(false)
WalletGRandline:SetAlpha(100)
WalletGRandline:AlphaTo(255, 0.3, 0)

function WalletGRandline:Paint(w, h)
BSHADOWS.BeginShadow()
draw.RoundedBoxEx(12, RX(1920 / 2 - 250), RY(1080 / 2 - 100), w, RY(50),
Color(55, 55, 55, 255), true, true, false, false)
draw.RoundedBoxEx(12, RX(1920 / 2 - 250), RY(1080 / 2 - 50), w, h - RY(50),
Color(30, 30, 30, 255), false, false, true, true)
BSHADOWS.EndShadow(3, 2, 2)
draw.SimpleText("GRANDLINE - Portefeuille", "GrandlineRP:Font:Medium:25",
RX(13), RY(13), color_white)
draw.RoundedBox(4, RX(15), RY(66), RY(470), RX(55), Color(55, 55, 55, 255))
end

local TextEntry = vgui.Create("DTextEntry", WalletGRandline)


TextEntry:Dock(TOP)
TextEntry:DockMargin(20, 0, -23, 0)
TextEntry:SetTall(RY(125))
TextEntry:SetPlaceholderText("Votre argent : " ..
DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")))
TextEntry:SetFont("GrandlineRP:Font:Medium:25")
TextEntry:SetTextColor(color_white)
TextEntry:SetNumeric(true)

TextEntry:SetDrawBackground(false)
TextEntry:SetDrawBorder(false)

local VDeposit = vgui.Create("DButton", WalletGRandline)


VDeposit:SetSize(RY(227), RY(50))
VDeposit:SetPos(RX(15), RY(135))
VDeposit:SetFont("GrandlineRP:Font:Medium:25")
VDeposit:SetText("Déposer de l'argent")
VDeposit:SetTextColor(color_white)
VDeposit.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(55, 55, 55, 255))
if self:IsHovered() then
local boxWidth = Lerp((CurTime() - self.FF4TimeBeforeHover) * 2, 0, w)
local boxX = (w - boxWidth) / 2
draw.RoundedBox(4, 0, 0, w, h, Color(55, 55,55, 255))

draw.RoundedBox(4, boxX, h - RY(4), boxWidth, RY(4), Color(0, 100,


200))
else
self.FF4TimeBeforeHover = CurTime()
end
end
VDeposit.DoClick = function()
local amount = tonumber(TextEntry:GetValue())
if amount and amount > 0 then
RunConsoleCommand("say", "/dropmoney " .. tostring(amount))
end
WalletGRandline:Close()
end

local VDonate = vgui.Create("DButton", WalletGRandline)


VDonate:SetSize(RY(227), RY(50))
VDonate:SetPos(RX(256), RY(135))
VDonate:SetFont("GrandlineRP:Font:Medium:25")
VDonate:SetText("donner de l'argent")
VDonate:SetTextColor(color_white)
VDonate.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(55, 55, 55, 255))

if self:IsHovered() then
local boxWidth = Lerp((CurTime() - self.FF4TimeBeforeHover) * 2, 0, w)
local boxX = (w - boxWidth) / 2
draw.RoundedBox(4, 0, 0, w, h, Color(55, 55,55, 255))

draw.RoundedBox(4, boxX, h - RY(4), boxWidth, RY(4), Color(0, 100,


200))
else
self.FF4TimeBeforeHover = CurTime()
end
end
VDonate.DoClick = function()
local amount = tonumber(TextEntry:GetValue())
if amount and amount > 0 then
RunConsoleCommand("say", "/give " .. tostring(amount))
end
WalletGRandline:Close()
end

local vClose = vgui.Create("DButton", WalletGRandline)


vClose:SetSize(RY(50), RY(50))
vClose:SetPos(WalletGRandline:GetWide() - RY(50), 0)
vClose:SetText("")
function vClose:Paint(w, h)
draw.SimpleText("✕", "GrandlineRP:Font:Medium:25", w / 2, h / 2,
color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
function vClose:DoClick()
WalletGRandline:AlphaTo(100, 0.1, 0, function()
if IsValid(WalletGRandline) then
WalletGRandline:Remove()
end
end)
end

WalletGRandline.OnRemove = function()
WalletGRandline = nil
end
end

concommand.Add("grandline_wallet", GrandlineWallet)

You might also like