SHARE
TWEET

Untitled

a guest Feb 4th, 2016 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Computer window
  2. wComputer,desktopImage,internetButton, emailButton, shutdownButton, chatButton, bankButton, auctionButton, noteButton = nil
  3.     -- Internet window
  4.     wInternet, internet_close_button, internet_address_label, address_bar, go_button, internet_pane, shadow_top, shadow_left, shadow_bottom = nil
  5.     -- Email Login
  6.     local email_close_button, email_error_label, username_label, username_input, address_label, address_1, address_2, address_f, password_label, password_input, email_login_button, email_register_button, wEmail = nil
  7.     -- Email Main
  8.     local wEmail, email_tab_panel, inbox_tab, outbox_tab, send_tab = nil
  9.         -- Inbox
  10.         local inbox_grid, inbox_grid_date, inbox_grid_sender, inbox_grid_subject, inbox_message_datetitle_label, inbox_message_date_label, inbox_message_fromtitle_label, inbox_message_from_label, inbox_message_subjecttitle_label, inbox_message_subject_label, inbox_message_display, inbox_message_label, check_mail_button = nil
  11.         -- Outbox
  12.         local outbox_grid, outbox_grid_date, outbox_grid_sender, outbox_grid_subject, outbox_message_datetitle_label, outbox_message_date_label, outbox_message_totitle_label, outbox_message_from_label, outbox_message_subjecttitle_label, outbox_message_subject_label, outbox_message_display, outbox_message_label
  13.         -- New message
  14.         local new_message_to_label, new_message_to_input, new_message_subject_label, new_message_subject_input, new_message_content_label, new_message_content, send_button = nil
  15. ------------------------------------------------------------------
  16. ------------------------ Computer desktop ------------------------
  17. ------------------------------------------------------------------
  18.  
  19. function createComputerGUI(limitedAccess)
  20.     if wComputer then
  21.         return
  22.     end
  23.    
  24.     _G['limitedAccess'] = limitedAccess
  25.     local Width = 700
  26.     local Height = 500
  27.     local screenwidth, screenheight = guiGetScreenSize()
  28.     local X = (screenwidth - Width)/2
  29.     local Y = (screenheight - Height)/2
  30.     wComputer = guiCreateWindow(X, Y, Width, Height, "Computer", false)
  31.     desktopImage = guiCreateStaticImage(0.0,0.05,1,0.95,"desktop.png",true,wComputer)
  32.     internetButton = guiCreateStaticImage (100,105,56,66,"internet_icon.png",false,desktopImage)
  33.     addEventHandler("onClientGUIClick",internetButton,openInternetWindow,false)
  34.     emailButton = guiCreateStaticImage (180,205,56,66,"email_icon.png",false,desktopImage)
  35.     addEventHandler("onClientGUIClick",emailButton,openEmailWindow,false)
  36.     shutdownButton = guiCreateStaticImage(10,380,56,66,"shutdown_icon.png",false,desktopImage)
  37.     addEventHandler("onClientGUIClick",shutdownButton,closeComputerWindow,false)
  38.    
  39.     bankButton = guiCreateStaticImage(350,255,56,66,"bank_icon.png",false,desktopImage)
  40.     addEventHandler("onClientGUIClick",bankButton, openBankWindow, false)
  41.     auctionButton = guiCreateStaticImage(450,150,56,66,"home_icon.png",false,desktopImage)
  42.     addEventHandler("onClientGUIClick",auctionButton,openAuctionWindow,false)
  43.     noteButton = guiCreateStaticImage(300,50,56,66,"note_icon.png",false,desktopImage)
  44.     addEventHandler("onClientGUIClick",noteButton,openNoteWindow,false)
  45.    
  46.     chatButton = guiCreateButton ( 0.03 , 0.96 , 0.14 , 0.03 , "Toggle Input" , true , desktopImage )
  47.     addEventHandler("onClientGUIClick", chatButton,  toggleChatboxComputer)
  48.     showCursor(true)
  49.     guiSetInputEnabled(true)
  50. end
  51. --addCommandHandler("computer",createComputerGUI)
  52. addEvent("useCompItem",true)
  53. addEventHandler("useCompItem",getRootElement(),createComputerGUI)
  54.  
  55. function toggleChatboxComputer( key, keyState)
  56.     if(key == "left") then
  57.         if(source == chatButton) then
  58.             if (guiGetInputEnabled( )) then
  59.                 guiSetInputEnabled(false)
  60.                 showCursor(false)
  61.                 outputChatBox("Chatbox active", 0, 255, 0, true)
  62.                 outputChatBox("Press M on the keyboard to toggle back and use the computer")
  63.             else
  64.                 guiSetInputEnabled(true)
  65.                 showCursor(false)
  66.                 outputChatBox("Computer window active", 0, 255, 0, true)
  67.             end
  68.         end
  69.     end
  70. end
  71.  
  72.  
  73. function toggleChatboxComputer2(key, keyState)
  74.     if(key == "m") then
  75.         if(wComputer and isElement(wComputer) and guiGetVisible(wComputer)) then
  76.             if (guiGetInputEnabled( )) then
  77.                 guiSetInputEnabled(false)
  78.                 outputChatBox("Chatbox active", 0, 255, 0, true)
  79.                 outputChatBox("Press M on the keyboard to toggle back and use the computer")
  80.             else
  81.                 guiSetInputEnabled(true)
  82.                 outputChatBox("Computer window active", 0, 255, 0, true)
  83.             end
  84.         end
  85.     end
  86. end
  87. bindKey ( "m", "down", toggleChatboxComputer2)
  88.  
  89.  
  90. function closeComputerWindow()
  91.     if(wInternet)then -- Internet window
  92.         destroyElement(shadow_left)
  93.         destroyElement(shadow_bottom)
  94.         destroyElement(shadow_top)
  95.         destroyElement(internet_pane)
  96.         destroyElement(go_button)
  97.         destroyElement(back_button)
  98.         destroyElement(address_bar)
  99.         destroyElement(internet_address_label)
  100.         destroyElement(internet_close_button)
  101.         destroyElement(wInternet)
  102.         wInternet, internet_close_button, internet_address_label, address_bar, go_button, back_button, internet_pane, shadow_top, shadow_left, shadow_bottom, bg = nil
  103.     end
  104.     if (username_input) then -- email
  105.         if (address_f) then
  106.             destroyElement(address_f)
  107.             address_f = nil
  108.         end
  109.         destroyElement(email_close_button)
  110.         destroyElement(email_error_label)
  111.         destroyElement(username_label)
  112.         destroyElement(username_input)
  113.         destroyElement(address_label)
  114.         destroyElement(address_1)
  115.         destroyElement(address_2)
  116.         destroyElement(password_label)
  117.         destroyElement(password_input)
  118.         destroyElement(email_login_button)
  119.         destroyElement(email_register_button)
  120.         destroyElement(wEmail)
  121.         email_close_button, email_error_label, username_label, username_input, address_label, address_1, address_2, address_f,  password_label, password_input, email_login_button, email_register_button, wEmail = nil
  122.    
  123.     elseif (inbox_grid) then
  124.    
  125.         destroyElement(inbox_grid)
  126.         destroyElement(inbox_message_datetitle_label)
  127.         destroyElement(inbox_message_date_label)
  128.         destroyElement(inbox_message_fromtitle_label)
  129.         destroyElement(inbox_message_from_label)
  130.         destroyElement(inbox_message_subjecttitle_label)
  131.         destroyElement(inbox_message_subject_label)
  132.         destroyElement(inbox_message_label)
  133.         destroyElement(inbox_message_display)
  134.         destroyElement(check_mail_button)
  135.        
  136.         destroyElement(outbox_grid)
  137.         destroyElement(outbox_message_datetitle_label)
  138.         destroyElement(outbox_message_date_label)
  139.         destroyElement(outbox_message_totitle_label)
  140.         destroyElement(outbox_message_from_label)
  141.         destroyElement(outbox_message_subjecttitle_label)
  142.         destroyElement(outbox_message_subject_label)
  143.         destroyElement(outbox_message_label)
  144.         destroyElement(outbox_message_display)
  145.        
  146.         destroyElement(new_message_to_label)
  147.         destroyElement(new_message_to_input)
  148.         destroyElement(new_message_subject_label)
  149.         destroyElement(new_message_subject_input)
  150.         destroyElement(new_message_content_label)
  151.         destroyElement(new_message_content)
  152.         destroyElement(send_button)
  153.        
  154.         destroyElement(email_close_button)
  155.         destroyElement(inbox_tab)
  156.         destroyElement(outbox_tab)
  157.         destroyElement(send_tab)
  158.         destroyElement(email_tab_panel)
  159.         destroyElement(wEmail)
  160.        
  161.         inbox_grid, inbox_grid_date, inbox_grid_sender, inbox_grid_subject, inbox_message_datetitle_label, inbox_message_date_label, inbox_message_fromtitle_label, inbox_message_from_label, inbox_message_subjecttitle_label, inbox_message_subject_label, inbox_message_display, inbox_message_label, check_mail_button = nil
  162.         outbox_grid, outbox_grid_date, outbox_grid_sender, outbox_grid_subject, outbox_message_datetitle_label, outbox_message_date_label, outbox_message_totitle_label, outbox_message_from_label, outbox_message_subjecttitle_label, outbox_message_subject_label, outbox_message_display, outbox_message_label = nil
  163.         new_message_to_label, new_message_to_input, new_message_subject_label, new_message_subject_input, new_message_content_label, new_message_content, send_button = nil
  164.         email_close_button, inbox_tab, outbox_tab, send_tab, email_tab_panel, wEmail = nil
  165.    
  166.     end
  167.     -- Computer Desktop GUI.
  168.     if wComputer then
  169.         destroyElement(internetButton)
  170.         destroyElement(emailButton)
  171.         destroyElement(shutdownButton)
  172.         destroyElement(chatButton)
  173.         destroyElement(bankButton)
  174.         destroyElement(noteButton)
  175.         destroyElement(auctionButton)
  176.         destroyElement(desktopImage)
  177.         destroyElement(wComputer)
  178.     end
  179.     wComputer,desktopImage,internetButton, emailButton, shutdownButton, chatButton, bankButton, auctionButton, noteButton = nil
  180.    
  181.     if noteWindow then -- Notepad GUI.
  182.         destroyElement(closeNote)
  183.         destroyElement(saveNote)
  184.         destroyElement(note3)
  185.         destroyElement(note2)
  186.         destroyElement(note1)
  187.         destroyElement(notePanel)
  188.         destroyElement(noteWindow)
  189.     end
  190.     noteWindow, notePanel, note1, note2, note3, saveNote, closeNote = nil
  191.    
  192.     if browserWindow then -- Auction GUI.
  193.         destroyElement(browser)
  194.         destroyElement(browserWindow)
  195.     end
  196.     browserWindow, browser = nil
  197.    
  198.     if bankWindow then -- Bank GUI.
  199.         destroyElement(bankWindow)
  200.     end
  201.     bankWindow = nil
  202.    
  203.     guiSetInputEnabled(false)
  204.     showCursor(false)
  205.    
  206. end
  207. addCommandHandler("ctl+alt+del",closeComputerWindow) -- Emergency close command.
  208.  
  209. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  210. -------------------------------------------------------------------------------- Internet Explorer   --------------------------------------------------------------------------------
  211. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  212. local now = tostring("www.sanetwork.sa")
  213. local previous = tostring("www.sanetwork.sa")
  214.  
  215. function openInternetWindow()
  216.     now = limitedAccess and "www.mdc.gov" or "www.sanetwork.sa"
  217.     previous = now
  218.     local Width = 700
  219.     local Height = 500
  220.     local screenwidth, screenheight = guiGetScreenSize()
  221.     local X = (screenwidth - Width)/2
  222.     local Y = (screenheight - Height)/2
  223.     if not (wInternet) then
  224.         wInternet = guiCreateWindow(X, Y, Width, Height, "Internet Explorer", false,wComputer)
  225.         internet_close_button = guiCreateButton(670,22,22,22,"x",false,wInternet)
  226.         guiSetProperty(internet_close_button,"AlwaysOnTop","True")
  227.         addEventHandler("onClientGUIClick",internet_close_button,closeInternetWindow,false)
  228.         internet_address_label = guiCreateLabel(10,20,670,20,"",false,wInternet)
  229.         address_bar = guiCreateEdit(40,45,320,24,"",false,wInternet)
  230.         back_button = guiCreateButton(5,45,24,24,"<",false,wInternet)
  231.         addEventHandler("onClientGUIClick",back_button,function()
  232.             get_page(previous)
  233.         end,false)
  234.         go_button = guiCreateButton(365,45,24,24,"Go",false,wInternet)
  235.         addEventHandler("onClientGUIClick",go_button,function()
  236.             local new_page = guiGetText(address_bar)
  237.             get_page(new_page)
  238.         end,false)
  239.         internet_pane = guiCreateScrollPane(2,85,678,397,false,wInternet)
  240.         guiScrollPaneSetScrollBars(internet_pane, false, true)
  241.         shadow_top = guiCreateStaticImage(2,84,676,1,"websites/colours/13.png",false,wInternet)
  242.         shadow_left = guiCreateStaticImage(2,85,1,397,"websites/colours/13.png",false,wInternet)
  243.         shadow_bottom = guiCreateStaticImage(4,482,676,1,"websites/colours/1.png",false,wInternet)
  244.         get_page(now)
  245.         guiBringToFront(wInternet)
  246.     else
  247.         guiBringToFront(wInternet)
  248.     end
  249. end
  250.  
  251. local whitelist = {"mdc.gov", "lspd.gov", "lossantos.gov", "lses.gov"}
  252. function get_page(new_page)
  253.     previous = now
  254.     now = tostring(guiGetText(address_bar))
  255.     if bg then
  256.         destroyElement(bg)
  257.         bg = nil
  258.     end
  259.     guiSetText(address_bar,new_page)
  260.     if new_page ~= "" then
  261.         if new_page:sub(-1) == "/" then
  262.             new_page = new_page:sub(0,-2)
  263.         end
  264.         local fn = new_page:gsub("%.", "_"):gsub("/","_"):gsub("-","_"):gsub("[^a-zA-Z0-9_]", ""):lower()
  265.         if string.find(new_page, "www%.") ~= 1 then
  266.             new_page = "www." .. new_page
  267.         end
  268.        
  269.         if limitedAccess then
  270.             ok = false
  271.             for k, v in ipairs(whitelist) do
  272.                 if new_page:sub(1, #v+4):lower() == "www." .. v then
  273.                     ok = true
  274.                     break
  275.                 end
  276.             end
  277.             if not ok then
  278.                 error_9001()
  279.                 return
  280.             end
  281.         end
  282.         local status, error = pcall(loadstring( "return " .. fn .. "()" ) )
  283.         if not status then
  284.             error_404()
  285.             outputDebugString( "Website: " .. fn .. " - " .. error, 2 )
  286.         end
  287.     end
  288. end
  289.  
  290. function closeInternetWindow()
  291.     if(wInternet) then
  292.         destroyElement(shadow_left)
  293.         destroyElement(shadow_bottom)
  294.         destroyElement(shadow_top)
  295.         destroyElement(internet_pane)
  296.         destroyElement(go_button)
  297.         destroyElement(back_button)
  298.         destroyElement(address_bar)
  299.         destroyElement(internet_address_label)
  300.         destroyElement(internet_close_button)
  301.         destroyElement(wInternet)
  302.         wInternet, internet_close_button, internet_address_label, address_bar, go_button, back_button, internet_pane, shadow_top, shadow_left, shadow_bottom, bg = nil
  303.     end
  304. end
  305.  
  306. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  307. -------------------------------------------------------------------------------- E-mail --------------------------------------------------------------------------------
  308. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  309. local activeMail, activeMailOut = nil, nil
  310. local prepared_mail = nil
  311. function openEmailWindow()
  312.     -- Window variables
  313.     local Width = 300
  314.     local Height = 220
  315.     local screenwidth, screenheight = guiGetScreenSize()
  316.     local X = (screenwidth - Width)/2
  317.     local Y = (screenheight - Height)/2
  318.     if not (wEmail) then
  319.         -- Create the window
  320.         wEmail = guiCreateWindow(X,Y,Width,Height,"E-mail",false,wComputer)
  321.         -- Close button
  322.         email_close_button = guiCreateButton(272,23,22,22,"x",false,wEmail)
  323.         guiSetProperty(email_close_button,"AlwaysOnTop","True")
  324.         addEventHandler("onClientGUIClick",email_close_button,function() prepared_mail = nil close_email_window() end,false)
  325.        
  326.         -- Error Label
  327.         email_error_label = guiCreateLabel(13,25,250,16,"",false,wEmail)
  328.         guiLabelSetColor(email_error_label,255,0,0)
  329.         guiSetFont(email_error_label,"default-bold-small")
  330.        
  331.         -- Username
  332.         username_label = guiCreateLabel(13,54,63,16,"Username:",false,wEmail)
  333.         username_input = guiCreateEdit(78,52,200,22,"J.Smith",false,wEmail)
  334.        
  335.         address_label = guiCreateLabel(13,88,63,16,"Provider:",false,wEmail)
  336.        
  337.         address_1 = guiCreateRadioButton(79,88,200,16,"@saonline.sa",false,wEmail)
  338.         address_2 = guiCreateRadioButton(79,104,200,16,"@whiz.sa",false,wEmail)
  339.        
  340.         local theTeam = getPlayerTeam(getLocalPlayer())
  341.         local teamName = getTeamName(theTeam)
  342.         if (teamName=="Los Santos Police Department") then
  343.             address_f = guiCreateRadioButton(79,121,200,16,"@lspd.gov",false,wEmail)
  344.         elseif (teamName=="Los Santos Emergency Services") then
  345.             address_f = guiCreateRadioButton(79,121,200,16,"@lses.gov",false,wEmail)
  346.         elseif (teamName=="Los Santos Fire Department") then
  347.             address_f = guiCreateRadioButton(79,121,200,16,"@lses.gov",false,wEmail)
  348.         elseif (teamName=="Government of Los Santos") then
  349.             address_f = guiCreateRadioButton(79,121,200,16,"@lossantos.gov",false,wEmail)
  350.         elseif (teamName=="San Andreas Network") then
  351.             address_f = guiCreateRadioButton(79,121,200,16,"@sanetwork.sa",false,wEmail)
  352.         elseif (teamName=="Hex Tow 'n Go") then
  353.             address_f = guiCreateRadioButton(79,121,200,16,"@hex.sa",false,wEmail)
  354.         elseif (teamName=="First Court of San Andreas") then
  355.             address_f = guiCreateRadioButton(79,121,200,16,"@justice.gov",false,wEmail)
  356.         elseif (teamName=="Los Santos International Airpost") then
  357.             address_f = guiCreateRadioButton(79,121,200,16,"@lsinternational.sa",false,wEmail)
  358.         elseif (teamName=="Citrus Incorporated") then
  359.             address_f = guiCreateRadioButton(79,121,200,16,"@citrus.sa",false,wEmail)
  360.         elseif (teamName=="Uni-Tel") then
  361.             address_f = guiCreateRadioButton(79,121,200,16,"@uni-tel.sa",false,wEmail)
  362.         end
  363.        
  364.         password_label = guiCreateLabel(13,154,63,16,"Password:",false,wEmail)
  365.         password_input = guiCreateEdit(78,150,200,22,"",false,wEmail)
  366.         guiEditSetMasked(password_input,true)
  367.  
  368.         -- Login
  369.         email_login_button = guiCreateButton(67,184,70,26,"Login",false,wEmail)
  370.         addEventHandler("onClientGUIClick",email_login_button,function()
  371.             local username = tostring(guiGetText(username_input))
  372.             if (tostring(username) =="") then -- username field
  373.                 guiSetText(email_error_label,"Enter a username!")
  374.             elseif (guiRadioButtonGetSelected(address_1)==false) and (guiRadioButtonGetSelected(address_2)==false) and (guiRadioButtonGetSelected(address_f)==false) then -- provider
  375.                 guiSetText(email_error_label,"You need to select a provider!")
  376.             elseif (tostring(guiGetText(password_input))=="") then
  377.                 guiSetText(email_error_label,"Enter a password!")
  378.             else
  379.                 local password = tostring(guiGetText(password_input)) -- Password
  380.                
  381.                 if (guiRadioButtonGetSelected(address_1)==true) then
  382.                     full_username = tostring(username.. "@saonline.sa")
  383.                 elseif (guiRadioButtonGetSelected(address_2)==true) then
  384.                     full_username = tostring(username.. "@whiz.sa")
  385.                 elseif (guiRadioButtonGetSelected(address_f)==true) then
  386.                    
  387.                     if (teamName=="Los Santos Police Department") then
  388.                         full_username = tostring(username.."@lspd.gov")
  389.                     elseif (teamName=="Los Santos Emergency Services") then
  390.                         full_username = tostring(username.."@lses.gov")
  391.                     elseif (teamName=="Los Santos Fire Department") then
  392.                         full_username = tostring(username.."@lsfd.gov")                    
  393.                     elseif (teamName=="Government of Los Santos") then
  394.                         full_username = tostring(username.."@lossantos.gov")
  395.                     elseif (teamName=="San Andreas Network") then
  396.                         full_username = tostring(username.."@sanetwork.sa")
  397.                     elseif (teamName=="Hex Tow 'n Go") then
  398.                         full_username = tostring(username.."@hex.sa")
  399.                     elseif (teamName=="First Court of San Andreas") then
  400.                         full_username = tostring(username.."@justice.gov")
  401.                     elseif (teamName=="Citrus Incorporated") then
  402.                         full_username = tostring(username.."@citrus.sa")
  403.                     elseif (teamName=="Uni-Tel") then
  404.                         full_username = tostring(username.."@uni-tel.sa")
  405.                     end
  406.                 end
  407.                
  408.                 triggerServerEvent("loginEmail",getLocalPlayer(),full_username,password)
  409.             end
  410.         end,false)
  411.  
  412.         -- Register
  413.         email_register_button = guiCreateButton(164,184,70,26,"Register",false,wEmail)
  414.         addEventHandler("onClientGUIClick",email_register_button,function()
  415.            
  416.             local username = tostring(guiGetText(username_input))
  417.             if (tostring(username) =="") then -- username field
  418.                 guiSetText(email_error_label,"Enter a username!")
  419.             elseif (guiRadioButtonGetSelected(address_1)==false) and (guiRadioButtonGetSelected(address_2)==false) and (guiRadioButtonGetSelected(address_f)==false) then-- provider
  420.                 guiSetText(email_error_label,"You need to select a provider!")
  421.             elseif (tostring(guiGetText(password_input))=="") then
  422.                 guiSetText(email_error_label,"Enter a password!")
  423.             else
  424.                 local password = tostring(guiGetText(password_input)) -- password
  425.                
  426.                 if (guiRadioButtonGetSelected(address_1)==true) then
  427.                     full_username = tostring(username.. "@saonline.sa")
  428.                     triggerServerEvent("registerEmail",getLocalPlayer(),full_username,password)
  429.                 elseif (guiRadioButtonGetSelected(address_2)==true) then
  430.                     full_username = tostring(username.. "@whiz.sa")
  431.                     triggerServerEvent("registerEmail",getLocalPlayer(),full_username,password)
  432.                 elseif (guiRadioButtonGetSelected(address_f)==true) then
  433.                    
  434.                     if (teamName=="Los Santos Police Department") then
  435.                         full_username = tostring(username.."@lspd.gov")
  436.                     elseif (teamName=="Los Santos Emergency Services") then
  437.                         full_username = tostring(username.."@lses.gov")
  438.                     elseif (teamName=="Los Santos Fire Department") then
  439.                         full_username = tostring(username.."@lsfd.gov")                    
  440.                     elseif (teamName=="Government of Los Santos") then
  441.                         full_username = tostring(username.."@lossantos.gov")
  442.                     elseif (teamName=="San Andreas Network") then
  443.                         full_username = tostring(username.."@sanetwork.sa")
  444.                     elseif (teamName=="Hex Tow 'n Go") then
  445.                         full_username = tostring(username.."@hex.sa")
  446.                     elseif (teamName=="First Court of San Andreas") then
  447.                         full_username = tostring(username.."@justice.gov")
  448.                     elseif (teamName=="Los Santos International Flight School") then
  449.                         full_username = tostring(username.."@lsiflight.sa")
  450.                     elseif (teamName=="Citrus Incorporated") then
  451.                         full_username = tostring(username.."@citrus.sa")
  452.                     elseif (teamName=="Uni-Tel") then
  453.                         full_username = tostring(username.."@uni-tel.sa")
  454.                     end
  455.                     triggerServerEvent("leaderCheck",getLocalPlayer(),full_username,password)
  456.                 end
  457.             end
  458.         end,false)
  459.        
  460.         guiBringToFront(wEmail)
  461.     else
  462.         guiBringToFront(wEmail)
  463.     end
  464. end
  465.  
  466. function name_error()
  467.     guiSetText(email_error_label, "Username already in use!")
  468. end
  469. addEvent("name_in_use",true)
  470. addEventHandler("name_in_use", getLocalPlayer(),name_error)
  471.  
  472. function login_error()
  473.     guiSetText(email_error_label, "Invalid username or password!")
  474. end
  475. addEvent("loginError",true)
  476. addEventHandler("loginError", getLocalPlayer(),login_error)
  477.  
  478. function not_leader()
  479.     guiSetText(email_error_label, "You can't register with this provider!")
  480. end
  481. addEvent("notLeader",true)
  482. addEventHandler("notLeader", getLocalPlayer(),not_leader)
  483.  
  484. function close_email_window()
  485.     if (username_input) then
  486.         if (address_f) then
  487.             destroyElement(address_f)
  488.             address_f = nil
  489.         end
  490.         destroyElement(email_close_button)
  491.         destroyElement(email_error_label)
  492.         destroyElement(username_label)
  493.         destroyElement(username_input)
  494.         destroyElement(address_label)
  495.         destroyElement(address_1)
  496.         destroyElement(address_2)
  497.         destroyElement(password_label)
  498.         destroyElement(password_input)
  499.         destroyElement(email_login_button)
  500.         destroyElement(email_register_button)
  501.         destroyElement(wEmail)
  502.         email_close_button, email_error_label, username_label, username_input, address_label, address_1, address_2, address_f,  password_label, password_input, email_login_button, email_register_button, wEmail = nil
  503.    
  504.     elseif (inbox_grid) then
  505.         prepared_mail = nil
  506.    
  507.         destroyElement(inbox_grid)
  508.         destroyElement(inbox_message_datetitle_label)
  509.         destroyElement(inbox_message_date_label)
  510.         destroyElement(inbox_message_fromtitle_label)
  511.         destroyElement(inbox_message_from_label)
  512.         destroyElement(inbox_message_subjecttitle_label)
  513.         destroyElement(inbox_message_subject_label)
  514.         destroyElement(inbox_message_label)
  515.         destroyElement(inbox_message_display)
  516.         destroyElement(check_mail_button)
  517.        
  518.         destroyElement(outbox_grid)
  519.         destroyElement(outbox_message_datetitle_label)
  520.         destroyElement(outbox_message_date_label)
  521.         destroyElement(outbox_message_totitle_label)
  522.         destroyElement(outbox_message_from_label)
  523.         destroyElement(outbox_message_subjecttitle_label)
  524.         destroyElement(outbox_message_subject_label)
  525.         destroyElement(outbox_message_label)
  526.         destroyElement(outbox_message_display)
  527.        
  528.         destroyElement(new_message_to_label)
  529.         destroyElement(new_message_to_input)
  530.         destroyElement(new_message_subject_label)
  531.         destroyElement(new_message_subject_input)
  532.         destroyElement(new_message_content_label)
  533.         destroyElement(new_message_content)
  534.         destroyElement(send_button)
  535.        
  536.         destroyElement(email_close_button)
  537.         destroyElement(inbox_tab)
  538.         destroyElement(outbox_tab)
  539.         destroyElement(send_tab)
  540.         destroyElement(email_tab_panel)
  541.         destroyElement(wEmail)
  542.        
  543.         inbox_grid, inbox_message_datetitle_label, inbox_message_date_label, inbox_message_fromtitle_label, inbox_message_from_label, inbox_message_subjecttitle_label, inbox_message_subject_label, inbox_message_display, inbox_message_label, check_mail_button = nil
  544.         outbox_grid, outbox_message_datetitle_label, outbox_message_date_label, outbox_message_totitle_label, outbox_message_from_label, outbox_message_subjecttitle_label, outbox_message_subject_label, outbox_message_display, outbox_message_label = nil
  545.         new_message_to_label, new_message_to_input, new_message_subject_label, new_message_subject_input, new_message_content_label, new_message_content, send_button = nil
  546.         email_close_button, inbox_tab, outbox_tab, send_tab, email_tab_panel, wEmail = nil
  547.     end
  548. end
  549. addEvent("closeEmailLogin",true)
  550. addEventHandler("closeEmailLogin", getLocalPlayer(),close_email_window)
  551.  
  552. function show_inbox(inbox_table, accountName)
  553.     if not (wEmail) then
  554.         local Width = 550
  555.         local Height = 450
  556.         local screenwidth, screenheight = guiGetScreenSize()
  557.         local X = (screenwidth - Width)/2
  558.         local Y = (screenheight - Height)/2
  559.    
  560.         -- Create the window
  561.         wEmail = guiCreateWindow(X,Y,Width,Height,"E-mail",false,wComputer)
  562.        
  563.         -- Tabs (Inbox, Outbox, Send Message)
  564.         email_tab_panel = guiCreateTabPanel(0.0,0.06,1.0,1.0,true,wEmail)
  565.         inbox_tab = guiCreateTab("Inbox",email_tab_panel)
  566.         outbox_tab = guiCreateTab("Outbox",email_tab_panel)
  567.         send_tab = guiCreateTab("Compose Message",email_tab_panel)
  568.         --account_tab = guiCreateTab("Account Settings",email_tab_panel)
  569.        
  570.         ------------------
  571.         -- Send Message --
  572.         ------------------
  573.         -- To:
  574.         new_message_to_label = guiCreateLabel(0.1,0.1,0.2,0.05,"To:",true,send_tab)
  575.         new_message_to_input = guiCreateEdit(0.2,0.1,0.3,0.05,"",true,send_tab)
  576.         -- Subject:
  577.         new_message_subject_label = guiCreateLabel(0.1,0.2,0.2,0.05,"Subject:",true,send_tab)
  578.         new_message_subject_input = guiCreateEdit(0.2,0.2,0.5,0.05,"",true,send_tab)
  579.         -- Message:
  580.         new_message_content_label = guiCreateLabel(0.1,0.3,0.3,0.05,"Message:",true,send_tab)
  581.         new_message_content = guiCreateMemo(0.1,0.4,0.8,0.45,"",true,send_tab)
  582.         -- Send Button
  583.         send_button = guiCreateButton(0.4,0.9,0.2,0.08,"Send",true,send_tab)
  584.         addEventHandler("onClientGUIClick",send_button,function()
  585.             local to = guiGetText(new_message_to_input)
  586.             local subject = guiGetText(new_message_subject_input)
  587.             local message = guiGetText(new_message_content)
  588.            
  589.             triggerServerEvent("sendMessage",getLocalPlayer(),accountName,to,subject,message)
  590.         end,false)
  591.        
  592.         if prepared_mail then
  593.             guiSetSelectedTab(email_tab_panel, send_tab)
  594.             if prepared_mail[1] then
  595.                 guiSetText(new_message_to_input, prepared_mail[1])
  596.             end
  597.             if prepared_mail[2] then
  598.                 guiSetText(new_message_subject_input, prepared_mail[2])
  599.             end
  600.             if prepared_mail[3] then
  601.                 guiSetText(new_message_content, prepared_mail[3])
  602.             end
  603.             prepared_mail = nil
  604.         end
  605.        
  606.         --[[
  607.         ---------------------
  608.         -- Account Options --
  609.         ---------------------
  610.        
  611.         -- Change Password
  612.         old_password_label = guiCreateLabel(0.1,0.1,0.3,0.05,"Old Password",true,account_tab)
  613.         old_password_input = guiCreateEdit(0.4,0.1,0.3,0.05,"",true,account_tab)
  614.         guiEditSetMasked(old_password_input,true)
  615.         new_password_label = guiCreateLabel(0.1,0.2,0.3,0.05,"New Password",true,account_tab)
  616.         new_password_input = guiCreateEdit(0.4,0.2,0.3,0.05,"",true,account_tab)
  617.         guiEditSetMasked(new_password_input,true)
  618.         confirm_password_label = guiCreateLabel(0.1,0.3,0.3,0.05,"Confirm New Password",true,account_tab)
  619.         confirm_password_input = guiCreateEdit(0.4,0.3,0.3,0.05,"",true,account_tab)
  620.         guiEditSetMasked(confirm_password_input,true)
  621.         --save button
  622.         save_button = guiCreateButton(0.4,0.4,0.2,0.08,"Save",true,account_tab)
  623.         -- Clear Button
  624.        
  625.         -- Delete Account
  626.         delete_account_label = guiCreateLabel(0.1,0.5,0.8,0.3,"To delete this email account enter your password below and\
  627.                                                             press the delete account button.\
  628.                                                             \
  629.                                                             Deleting an account is permenant and can not be undone.",true,account_tab)
  630.         delete_account_input = guiCreateEdit(0.1,0.7,0.3,0.05,"",true,account_tab)
  631.         guiEditSetMasked(delete_account_input,true)
  632.         --button
  633.         delete_account_button = guiCreateButton(0.4,0.8,0.2,0.08,"Delete Account",true,account_tab)]]
  634.        
  635.         -- Close button
  636.         email_close_button = guiCreateButton(0.94,0.05,0.06,0.05,"x",true,wEmail)
  637.         guiSetProperty(email_close_button,"AlwaysOnTop","True")
  638.         addEventHandler("onClientGUIClick",email_close_button,close_email_window,false)
  639.     end
  640.    
  641.     -----------
  642.     -- Inbox --
  643.     -----------
  644.    
  645.     if (inbox_grid) then
  646.         guiGridListClear(inbox_grid)
  647.         destroyElement(inbox_grid)
  648.         inbox_grid = nil
  649.     end
  650.     activeMail = 1
  651.     -- Create the grid list of received messages
  652.     inbox_grid = guiCreateGridList (0.01,0.02,0.98,0.36,true,inbox_tab)
  653.     inbox_grid_date = guiGridListAddColumn(inbox_grid,"Date",0.16)
  654.     inbox_grid_sender = guiGridListAddColumn(inbox_grid,"From",0.3)
  655.     inbox_grid_subject = guiGridListAddColumn(inbox_grid,"Subject",0.5)
  656.     guiGridListSetSortingEnabled(inbox_grid,false)
  657.     if inbox_table[1][1] ~= "" or inbox_table[1][2] ~= "" then
  658.         for key, value in pairs(inbox_table) do
  659.             i_message_date = inbox_table[key][2]
  660.             i_message_sender = inbox_table[key][3]
  661.             i_message_subject = inbox_table[key][4]
  662.             inbox_row = guiGridListAddRow(inbox_grid)
  663.             guiGridListSetItemText(inbox_grid, inbox_row, inbox_grid_date, i_message_date, false, false) -- Date Sent
  664.             guiGridListSetItemText(inbox_grid, inbox_row, inbox_grid_sender, i_message_sender, false, false) -- Sender
  665.             guiGridListSetItemText(inbox_grid, inbox_row, inbox_grid_subject, i_message_subject, false, false) -- Subject
  666.         end
  667.         guiGridListSetSelectedItem(inbox_grid,0,1)
  668.     end
  669.    
  670.     if not(inbox_message_datetitle_label) then
  671.         -- Static labels showing date and sender
  672.         inbox_message_datetitle_label = guiCreateLabel(0.02,0.4,0.96,0.1,"Date received:",true,inbox_tab)
  673.         guiSetFont(inbox_message_datetitle_label,"default-bold-small")
  674.         inbox_message_date_label = guiCreateLabel(0.185,0.4,0.96,0.1,tostring(inbox_table[1][2]),true,inbox_tab)
  675.        
  676.         inbox_message_fromtitle_label = guiCreateLabel(0.5,0.4,0.96,0.1,"From:",true,inbox_tab)
  677.         guiSetFont(inbox_message_fromtitle_label,"default-bold-small")
  678.         inbox_message_from_label = guiCreateLabel(0.575,0.4,0.45,0.1,tostring(inbox_table[1][3]),true,inbox_tab)
  679.        
  680.         inbox_message_subjecttitle_label = guiCreateLabel(0.02,0.45,0.96,0.1,"Subject:",true,inbox_tab)
  681.         guiSetFont(inbox_message_subjecttitle_label,"default-bold-small")
  682.         inbox_message_subject_label = guiCreateLabel(0.115,0.45,0.8,0.1,tostring(inbox_table[1][4]),true,inbox_tab)
  683.        
  684.         -- Scroll pane displaying selected message
  685.         inbox_message_display = guiCreateScrollPane(0.02,0.52,0.96,0.34,true,inbox_tab)
  686.         guiScrollPaneSetScrollBars(inbox_message_display, false, true)
  687.         -- Display first message in text label
  688.         inbox_message_label = guiCreateLabel(0.02,0.05,0.96,4.0, tostring(inbox_table[1][5]),true,inbox_message_display)
  689.         guiLabelSetHorizontalAlign(inbox_message_label,"left",true)
  690.     else
  691.         guiSetText(inbox_message_date_label,tostring(inbox_table[1][2]))
  692.         guiSetText(inbox_message_from_label,tostring(inbox_table[1][3]))
  693.         guiSetText(inbox_message_subject_label,tostring(inbox_table[1][4]))
  694.         guiSetText(inbox_message_label,tostring(inbox_table[1][5]))
  695.     end
  696.     addEventHandler("onClientGUIClick",inbox_grid,function(button, state)
  697.         if(button == "left") then
  698.             local row = tonumber(guiGridListGetSelectedItem(inbox_grid)+1)
  699.             activeMail = row
  700.             if row > 0 then
  701.                 guiSetText(inbox_message_date_label,tostring(inbox_table[row][2]))
  702.                 guiSetText(inbox_message_from_label,tostring(inbox_table[row][3]))
  703.                 guiSetText(inbox_message_subject_label,tostring(inbox_table[row][4]))
  704.                 guiSetText(inbox_message_label,tostring(inbox_table[row][5]))
  705.             end
  706.         end
  707.     end,false)
  708.    
  709.     if not (check_mail_button) then
  710.         check_mail_button = guiCreateButton(0.2,0.9,0.2,0.08,"Check Mail",true,inbox_tab)
  711.         addEventHandler("onClientGUIClick",check_mail_button, function()
  712.             triggerServerEvent("s_getInbox",getLocalPlayer(),accountName)
  713.         end,false)
  714.        
  715.         --DELETE FUNCTION (INBOX)
  716.         inbox_delete_mail_button = guiCreateButton(0.4,0.9,0.2,0.08,"Delete",true,inbox_tab)
  717.         addEventHandler("onClientGUIClick",inbox_delete_mail_button,function()
  718.             local msg = inbox_table[activeMail]
  719.             if msg and msg[2] ~= "" then
  720.                 triggerServerEvent("deleteInboxMessage",getLocalPlayer(),msg[1],accountName)
  721.             end
  722.         end,false)
  723.        
  724.         --REPLY BUTTON
  725.         inbox_reply_button = guiCreateButton(0.6,0.9,0.2,0.08,"Reply",true,inbox_tab)
  726.         addEventHandler("onClientGUIClick",inbox_reply_button,function()
  727.             local msg = inbox_table[activeMail]
  728.             if msg and msg[2] ~= "" then
  729.                 guiSetText(new_message_to_input, msg[3])
  730.                
  731.                 if msg[4]:find( "Re: " ) ~= 1 then
  732.                     guiSetText(new_message_subject_input, "Re: " .. msg[4])
  733.                 else
  734.                     guiSetText(new_message_subject_input, msg[4])
  735.                 end
  736.                 guiSetText(new_message_content, "")
  737.                 guiSetSelectedTab(email_tab_panel, send_tab)
  738.             end
  739.         end,false)
  740.        
  741.     end
  742. end
  743. addEvent("showInbox",true)
  744. addEventHandler("showInbox",getLocalPlayer(),show_inbox)
  745.  
  746. function show_outbox(outbox_table,accountName)
  747.     ------------
  748.     -- Outbox --
  749.     ------------
  750.    
  751.     if (outbox_grid) then
  752.         destroyElement(outbox_grid)
  753.         outbox_grid = nil
  754.     end
  755.     activeMailOut = 1
  756.     -- Create the grid list of received messages
  757.     outbox_grid = guiCreateGridList (0.01,0.02,0.98,0.36,true,outbox_tab)
  758.     outbox_grid_date = guiGridListAddColumn(outbox_grid,"Date",0.16)
  759.     outbox_grid_sender = guiGridListAddColumn(outbox_grid,"From",0.3)
  760.     outbox_grid_subject = guiGridListAddColumn(outbox_grid,"Subject",0.5)
  761.     guiGridListSetSortingEnabled(outbox_grid,false)
  762.    
  763.     if outbox_table[1][1] ~= "" or outbox_table[1][2] ~= "" then
  764.         for key, value in pairs(outbox_table) do
  765.             local o_message_date = outbox_table[key][2]
  766.             local o_message_sender = outbox_table[key][3]
  767.             local o_message_subject = outbox_table[key][4]
  768.            
  769.             local outbox_row = guiGridListAddRow(outbox_grid)
  770.             guiGridListSetItemText(outbox_grid, outbox_row, outbox_grid_date, o_message_date, false, false) -- Date Sent
  771.             guiGridListSetItemText(outbox_grid, outbox_row, outbox_grid_sender, o_message_sender, false, false) -- Sender
  772.             guiGridListSetItemText(outbox_grid, outbox_row, outbox_grid_subject, o_message_subject, false, false) -- Subject
  773.         end
  774.         guiGridListSetSelectedItem(outbox_grid,0,1)
  775.     end
  776.     if not(outbox_message_datetitle_label) then
  777.         -- Static labels showing date and sender
  778.         outbox_message_datetitle_label = guiCreateLabel(0.02,0.4,0.96,0.1,"Date received:",true,outbox_tab)
  779.         guiSetFont(outbox_message_datetitle_label,"default-bold-small")
  780.         outbox_message_date_label = guiCreateLabel(0.185,0.4,0.96,0.1,tostring(outbox_table[1][2]),true,outbox_tab)
  781.        
  782.         outbox_message_totitle_label = guiCreateLabel(0.5,0.4,0.96,0.1,"To:",true,outbox_tab)
  783.         guiSetFont(outbox_message_totitle_label,"default-bold-small")
  784.         outbox_message_from_label = guiCreateLabel(0.575,0.4,0.45,0.1,tostring(outbox_table[1][3]),true,outbox_tab)
  785.        
  786.         outbox_message_subjecttitle_label = guiCreateLabel(0.02,0.45,0.96,0.1,"Subject:",true,outbox_tab)
  787.         guiSetFont(outbox_message_subjecttitle_label,"default-bold-small")
  788.         outbox_message_subject_label = guiCreateLabel(0.115,0.45,0.8,0.1,tostring(outbox_table[1][4]),true,outbox_tab)
  789.        
  790.         -- Scroll pane displaying selected message
  791.         outbox_message_display = guiCreateScrollPane(0.02,0.52,0.96,0.34,true,outbox_tab)
  792.         guiScrollPaneSetScrollBars(outbox_message_display, false, true)
  793.         -- Display first message in text label
  794.         outbox_message_label = guiCreateLabel(0.02,0.05,0.96,2.0, tostring(outbox_table[1][5]),true,outbox_message_display)
  795.         guiLabelSetHorizontalAlign(outbox_message_label,"left",true)
  796.     else
  797.         guiSetText(outbox_message_date_label,tostring(outbox_table[1][2]))
  798.         guiSetText(outbox_message_from_label,tostring(outbox_table[1][3]))
  799.         guiSetText(outbox_message_subject_label,tostring(outbox_table[1][4]))
  800.         guiSetText(outbox_message_label,tostring(outbox_table[1][5]))
  801.     end
  802.    
  803.     addEventHandler("onClientGUIClick",outbox_grid,function(button, state)
  804.         if(button == "left") then
  805.        
  806.             local row = tonumber(guiGridListGetSelectedItem(outbox_grid)+1)
  807.             activeMailOut = row
  808.             if row > 0 then
  809.                 guiSetText(outbox_message_date_label,tostring(outbox_table[row][2]))
  810.                 guiSetText(outbox_message_from_label,tostring(outbox_table[row][3]))
  811.                 guiSetText(outbox_message_subject_label,tostring(outbox_table[row][4]))
  812.                 guiSetText(outbox_message_label,tostring(outbox_table[row][5]))
  813.             end
  814.         end
  815.     end,false)
  816.    
  817.     if not (outbox_delete_mail_button) then
  818.        
  819.         -- DELETE FUNCTION (OUTBOX)
  820.         outbox_delete_mail_button = guiCreateButton(0.4,0.9,0.2,0.08,"Delete",true,outbox_tab)
  821.         addEventHandler("onClientGUIClick",outbox_delete_mail_button,function()
  822.             local msg = outbox_table[activeMailOut]
  823.             if msg and msg[2] ~= "" then
  824.                 triggerServerEvent("deleteOutboxMessage",getLocalPlayer(),msg[1], accountName)
  825.             end
  826.         end,false)
  827.     end
  828. end
  829. addEvent("showOutbox",true)
  830. addEventHandler("showOutbox",getLocalPlayer(),show_outbox)
  831.  
  832.  
  833. function invalid_address()
  834.     guiSetText(new_message_to_input, "Address not found!")
  835. end
  836. addEvent("invalidAddress",true)
  837. addEventHandler("invalidAddress",getLocalPlayer(),invalid_address)
  838.  
  839. function c_send_message()
  840.     guiSetSelectedTab(email_tab_panel,outbox_tab)
  841. end
  842. addEvent("c_sendMessage",true)
  843. addEventHandler("c_sendMessage",getLocalPlayer(),c_send_message)
  844.  
  845. function compose_mail( address, title, text )
  846.     prepared_mail = { address, title, text }
  847.     openEmailWindow()
  848. end
  849. ----------------------------------------
  850.  
  851. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  852. -------------------------------------------------------------------------------- Bank   -----------------------------------------------------------------------------------
  853. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  854. function openBankWindow()
  855.     outputChatBox("Requesting bank access...")
  856.     outputChatBox("This may take up to few seconds.")
  857.    
  858.     local bankWindow = setTimer (function()
  859.         triggerServerEvent("requestATMInterface", getLocalPlayer())
  860.     end, 2000, 1)
  861. end
  862. ----------------------------------------
  863.  
  864. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  865. -------------------------------------------------------------------------------- Note   -----------------------------------------------------------------------------------
  866. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  867. function openNoteWindow()
  868.     if noteWindow then
  869.         return
  870.     end
  871.    
  872.     local Width = 550
  873.     local Height = 350
  874.     local screenwidth, screenheight = guiGetScreenSize()
  875.     local X = (screenwidth - Width)/2
  876.     local Y = (screenheight - Height)/2
  877.     noteWindow = guiCreateWindow(X, Y, Width, Height, "Notepad v1.0", false)
  878.     notePanel = guiCreateTabPanel ( 0, 0.05, Width, 0.8, true, noteWindow)
  879.     note1 = guiCreateTab("Note 1",notePanel)
  880.     memo1 = guiCreateMemo(0, 0, 1, 1, "", true, note1)
  881.     note2 = guiCreateTab("Note 2",notePanel)
  882.     memo2 = guiCreateMemo(0, 0, 1, 1, "", true, note2)
  883.     note3 = guiCreateTab("Note 3",notePanel)
  884.     memo3 = guiCreateMemo(0, 0, 1, 1, "", true, note3)
  885.    
  886.     saveNote = guiCreateButton(0.2, 0.875, 0.2, 0.1, "Save", true, noteWindow)
  887.     addEventHandler("onClientGUIClick", saveNote, SaveNote, false)
  888.     closeNote = guiCreateButton(0.6, 0.875, 0.2, 0.1, "Close", true, noteWindow)
  889.     addEventHandler("onClientGUIClick", closeNote, CloseNote)
  890.    
  891.     guiSetInputEnabled(true)
  892.     guiSetInputMode("no_binds_when_editing")
  893. end
  894.  
  895. function CloseNote()
  896.     if(noteWindow) then
  897.         destroyElement(saveNote)
  898.         destroyElement(closeNote)
  899.         destroyElement(note3)
  900.         destroyElement(note2)
  901.         destroyElement(note1)
  902.         destroyElement(notePanel)
  903.         destroyElement(noteWindow)
  904.         noteWindow, notePanel, note1, note2, note3, closeNote, saveNote = nil
  905.        
  906.         guiSetInputEnabled(false)
  907.         guiSetInputMode("no_binds_when_editing")
  908.     end
  909. end
  910.  
  911. function SaveNote(button, state)
  912.     if source == saveNote and button == "left" and state == "up" then
  913.         local text = guiGetText(memo1)
  914.         if text then
  915.             triggerServerEvent("saveNote", getLocalPlayer(), text, getLocalPlayer()) -- how to output it so when the player re-opens it, it loads the last note he saved?
  916.         end
  917.         local text2 = guiGetText(memo2)
  918.         if text2 then
  919.             triggerServerEvent("saveNote2", getLocalPlayer(), text2, getLocalPlayer())
  920.         end
  921.         local text3 = guiGetText(memo3)
  922.         if text3 then
  923.             triggerServerEvent("saveNote3", getLocalPlayer(), text3, getLocalPlayer())
  924.         end
  925.     end
  926. end
  927.  
  928. ----------------------------------------
  929.  
  930. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  931. -------------------------------------------------------------------------------- Auction   --------------------------------------------------------------------------------
  932. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  933. function openAuctionWindow()
  934.     if browserWindow then
  935.         return
  936.     end
  937.  
  938.     local Width = 700
  939.     local Height = 475
  940.     local screenwidth, screenheight = guiGetScreenSize()
  941.     local X = (screenwidth - Width)/2
  942.     local Y = (screenheight - Height)/2+15
  943.     browserWindow = guiCreateWindow(X, Y, Width, Height, "San Andreas Auctions", false)
  944.     browser = guiCreateBrowser(0, 0, 650, 450, false, false, false, browserWindow) -- doesnt work, dunno why
  945.     auctionClose = guiCreateButton(670,22,22,22,"x",false,browserWindow)
  946.         addEventHandler("onClientGUIClick",auctionClose,closeAuctionWindow,false)
  947.    
  948.     local theBrowser = guiGetBrowser(browser)
  949. addEventHandler("onClientBrowserCreated", theBrowser,
  950.     function()
  951.         loadBrowserURL(source, "http://www.youtube.com")
  952.     end
  953. )
  954.     focusBrowser(theBrowser)
  955. end
  956.  
  957. function closeAuctionWindow()
  958.     if(browserWindow) then
  959.         destroyElement(browser)
  960.         destroyElement(auctionClose)
  961.         destroyElement(browserWindow)
  962.         auctionClose, browserWindow, browser = nil
  963.     end
  964. end
  965.  
  966. ----------------------------------------
  967. addEventHandler("onClientResourceStop", getResourceRootElement( ),
  968.     function()
  969.         closeComputerWindow()
  970.     end
  971. )
  972.  
  973. ----
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top