Advertisement
Guest User

Untitled

a guest
May 1st, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.25 KB | None | 0 0
  1. if CLIENT then    
  2.     local function MyMenu()
  3.         local w = 700
  4.         local h = 550
  5.         local JailPanel = vgui.Create( "DFrame" )
  6.         JailPanel:SetPos( 50,50 )
  7.         JailPanel:SetSize( w, h )
  8.         JailPanel:SetTitle( "Список аррестованых:" )
  9.         JailPanel:SetVisible( true )
  10.         JailPanel:SetDraggable( true )
  11.         JailPanel:ShowCloseButton( true )
  12.         JailPanel:MakePopup()
  13.         JailPanel:Center()
  14.         JailPanel.Paint = function()
  15.             draw.RoundedBox( 0, 0, 0, w, h, Color( 0,0,0,150 ))
  16.         end
  17.  
  18.        
  19.         local JailUserList = vgui.Create("DListView")
  20.         JailUserList:SetParent(JailPanel)
  21.         JailUserList:SetPos(25, 50)
  22.         JailUserList:SetSize(650, 425)
  23.         JailUserList:SetMultiSelect(false)
  24.         JailUserList:AddColumn("Ник")
  25.         JailUserList:AddColumn("SteamID")
  26.         JailUserList:AddColumn("Профессия")
  27.  
  28.         playersInJail = {}
  29.  
  30.  
  31.  
  32.         // ВОТ ТУТ СУТЬ
  33.         for k,v in pairs(player.GetAll()) do
  34.             if v:isArrested() then
  35.                 JailUserList:AddLine(v:Nick(),v:SteamID(), v:getDarkRPVar("job")) -- Add lines
  36.                 for i=1, 10 do
  37.                     if playersInJail[i] == nil then
  38.                         playersInJail[i] = v
  39.                     end
  40.                 end
  41.             end
  42.         end
  43.     // КОНЕЦ
  44.  
  45.  
  46.         local JailButtonImg = surface.GetTextureID( "icon16/coins.png" )
  47.         local texGradient = surface.GetTextureID( "gui/center_gradient" )
  48.  
  49.         local JailButton = vgui.Create("DButton")
  50.         JailButton:SetParent(JailPanel)
  51.         JailButton:SetPos(150, 488)
  52.         JailButton:SetSize(200, 50)
  53.         JailButton:SetText("Заплатить залог($3000)")
  54.         JailButton.DoClick = function()
  55.             playerSelected = JailUserList:GetSelectedLine()
  56.  
  57.             if  playersInJail[playerSelected] ~= nil then
  58.                 net.Start("myMessage")
  59.                 net.WriteEntity(playersInJail[playerSelected])
  60.                 net.SendToServer()
  61.             end
  62.  
  63.             //print(JailUserList:GetLine(JailUserList:GetSelectedLine()):GetValue(1))
  64.             // print(JailUserList:GetSelectedLine())
  65.             // print(players[JailUserList:GetSelectedLine()])
  66.             //players[JailUserList:GetSelectedLine()]:setDarkRPVar("Arrested", false)
  67.         end
  68.         JailButton.Paint = function()
  69.             draw.RoundedBox( 0, 0, 0, JailButton:GetWide(), JailButton:GetTall(), Color( 255,255,255,255 ))
  70.             surface.SetTexture( texGradient )
  71.             surface.SetDrawColor( 0, 255, 0, 200 )
  72.             surface.DrawTexturedRect( -25, -3, JailButton:GetWide()+50, JailButton:GetTall()+25)
  73.         end
  74.     end
  75.     concommand.Add("up_jailhelp", MyMenu)
  76.     usermessage.Hook("MyMenu", MyMenu)
  77. end
  78.  
  79.  
  80.  
  81. if SERVER then
  82.  
  83.     util.AddNetworkString( "myMessage" )
  84.  
  85.     function MyMenu( ply ) --Start the function
  86.         umsg.Start( "MyMenu", ply ) --Send the contents of "MyMenu" to the client
  87.         umsg.End()
  88.     end --End the function
  89.     hook.Add("ShowSpare1", "MyHook", MyMenu)
  90.  
  91.  
  92.     net.Receive( "myMessage", function( len, ply )
  93.         net.ReadEntity():unArrest()
  94.         ply:addMoney(-3000)
  95.     end)
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement