- Initiateur de la discussion
B
benji1919
Geek
- Messages
- 66
- Score réaction
- 0
- Points
- 80
bonjour, j'ai un petit soucis j'aimerais descendre mes bouton car il sont trop haut ( sur l'image )
j'aimerais aussi cacher les option admin sur mon context menu. je n'arrive pas a le faire malgré le " --grades pouvant accéder sur les boutons d'administration "
j'aimerais aussi cacher les option admin sur mon context menu. je n'arrive pas a le faire malgré le " --grades pouvant accéder sur les boutons d'administration "
Code:
AddCSLuaFile()
Casier = Casier or {}
Casier.Warn = {}
surface.CreateFont( "Casier:AWarn:Font:Arial:30",
{ font = "Arial", size = 27, weight = 550,
})
local context_admin_table = { --grades pouvant accéder sur les boutons d'administration ["Fondateur"] = true, ["superadmin"] = true, ["admin"] = true, ["moderateur"] = true, ["Modo-Test"] = true,
}
local function DropMoney() local Base = vgui.Create( "DFrame" ) Base:SetSize( 350, 145 ) Base:Center() Base:SetTitle( "" ) Base:SetDraggable( true ) Base:ShowCloseButton( true ) Base:MakePopup() function Base:Paint( w, h ) draw.RoundedBox( 6, 0, 0, w, h, Color( 60, 60, 60, 230 ) ) draw.SimpleText( "Montant : ", "Trebuchet24", w / 2, 25, color_white, 1 ) end local pAmount = vgui.Create( "DTextEntry", Base ) pAmount:SetSize( Base:GetWide() - 10, 25 ) pAmount:SetPos( 5, 60 ) pAmount:SetNumeric( true ) pAmount:SetPlaceholderText( 'Entrez un montant...' ) local btn = vgui.Create( "DButton", Base ) btn:SetSize( 100, 30 ) btn:SetPos( Base:GetWide() / 10000 - btn:GetWide() / 2, 100 ) btn:SetText( "Valider" ) btn:SetTextColor( color_white ) btn:SetFont( 'Trebuchet24' ) function btn:Paint( w, h ) draw.RoundedBox( 10, 0, 0, w, h, Color( 10, 130, 255, 255 ) ) end function btn:DoClick() if pAmount:GetValue() != "" && tonumber( pAmount:GetValue() ) > 0 then RunConsoleCommand( "say", "/dropmoney " .. tonumber( pAmount:GetValue() ) ) end Base:Remove() end end
function Casier.Warn:OpenMenu() local tblBtns = { [1] = {Name = "3ème personne", Color = Color( 40, 200, 40 ), Func = function() RunConsoleCommand( "simple_thirdperson_enabled" ) end }, [2] = {Name = "StopSound", Color = Color( 40, 200, 40 ), Func = function() LocalPlayer():ConCommand( "stopsound" ) end }, [3] = {Name = "Poser votre arme à terre", Color = Color( 10, 130, 255, 255 ), Func = function() RunConsoleCommand( "say", "/drop" ) end }, [4] = {Name = "Poser votre argent à terre", Color = Color( 10, 130, 255, 255 ), Func = function() DropMoney() end }, [5] = {Name = "Appeller un admin", Color = Color( 10, 130, 255 ), Func = function() RunConsoleCommand( "say", "!ticket" ) end }, [6] = {Name = "Aller en Administration", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!service" ) end }, [7] = {Name = "menu de gestion de joueurs", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!pmenu" ) end }, [8] = {Name = "menu de Remboursement", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!rmenu" ) end }, [9] = {Name = "menu ulx", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!menu" ) end }, [10] = {Name = "cleanup", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "/cleanup" ) end }, [11] = {Name = "Casier Administratif", Color = Color( 255, 30, 30 ), Func = function() LocalPlayer():ConCommand( "awarn_menu" ) end }, [12] = {Name = "Ouvrir les logs", Color = Color( 255, 30, 30 ), Func = function() LocalPlayer():ConCommand( "blogs_menu" ) end }, [13] = {Name = "Ouvrir l'argent", Color = Color( 255, 30, 30 ), Func = function() RunConsoleCommand( "say", "!monc" ) end }, [14] = {Name = "Examiner les inventaires", Color = Color( 255, 30, 30 ), Func = function() LocalPlayer():ConCommand( "itemstore_admin" ) end }, [15] = {Name = "Quitter le serveur", Color = Color( 255, 200, 0, 255 ), Func = function() RunConsoleCommand( "disconnect" ) end }, } Casier.Warn.OpenMenu = function() if table.HasValue( context_admin_table, LocalPlayer():GetUserGroup()) then chat.AddText( Color( 125, 0, 0, 255 ),LocalPlayer(), " Vous n'êtes pas du Staff !" ) end end local Base = vgui.Create( "DFrame" ) Base:SetSize( ScrW() * 0.25, ScrH() ) Base:SetPos( ScrW() - Base:GetWide(), 0 ) Base:SetTitle( "" ) Base:SetDraggable( false ) Base:ShowCloseButton( false ) Base:MakePopup() local base_banner = Material("context/serveur.png") function Base:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 60, 60, 60 , 230 ) ) surface.SetDrawColor( 255, 255, 255 ) surface.SetMaterial( base_banner ) surface.DrawTexturedRect( w / 2 - ScrH() * 0.1, ScrH() * 0.02, ScrH() * 0.2, ScrH() * 0.2) draw.SimpleText( "", "Casier:AWarn:Font:Arial:30", 15, 5, color_white ) end Casier.Warn.Menu = Base local pList = vgui.Create( "DScrollPanel", Base ) pList:SetSize( Base:GetWide() - 10, Base:GetTall() - 30 ) pList:SetPos( 5, 35 ) for k,v in SortedPairs( tblBtns or {} ) do local btn = vgui.Create( "DButton", pList ) btn:SetSize( pList:GetWide(), 22 ) btn:SetPos( ScrW() - Base:GetWide(), 750 ) btn:Dock( TOP ) btn:DockMargin( 0, 6, 0, 0 ) btn:SetText( v['Name'] ) btn:SetTextColor( color_white ) btn:SetFont( 'Trebuchet24' ) function btn:Paint( w, h ) draw.RoundedBox( 40, 0, 0, w, h, v['Color'] ) end function btn:DoClick() v['Func']() end end
end
hook.Add( "OnContextMenuOpen", "Casier:Warn:ContextMenuOpen", function() Casier.Warn:OpenMenu()
end)
image du contextmenu
hook.Add( "OnContextMenuClose", "Casier:Warn:ContextMenuClose", function() if IsValid( Casier.Warn.Menu ) then Casier.Warn.Menu:Remove() end
end)