Advertisement
Guest User

Untitled

a guest
Sep 14th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.36 KB | None | 0 0
  1. if CLIENT then
  2.  
  3. surface.CreateFont("UiBold", {
  4.     font = "Tahoma",
  5.     size = 12,
  6.     weight = 600
  7. })
  8.  
  9.  
  10. function GUI_FineMenu( um )
  11. if !LocalPlayer():Alive() then return end
  12. gui.EnableScreenClicker(false)
  13. local Offender = um:ReadString()
  14.  
  15. if GUI_Trade_Frame then if GUI_Trade_Frame:IsValid() then return false end end
  16. GUI_Fine_Frame = vgui.Create("DFrame")
  17. GUI_Fine_Frame:SetTitle("")
  18. GUI_Fine_Frame:SetSize(320,230)
  19. GUI_Fine_Frame:Center()
  20. GUI_Fine_Frame.Paint = function(CHPaint)
  21. -- Draw the menu background color.
  22.                
  23. draw.RoundedBox( 0, 0, 0, CHPaint:GetWide(), CHPaint:GetTall(), Color( 24, 24, 30, 224 ) )
  24.  
  25. -- Draw the outline of the menu.
  26. surface.SetDrawColor(70,70,70,255)
  27. surface.DrawOutlinedRect(0, 0, CHPaint:GetWide(), CHPaint:GetTall())
  28.  
  29. surface.SetDrawColor(70,70,70,70)
  30. surface.DrawOutlinedRect(0, 0, CHPaint:GetWide(), 25)
  31.  
  32. -- Draw the top title.
  33. draw.SimpleText("Fine Player", "UiBold", 41,12, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  34. end
  35. GUI_Fine_Frame:MakePopup()
  36. GUI_Fine_Frame:ShowCloseButton(false)
  37.  
  38. local GUI_Main_Exit = vgui.Create("DButton")
  39. GUI_Main_Exit:SetParent(GUI_Fine_Frame)
  40. GUI_Main_Exit:SetSize(16,16)
  41. GUI_Main_Exit:SetPos(300,5)
  42. GUI_Main_Exit:SetText("")
  43. GUI_Main_Exit.Paint = function()
  44. surface.SetMaterial(Material("icon16/cross.png"))
  45. surface.SetDrawColor(200,200,0,200)
  46. surface.DrawTexturedRect(0,0,GUI_Main_Exit:GetWide(),GUI_Main_Exit:GetTall())
  47. end
  48. GUI_Main_Exit.DoClick = function()
  49.     GUI_Fine_Frame:Remove()
  50. end
  51.  
  52. local GUI_Player_Label = vgui.Create("DLabel")
  53. GUI_Player_Label:SetText("The Offender:")
  54. GUI_Player_Label:SetFont("UiBold")
  55. GUI_Player_Label:SetColor(Color(255,255,255,255))
  56. GUI_Player_Label:SetParent(GUI_Fine_Frame)
  57. GUI_Player_Label:SetPos(10,28)
  58. GUI_Player_Label:SizeToContents()
  59.  
  60. local GUI_Player_Entry = vgui.Create("DTextEntry", GUI_Fine_Frame)
  61. GUI_Player_Entry:SetFont("UiBold")
  62. GUI_Player_Entry:SetSize(300,25)
  63. GUI_Player_Entry:SetPos(10,45)
  64. GUI_Player_Entry:SetEditable(false)
  65. GUI_Player_Entry:SetText(Offender)
  66.  
  67. local GUI_Price_Label = vgui.Create("DLabel")
  68. GUI_Price_Label:SetText("Price:")
  69. GUI_Price_Label:SetFont("UiBold")
  70. GUI_Price_Label:SetColor(Color(255,255,255,255))
  71. GUI_Price_Label:SetParent(GUI_Fine_Frame)
  72. GUI_Price_Label:SetPos(10,73)
  73. GUI_Price_Label:SizeToContents()
  74.  
  75. local GUI_Price_Entry = vgui.Create("DTextEntry", GUI_Fine_Frame)
  76. GUI_Price_Entry:SetFont("UiBold")
  77. GUI_Price_Entry:SetSize(300,25)
  78. GUI_Price_Entry:SetPos(10,90)
  79. GUI_Price_Entry:SetNumeric( true )
  80. GUI_Price_Entry:SetEditable(true)
  81. GUI_Price_Entry:SetUpdateOnType(true)
  82.  
  83. local GUI_Reason_Label = vgui.Create("DLabel")
  84. GUI_Reason_Label:SetText("Reason:")
  85. GUI_Reason_Label:SetFont("UiBold")
  86. GUI_Reason_Label:SetColor(Color(255,255,255,255))
  87. GUI_Reason_Label:SetParent(GUI_Fine_Frame)
  88. GUI_Reason_Label:SetPos(10,117)
  89. GUI_Reason_Label:SizeToContents()
  90.  
  91. local GUI_Reason_Entry = vgui.Create("DTextEntry")
  92. GUI_Reason_Entry:SetFont("UiBold")
  93. GUI_Reason_Entry:SetSize(300,50)
  94. GUI_Reason_Entry:SetPos(10,135)
  95. GUI_Reason_Entry:SetEditable(true)
  96. GUI_Reason_Entry:SetMultiline(true)
  97. GUI_Reason_Entry:SetUpdateOnType(true)
  98. GUI_Reason_Entry:SetParent(GUI_Fine_Frame)
  99.  
  100. local GUI_FineButton = vgui.Create("DButton")
  101. GUI_FineButton:SetParent(GUI_Fine_Frame)
  102. GUI_FineButton:SetSize(200,30)
  103. GUI_FineButton:SetPos(60,190)
  104. GUI_FineButton:SetText("")
  105. GUI_FineButton.DoClick = function()
  106.     if GUI_Price_Entry:GetValue() != "" and GUI_Reason_Entry:GetValue() != "" then
  107.         surface.PlaySound( "fine_sent_01.mp3" )
  108.     else return false end
  109.    
  110.     if tonumber(GUI_Price_Entry:GetValue()) <= 0 then
  111.         LocalPlayer():ChatPrint("Please enter positive value!")
  112.         return
  113.     end
  114.    
  115.     if GUI_Price_Entry:GetValue() == "" then
  116.         LocalPlayer():ChatPrint("Please enter a price for the fine!")
  117.         return
  118.     end
  119.    
  120.     if GUI_Reason_Entry:GetValue() == "" then
  121.         LocalPlayer():ChatPrint("Please enter a reason for the fine!")
  122.         return
  123.     end
  124.    
  125.     if tonumber(GUI_Price_Entry:GetValue()) > FINE_MaxFine then
  126.         LocalPlayer():ChatPrint("You can only fine up to "..FINE_MaxFine.." dollars! The fine has been set to this amount.")
  127.     end
  128.  
  129.     net.Start("RP_Fine_Player")
  130.         net.WriteString(LocalPlayer():Nick())
  131.         net.WriteString(GUI_Player_Entry:GetValue())
  132.         net.WriteDouble(math.Clamp(tonumber(GUI_Price_Entry:GetValue()),0,FINE_MaxFine))
  133.         net.WriteString(GUI_Reason_Entry:GetValue())
  134.     net.SendToServer()
  135.    
  136.     GUI_Fine_Frame:Remove()
  137. end
  138. GUI_FineButton.Paint = function(CHPaint)
  139. draw.RoundedBoxEx(0,1,1,CHPaint:GetWide()-2,CHPaint:GetTall()-2,Color(255, 255, 255, 254), false, false, true, true)
  140.  
  141. local struc = {}
  142. struc.pos = {}
  143. struc.pos[1] = 100 -- x pos
  144. struc.pos[2] = 14.5 -- y pos
  145. struc.color = Color(0,0,0,255) -- Red
  146. struc.text = "Fine Player" -- Text
  147. struc.font = "UiBold" -- Font
  148. struc.xalign = TEXT_ALIGN_CENTER-- Horizontal Alignment
  149. struc.yalign = TEXT_ALIGN_CENTER -- Vertical Alignment
  150. draw.Text( struc )
  151. end
  152.  
  153. end
  154. usermessage.Hook("RP_FineMenu", GUI_FineMenu)
  155.  
  156. function GUI_FinedMenu(um)
  157. surface.PlaySound( "fine_recieved.mp3" )
  158. local TheOfficer = um:ReadString()
  159. local ThePrice = um:ReadLong()
  160. local TheReason = um:ReadString()
  161.  
  162. if !LocalPlayer():Alive() then return end
  163. if GUI_Trade_Frame then if GUI_Trade_Frame:IsValid() then return false end end
  164. GUI_Fined_Frame = vgui.Create("DFrame")
  165. GUI_Fined_Frame:SetTitle("")
  166. GUI_Fined_Frame:SetSize(320,227.5)
  167. GUI_Fined_Frame:Center()
  168. GUI_Fined_Frame.Paint = function(CHPaint)
  169. -- Draw the menu background color.     
  170. draw.RoundedBox( 0, 0, 0, CHPaint:GetWide(), CHPaint:GetTall(), Color( 24, 24, 30, 224 ) )
  171.  
  172. -- Draw the outline of the menu.
  173. surface.SetDrawColor(70,70,70,255)
  174. surface.DrawOutlinedRect(0, 0, CHPaint:GetWide(), CHPaint:GetTall())
  175.  
  176. surface.SetDrawColor(70,70,70,255)
  177. surface.DrawOutlinedRect(0, 0, CHPaint:GetWide(), 25)
  178.  
  179. -- Draw the top title.
  180. draw.SimpleText("Fine Received", "UiBold", 49,12, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  181. end
  182. GUI_Fined_Frame:MakePopup()
  183. GUI_Fined_Frame:ShowCloseButton(false)
  184.  
  185. local GUI_Officer_Label = vgui.Create("DLabel")
  186. GUI_Officer_Label:SetText("The Officer:")
  187. GUI_Officer_Label:SetFont("UiBold")
  188. GUI_Officer_Label:SetColor(Color(255,255,255,255))
  189. GUI_Officer_Label:SetParent(GUI_Fined_Frame)
  190. GUI_Officer_Label:SetPos(10,30)
  191. GUI_Officer_Label:SizeToContents()
  192.  
  193. local GUI_Officer_Entry = vgui.Create("DTextEntry", GUI_Fined_Frame)
  194. GUI_Officer_Entry:SetFont("UiBold")
  195. GUI_Officer_Entry:SetSize(300,25)
  196. GUI_Officer_Entry:SetPos(10,45)
  197. GUI_Officer_Entry:SetEditable(false)
  198. GUI_Officer_Entry:SetText(TheOfficer)
  199.  
  200. local GUI_Price_Label = vgui.Create("DLabel")
  201. GUI_Price_Label:SetText("Price:")
  202. GUI_Price_Label:SetFont("UiBold")
  203. GUI_Price_Label:SetColor(Color(255,255,255,255))
  204. GUI_Price_Label:SetParent(GUI_Fined_Frame)
  205. GUI_Price_Label:SetPos(10,75)
  206. GUI_Price_Label:SizeToContents()
  207.  
  208. local GUI_Price_Entry = vgui.Create("DTextEntry", GUI_Fined_Frame)
  209. GUI_Price_Entry:SetFont("UiBold")
  210. GUI_Price_Entry:SetSize(300,25)
  211. GUI_Price_Entry:SetPos(10,90)
  212. GUI_Price_Entry:SetEditable(false)
  213. GUI_Price_Entry:SetText(ThePrice)
  214.  
  215. local GUI_Reason_Label = vgui.Create("DLabel")
  216. GUI_Reason_Label:SetText("Reason:")
  217. GUI_Reason_Label:SetFont("UiBold")
  218. GUI_Reason_Label:SetColor(Color(255,255,255,255))
  219. GUI_Reason_Label:SetParent(GUI_Fined_Frame)
  220. GUI_Reason_Label:SetPos(10,119)
  221. GUI_Reason_Label:SizeToContents()
  222.  
  223. local GUI_Reason_Entry = vgui.Create("DTextEntry", GUI_Fined_Frame)
  224. GUI_Reason_Entry:SetFont("UiBold")
  225. GUI_Reason_Entry:SetSize(300,50)
  226. GUI_Reason_Entry:SetPos(10,135)
  227. GUI_Reason_Entry:SetText(TheReason)
  228. GUI_Reason_Entry:SetMultiline(true)
  229. GUI_Reason_Entry:SetEditable(false)
  230.  
  231. local GUI_AcceptButton = vgui.Create("DButton")
  232. GUI_AcceptButton:SetParent(GUI_Fined_Frame)
  233. GUI_AcceptButton:SetSize(145,25)
  234. GUI_AcceptButton:SetPos(10,190)
  235. GUI_AcceptButton:SetText("")
  236. GUI_AcceptButton.DoClick = function()
  237. surface.PlaySound( "fine_accepted_01.mp3" )
  238. net.Start("RP_Accept_Fine")
  239.     net.WriteString(TheOfficer)
  240.     net.WriteDouble(ThePrice)
  241. net.SendToServer()
  242.  
  243. GUI_Fined_Frame:Remove()
  244. end
  245. GUI_AcceptButton.Paint = function(CHPaint)
  246. draw.RoundedBoxEx(0,1,2,CHPaint:GetWide()-2,50,Color(14, 145, 72, 255), false, false, true, true)
  247.  
  248. local struc = {}
  249. struc.pos = {}
  250. struc.pos[1] = 72.5 -- x pos
  251. struc.pos[2] = 12 -- y pos
  252. struc.color = Color(255,255,255,255) -- Red
  253. struc.text = "Accept Fine" -- Text
  254. struc.font = "UiBold" -- Font
  255. struc.xalign = TEXT_ALIGN_CENTER-- Horizontal Alignment
  256. struc.yalign = TEXT_ALIGN_CENTER -- Vertical Alignment
  257. draw.Text( struc )
  258. end
  259.  
  260. local GUI_DenyButton = vgui.Create("DButton")
  261. GUI_DenyButton:SetParent(GUI_Fined_Frame)
  262. GUI_DenyButton:SetSize(145,25)
  263. GUI_DenyButton:SetPos(165,190)
  264. GUI_DenyButton:SetText("")
  265. GUI_DenyButton.DoClick = function()
  266. surface.PlaySound( "fine_declined_01.mp3" )
  267. net.Start("RP_Decline_Fine")
  268.     net.WriteString(TheOfficer)
  269.     net.WriteDouble(ThePrice)
  270. net.SendToServer()
  271.  
  272. GUI_Fined_Frame:Remove()
  273. end
  274. GUI_DenyButton.Paint = function(CHPaint)
  275. draw.RoundedBoxEx(0,1,2,CHPaint:GetWide()-2,50,Color(231, 76, 60, 255), false, false, true, true)
  276.  
  277. local struc = {}
  278. struc.pos = {}
  279. struc.pos[1] = 75 -- x pos
  280. struc.pos[2] = 12 -- y pos
  281. struc.color = Color(255,255,255,255) -- Red
  282. struc.text = "Decline Fine" -- Text
  283. struc.font = "UiBold" -- Font
  284. struc.xalign = TEXT_ALIGN_CENTER-- Horizontal Alignment
  285. struc.yalign = TEXT_ALIGN_CENTER -- Vertical Alignment
  286. draw.Text( struc )
  287. end
  288.  
  289. end
  290. usermessage.Hook("RP_FinedMenu", GUI_FinedMenu)
  291.  
  292. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement