Advertisement
Deadman69330

Untitled

Nov 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.42 KB | None | 0 0
  1. function CreateCharacterFirstMenu(characterID)
  2.     gui.EnableScreenClicker( true )  -- enable mouse
  3.  
  4.     local mainPanel = vgui.Create( "DFrame" )
  5.     mainPanel:SetSize( ScrW(), ScrH() )
  6.     mainPanel:Center()
  7.     mainPanel:SetTitle( "" )
  8.  
  9.     local background = vgui.Create( "DImage", mainPanel )
  10.     background:SetPos( 0, 0 )
  11.     background:SetSize( ScrW(), ScrH() )
  12.     background:SetImage( "deadman/metro/characterBackground.png" ) -- Set material relative to "garrysmod/materials/"
  13.  
  14.     local goBack = vgui.Create( "DButton", mainPanel )
  15.     goBack:SetText( "Go back" )
  16.     goBack:SetPos( ScrW()/32, ScrH()/21.6 )
  17.     goBack:SetSize( ScrW()/7.68, ScrH()/21.6 )
  18.     goBack:SetTextColor( Color(255,255,255,255) )
  19.     goBack.DoClick = function()
  20.         mainPanel:Remove()
  21.  
  22.         net.Start("Metro::PlyRequest")
  23.             net.WriteString("getAllChars")
  24.         net.SendToServer()
  25.     end
  26.     goBack.Paint = function(w, h)
  27.         surface.SetDrawColor( 255, 255, 255, 255 )
  28.         surface.SetMaterial( backgroundButton   )
  29.         surface.DrawTexturedRect( 0, 0, 512, 512 ) -- The size don't matter since it will not be bigger than the button
  30.     end
  31.  
  32.     local TextEntry = vgui.Create( "DTextEntry", mainPanel ) -- create the form as a child of frame
  33.     TextEntry:SetPos( ScrW()/2, ScrH()/2 )
  34.     TextEntry:SetSize( 300, 50)
  35.     TextEntry:SetText( "Placeholder Text" )
  36.  
  37.     local femaleButton = vgui.Create( "DButton", mainPanel )
  38.     femaleButton:SetText( "Female Character" )
  39.     femaleButton:SetPos( ScrW()/1.4, ScrH()/1.5 )
  40.     femaleButton:SetSize( ScrW()/7.68, ScrH()/21.6 )
  41.     femaleButton:SetTextColor( Color(255,255,255,255) )
  42.     femaleButton.DoClick = function()
  43.         characterSex = "female"
  44.  
  45.         if nameTextEntry:GetValue() ~= "" and #nameTextEntry:GetValue() > MConf.CharacterMinLength then
  46.             characterName = nameTextEntry:GetValue()
  47.             CreateCharacterSecondMenu(characterID)
  48.         else
  49.             notification.AddLegacy( "Your name is not long enough !", NOTIFY_ERROR , 4 )
  50.             surface.PlaySound( "buttons/button15.wav" )
  51.         end
  52.     end
  53.     femaleButton.Paint = function(w, h)
  54.         surface.SetDrawColor( 255, 255, 255, 255 )
  55.         surface.SetMaterial( backgroundButton   )
  56.         surface.DrawTexturedRect( 0, 0, 512, 512 ) -- The size don't matter since it will not be bigger than the button
  57.     end
  58.  
  59.     local maleButton = vgui.Create( "DButton", mainPanel )
  60.     maleButton:SetText( "Male Character" )
  61.     maleButton:SetPos( ScrW()/2.3, ScrH()/1.5 )
  62.     maleButton:SetSize( ScrW()/7.68, ScrH()/21.6 )
  63.     maleButton:SetTextColor( Color(255,255,255,255) )
  64.     maleButton.DoClick = function()
  65.         characterSex = "male"
  66.  
  67.         if nameTextEntry:GetValue() ~= "" and #nameTextEntry:GetValue() > MConf.CharacterMinLength then
  68.             characterName = nameTextEntry:GetValue()
  69.             CreateCharacterSecondMenu(characterID)
  70.         else
  71.             notification.AddLegacy( "Your name is not long enough !", NOTIFY_ERROR , 4 )
  72.             surface.PlaySound( "buttons/button15.wav" )
  73.         end
  74.     end
  75.     maleButton.Paint = function(w, h)
  76.         surface.SetDrawColor( 255, 255, 255, 255 )
  77.         surface.SetMaterial( backgroundButton   )
  78.         surface.DrawTexturedRect( 0, 0, 512, 512 ) -- The size don't matter since it will not be bigger than the button
  79.     end
  80.  
  81.     local actualSkin = vgui.Create( "DModelPanel", mainPanel )
  82.     actualSkin:SetSize( ScrW()/2.5, ScrH()/1.5 )
  83.     actualSkin:SetModel( "models/half-dead/metroll/m1b1.mdl" )
  84.     actualSkin:CenterHorizontal(0.2)
  85.     actualSkin:CenterVertical(0.5)
  86.     actualSkin:SetCamPos( Vector(75,0,50) ) -- recul, rotation, hauteur
  87.     function actualSkin:LayoutEntity( Entity ) return end -- disables default rotation
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement