Ajouter une commande au F4Menu

  • Initiateur de la discussion
SkyAngel

SkyAngel

Geek suprême
Messages
136
Score réaction
43
Points
130
Bonjour à tous, j'aurais une question à vous posez. Sur mon serveur, j'ai bloquer le ContextMenu (menu C) et ducout j'aimerais savoir si c'était possible de raajouter un bouton dans mon Menu F4 (aMenu) pour pouvoir activer et désactiver la vue troisième personne ou deux boutons avec un ON et un OFF.
Voici la ligne de code pour ajouter un bouton de base sur le aMenu:
Code:
self.GeneralCommands = { {name = "Jeter de l'argent", command = "say /dropmoney {}"}, {name = "Jeter son arme", command = "say /dropweapon"}, {name = "Donner de l'argent", command = "say /give {}"}, {name = "Vendres ses portes", command = "say /unownalldoors"}, } self.RoleplayCommands = { {name = "Changer d'identitée", command = "say /rpname {}"}, {name = "License d'arme", command = "say /requestlicense"}, } self.CivilCommands = { {name = "Faire un mandat", command = "say /warrant {}"}, {name = "Rechercher quelqu'un", command = "say /wanted {}"}, {name = "Arreter la recherche", command = "say /unwanted {}"}, } self.MayorCommands = { {name = "Lancer Couvre Feu", command = "say /lockdown"}, {name = "Arreter Couvre Feu", command = "say /unlockdown"}, {name = "Ajouter une loi", command = "say /addlaw {}"}, {name = "Mettre un tableau", command = "say /placelaws"}, {name = "Message global", command = "say /broadcast {}"}, }
Et voici le code du mode 3ème personne:
Code:
// SHARED
CreateConVar("simple_thirdperson_maxdistance", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max distance the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_maxpitch", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max pitch the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_maxright", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max right the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_maxyaw", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max yaw the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_maxup", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min up the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_mindistance", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min distance the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_minpitch", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min pitch the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_minright", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min right the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_minyaw", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min yaw the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_minup", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min up the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_maxdist", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max shoulder distance the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_mindist", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min shoulder distance the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_maxup", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max shoulder up the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_minup", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min shoulder up the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_maxright", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the max shoulder right the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_shoulder_minright", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Sets the min shoulder right the player can go (0 = disabled)")
CreateConVar("simple_thirdperson_forcecollide", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Forces the player to use collide or not (0 = disabled,1 = on,2 = off)")
CreateConVar("simple_thirdperson_forceshoulder", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE} , "Forces the player to use shoulder view or not (0 = disabled,1 = on,2 = off)")
CreateConVar("simple_thirdperson_forcesmooth", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "Forces the player to use smooth view or not (0 = disabled,1 = on,2 = off)")
if CLIENT then CreateClientConVar( "simple_thirdperson_enabled", "0", true, false ) CreateClientConVar( "simple_thirdperson_smooth", "1", true, false ) CreateClientConVar( "simple_thirdperson_smooth_mult_x", "0.3", true, false ) CreateClientConVar( "simple_thirdperson_smooth_mult_y", "0.3", true, false ) CreateClientConVar( "simple_thirdperson_smooth_mult_z", "0.3", true, false ) CreateClientConVar( "simple_thirdperson_smooth_delay", "10", true, false ) CreateClientConVar( "simple_thirdperson_collision", "1", true, false ) CreateClientConVar( "simple_thirdperson_cam_distance", "100", true, false ) CreateClientConVar( "simple_thirdperson_cam_right", "0", true, false ) CreateClientConVar( "simple_thirdperson_cam_up", "0", true, false ) CreateClientConVar( "simple_thirdperson_cam_pitch", "0", true, false ) CreateClientConVar( "simple_thirdperson_cam_yaw", "0", true, false ) CreateClientConVar( "simple_thirdperson_shoulderview_dist", "50", true, false ) CreateClientConVar( "simple_thirdperson_shoulderview_up", "0", true, false ) CreateClientConVar( "simple_thirdperson_shoulderview_right", "40", true, false ) CreateClientConVar( "simple_thirdperson_shoulderview", "0", true, false ) CreateClientConVar( "simple_thirdperson_shoulderview_bump", "1", true, false ) CreateClientConVar( "simple_thirdperson_fov_smooth", "1", true, false ) CreateClientConVar( "simple_thirdperson_fov_smooth_mult", "0.3", true, false ) CreateClientConVar( "simple_thirdperson_hide_crosshair", "0", true, false ) CreateClientConVar( "simple_thirdperson_enable_custom_crosshair", "0", true, false ) CreateClientConVar( "simple_thirdperson_custom_crosshair_r", "255", true, false ) CreateClientConVar( "simple_thirdperson_custom_crosshair_g", "230", true, false ) CreateClientConVar( "simple_thirdperson_custom_crosshair_b", "0", true, false ) CreateClientConVar( "simple_thirdperson_custom_crosshair_a", "240", true, false ) local Editor = {} Editor.DelayPos = nil Editor.ViewPos = nil Editor.ShoulderToggle = GetConVar( "simple_thirdperson_shoulderview" ):GetBool() or false Editor.EnableToggle = GetConVar( "simple_thirdperson_enabled" ):GetBool() or false Editor.CollisionToggle = GetConVar( "simple_thirdperson_collision" ):GetBool() or false Editor.FOVToggle = GetConVar( "simple_thirdperson_fov_smooth" ):GetBool() or false Editor.SmoothToggle = GetConVar( "simple_thirdperson_smooth" ):GetBool() or true Editor.ShoulderBumpToggle = GetConVar( "simple_thirdperson_shoulderview_bump" ):GetBool() or false Editor.CustomCrossToggle = GetConVar( "simple_thirdperson_enable_custom_crosshair" ):GetBool() or false Editor.CrossToggle = GetConVar( "simple_thirdperson_hide_crosshair" ):GetBool() or false list.Set( "DesktopWindows", "ThirdPerson", { title = "Simple ThirdPerson", icon = "icon32/zoom_extend.png", width = 300, height = 170, onewindow = true, init = function(icn, pnl) BuildMenu(pnl) end } ) function BuildMenu(PNL) if Editor.PANEL != nil then Editor.PANEL:Remove() end if PNL == nil then PNL = vgui.Create( "DFrame" ) PNL:SetSize( 300, 170 ) PNL:SetTitle( "Simple ThirdPerson" ) PNL:SetVisible( true ) PNL:SetDraggable( true ) PNL:ShowCloseButton( true ) PNL:MakePopup() end Editor.PANEL = PNL Editor.PANEL:SetPos(ScrW() - 310,40) Editor.PANEL.Sheet = Editor.PANEL:Add( "DPropertySheet" ) Editor.PANEL.Sheet:Dock(LEFT) Editor.PANEL.Sheet:SetSize( 290, 0 ) Editor.PANEL.Sheet:SetPos(5,0) Editor.PANEL.Settings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Settings", Editor.PANEL.Settings, "icon16/cog_edit.png" ) Editor.PANEL.CameraSettings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Camera", Editor.PANEL.CameraSettings, "icon16/camera_edit.png" ) Editor.PANEL.SmoothSettings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Smooth", Editor.PANEL.SmoothSettings, "icon16/chart_line.png" ) Editor.PANEL.ShoulderSettings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Shoulder", Editor.PANEL.ShoulderSettings, "icon16/camera_go.png" ) Editor.PANEL.CrossSettings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Crosshair", Editor.PANEL.CrossSettings, "icon16/collision_on.png" ) Editor.PANEL.CreditsSettings = Editor.PANEL.Sheet:Add( "DPanelSelect" ) Editor.PANEL.Sheet:AddSheet( "Credits :D", Editor.PANEL.CreditsSettings, "icon16/star.png" ) Editor.PANEL.EnableThrd = Editor.PANEL.Settings:Add( "DButton" ) Editor.PANEL.EnableThrd:SizeToContents() if Editor.EnableToggle then Editor.PANEL.EnableThrd:SetText("Disable ThirdPerson") Editor.PANEL.EnableThrd:SetTextColor(Color(150,0,0)) else Editor.PANEL.EnableThrd:SetText("Enable ThirdPerson") Editor.PANEL.EnableThrd:SetTextColor(Color(0,150,0)) end Editor.PANEL.EnableThrd:SetPos(10,6) Editor.PANEL.EnableThrd:SetSize(250,20) Editor.PANEL.EnableThrd.DoClick = function() Editor.EnableToggle = !Editor.EnableToggle RunConsoleCommand("simple_thirdperson_enabled",BoolToInt(Editor.EnableToggle)) if Editor.EnableToggle then Editor.PANEL.EnableThrd:SetText("Disable ThirdPerson") Editor.PANEL.EnableThrd:SetTextColor(Color(150,0,0)) else Editor.PANEL.EnableThrd:SetText("Enable ThirdPerson") Editor.PANEL.EnableThrd:SetTextColor(Color(0,150,0)) end end Editor.PANEL.Lbl_SPLIT = Editor.PANEL.Settings:Add("DLabel") Editor.PANEL.Lbl_SPLIT:SetPos(20,29) Editor.PANEL.Lbl_SPLIT:SetText("------------------------ RESETS ------------------------") Editor.PANEL.Lbl_SPLIT:SizeToContents() Editor.PANEL.ResetCam = Editor.PANEL.Settings:Add( "DButton" ) Editor.PANEL.ResetCam:SizeToContents() Editor.PANEL.ResetCam:SetText("Camera Reset") Editor.PANEL.ResetCam:SetPos(10,46) Editor.PANEL.ResetCam:SetSize(120,20) Editor.PANEL.ResetCam.DoClick = function() RunConsoleCommand("simple_thirdperson_cam_distance",100) RunConsoleCommand("simple_thirdperson_cam_right",0) RunConsoleCommand("simple_thirdperson_cam_up",0) RunConsoleCommand("simple_thirdperson_cam_yaw",0) RunConsoleCommand("simple_thirdperson_cam_pitch",0) chat.AddText(Color(255,255,255),"[",Color(255,155,0),"Simple ThirdPerson",Color(255,255,255),"] Camera Reset !") Editor.PANEL:Close() end Editor.PANEL.ResetShoulder = Editor.PANEL.Settings:Add( "DButton" ) Editor.PANEL.ResetShoulder:SizeToContents() Editor.PANEL.ResetShoulder:SetText("ShoulderView Reset") Editor.PANEL.ResetShoulder:SetPos(140,46) Editor.PANEL.ResetShoulder:SetSize(120,20) Editor.PANEL.ResetShoulder.DoClick = function() RunConsoleCommand("simple_thirdperson_shoulderview_dist",50) RunConsoleCommand("simple_thirdperson_shoulderview_up",0) RunConsoleCommand("simple_thirdperson_shoulderview_right",40) chat.AddText(Color(255,255,255),"[",Color(255,155,0),"Simple ThirdPerson",Color(255,255,255),"] ShoulderView Reset !") Editor.PANEL:Close() end Editor.PANEL.ResetSmooth = Editor.PANEL.Settings:Add( "DButton" ) Editor.PANEL.ResetSmooth:SizeToContents() Editor.PANEL.ResetSmooth:SetText("Smooth Settings Reset") Editor.PANEL.ResetSmooth:SetPos(10,76) Editor.PANEL.ResetSmooth:SetSize(130,20) Editor.PANEL.ResetSmooth.DoClick = function() RunConsoleCommand("simple_thirdperson_smooth",1) RunConsoleCommand("simple_thirdperson_smooth_mult_x",0.3) RunConsoleCommand("simple_thirdperson_smooth_mult_y",0.3) RunConsoleCommand("simple_thirdperson_smooth_mult_z",0.3) RunConsoleCommand("simple_thirdperson_smooth_delay",10) chat.AddText(Color(255,255,255),"[",Color(255,155,0),"Simple ThirdPerson",Color(255,255,255),"] Smooth Reset !") Editor.PANEL:Close() end Editor.PANEL.ResetFOV = Editor.PANEL.Settings:Add( "DButton" ) Editor.PANEL.ResetFOV:SizeToContents() Editor.PANEL.ResetFOV:SetText("FOV Settings Reset") Editor.PANEL.ResetFOV:SetPos(145,76) Editor.PANEL.ResetFOV:SetSize(115,20) Editor.PANEL.ResetFOV.DoClick = function() RunConsoleCommand("simple_thirdperson_fov_smooth",1) RunConsoleCommand("simple_thirdperson_fov_smooth_mult",0.3) chat.AddText(Color(255,255,255),"[",Color(255,155,0),"Simple ThirdPerson",Color(255,255,255),"] FOV Reset !") Editor.PANEL:Close() end
Je pensais que le code a rajouter était:
{name = "Vue 3ème personne", command = "simple_thirdperson_enabled"},
Mais cela ne fonctionne pas. Merci pour votre aide et bonne soirée ;)

Cordialement SkyAngel ou Aieken Dimitrov
 
KinGo

KinGo

Antho
Messages
312
Score réaction
32
Points
130
Bonsoir , je pense que sa risque d'être un peu compliqué à réalisé sur un menu F4
 
Discord d'entraide
Rejoignz-nous sur Discord