Advertisement
sadfroger

Security RP chip

Sep 29th, 2016
1,890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.95 KB | None | 0 0
  1. #Version 1.11:
  2. @model models/props_lab/workspace003.mdl
  3. @name Security RP chip
  4. @inputs
  5. @outputs
  6. @persist Debugalarmdoor MainT Alarmtimer Hidename KeyTP:entity EGP:array EGPState:table Notice Alarmsound
  7. @persist Locktime FTime Picking Failure Picksound:array CountS USTel LastPlayerSicherung:table NoticeText:string J EgpRate Keeptrying Touch:table Extracount LUC Alarmnext
  8. @persist Main:entity [Alarm, Sicherung]:array [Alarmtp, Type, Activealarm, Playertsicherung, SicherungDetails, Power, Whitelist]:table Valid Ply:entity Toparent Toparentto:entity Sicherungtick Vegp Tryagain
  9. @trigger
  10. # Todo
  11. # [Content] Search Core. First one for the touchscreen
  12. # [Content] Make alarms removable
  13. # [Content] Navigate Menu
  14. # [Improvement] Multiple Alarm sound by one player fix
  15.  
  16. # [Bug] If there are to many active Lists the E2 crashes
  17. # [Bug] List needs to reloaded manuelly at the first time (Menustate is always mainmenu until that) fix (Dirty Workaround)
  18. # [Bug] If there are multiple alarms only the first alarm can be checked. (fixed by NSA Killerknight)
  19.  
  20. interval(500)
  21. runOnHTTP(1)
  22. runOnChat(1)
  23. runOnLast(1)
  24. #Automate Update
  25. if(!USTel&httpCanRequest()) {
  26. print("Beginn with searching for updates.")
  27. print("----------------")
  28. USTel=1  
  29. httpRequest("http://pastebin.com/raw/xr4tpD0p")
  30. }
  31. if(httpClk()&USTel==3) {
  32.  
  33. DatasTel=httpData()
  34. print("Update!")
  35. print("-----------")
  36. #print("Version "+Datas[2,string])
  37. print("Changes:")  
  38. print(DatasTel)
  39. print("The E2 is saved in you e2shared folder!")
  40. print("-----------")
  41.  
  42. USTel=420
  43. }
  44. if(httpClk()&USTel==1) {
  45. Data=httpData():explode(":")[1,string]:explode(" ")  
  46. if(Data[2,string]:toNumber()>1.11) {
  47. hint("Update was found!",4)  
  48. fileWrite(">e2shared/Security RP chip.txt",httpData())
  49. USTel=2
  50. } else {
  51. USTel=420
  52. print("No updates found.")
  53. }
  54. }
  55. if(USTel==2&httpCanRequest()) {httpRequest("http://pastebin.com/raw/3JfNrtd2") USTel=3}
  56. #/Automate Update/
  57.  
  58. if(USTel==420) {
  59. if (changed(USTel)) {
  60.         Sicherungtick=1000
  61.     timer("Sicherungtick",1000)
  62.     dsJoinGroup("securityrpchip")
  63.     EgpRate=200
  64.     timer("egprate",EgpRate)
  65.     Alarmtimer = 1000
  66.     timer("alarm", Alarmtimer)
  67.     timer("sicherungnewplayer", 1000)
  68.     Hidename = 0 #1 For hiding names
  69.     Alarmsound= 1# Toggle the Alarm Sound
  70.     MainT = 1
  71.     Picksound:pushString("weapons/357/357_reload1.wav")
  72.     Picksound:pushString("weapons/357/357_reload3.wav")
  73.     Picksound:pushString("weapons/357/357_reload4.wav")
  74. }
  75. if (last()) {
  76.     C = 0
  77.     while (C <= EGP:count()) {
  78.         C++#kek
  79.         CEGP = EGP[C, wirelink]
  80.         CEGP:egpClear()
  81.     }
  82.     propDeleteAll()
  83. }
  84. #EGP
  85.  
  86. function normal main(EGPf:wirelink) {
  87.     EGPf:egpClear()
  88.     EGPf:egpBox(5, vec2(256), vec2(256) * 2)# Backround
  89.     EGPf:egpColor(5, vec(0, 0, 255))
  90.     EGPf:egpRoundedBox(1, vec2(256) - vec2(65, 0), vec2(110, 50))
  91.     EGPf:egpText(2, "List", EGPf:egpPos(1) - vec2(0, 12))
  92.     EGPf:egpSize(2, 25)
  93.     EGPf:egpFont(2, "Times New Roman")
  94.     EGPf:egpColor(2, vec(0, 0, 200))
  95.     EGPf:egpAlign(2, 1)
  96.     EGPf:egpRoundedBox(3, vec2(256) + vec2(65, 0), vec2(110, 50))
  97.     EGPf:egpText(4, "Navigate", EGPf:egpPos(3) - vec2(0, 12))
  98.     EGPf:egpSize(4, 25)
  99.     EGPf:egpFont(4, "Times New Roman")
  100.     EGPf:egpColor(4, vec(0, 0, 200))
  101.     EGPf:egpAlign(4, 1)
  102.     EGPf:egpCircle(6, vec2(0), vec2(5))
  103.     EGPf:egpColor(6, vec(255, 200, 0))
  104.     EGPf:egpAlpha(6, 180)
  105.     EGPf:egpParentToCursor(6)
  106.     EGPState[EGPf:entity():id(), string] = "main"
  107. }
  108.  
  109. function normal list(EGPf:wirelink) {
  110.     #print("list")
  111.     EGPf:egpClear()
  112.     EGPf:egpBox(5, vec2(256), vec2(256) * 2)# Backround
  113.     EGPf:egpColor(5, vec(0, 0, 255))
  114.     EGPf:egpRoundedBox(1, vec2(256) - vec2(190, 225), vec2(110, 50))
  115.     EGPf:egpText(2, "Main menu", EGPf:egpPos(1) - vec2(0, 12))
  116.     EGPf:egpSize(2, 25)
  117.     EGPf:egpFont(2, "Times New Roman")
  118.     EGPf:egpColor(2, vec(0, 0, 200))
  119.     EGPf:egpAlign(2, 1)
  120.     #[EGPf:egpRoundedBox(3, vec2(256) + vec2(65, 0), vec2(110, 50)) EGPf:egpText(4, "Navigate", EGPf:egpPos(3) - vec2(0, 12)) EGPf:egpSize(4, 25) EGPf:egpFont(4, "Times New Roman") EGPf:egpColor(4, vec(0, 0, 200)) EGPf:egpAlign(4, 1)]#
  121.     EGPf:egpCircle(6, vec2(0), vec2(5))
  122.     EGPf:egpColor(6, vec(255, 200, 0))
  123.     EGPf:egpAlpha(6, 180)
  124.     EGPf:egpParentToCursor(6)
  125.     EGPf:egpLine(7, vec2(0, 60), vec2(256 * 2, 60))
  126.     EGPf:egpLine(8, vec2(256, 60), vec2(256, 241 * 2))
  127.     EGPf:egpLine(9, vec2(0, 241 * 2), vec2(256 * 2, 241 * 2))
  128.     C = 0
  129.     while (C < Alarm:count()) {
  130.         C++
  131.         CAlarm = Alarm[C, entity]
  132.         G = 0
  133.         EGPf:egpText(10 + C, Type[CAlarm:id(), string] + " from " + Alarmtp[CAlarm:id(), entity]:name(), vec2(10, 60 + C * 23))
  134.         EGPf:egpAlign(10 + C, 0)
  135.         if (!Type[CAlarm:id(), string]:find("Controlbox")) {
  136.             EGPf:egpRoundedBox(50 + C, vec2(286, 72 + C * 23), vec2(44, 20))
  137.             if (Power[CAlarm:id(), number]) {
  138.                 EGPf:egpText(90 + C, "On", vec2(286, 63 + C * 23))
  139.                 EGPf:egpColor(90 + C, vec(0, 255, 0))
  140.             }
  141.             else {
  142.                 EGPf:egpText(90 + C, "Off", vec2(286, 63 + C * 23))
  143.                 EGPf:egpColor(90 + C, vec(255, 0, 0))
  144.             }
  145.             EGPf:egpAlign(90 + C, 1)
  146.         }
  147.         if (Activealarm[CAlarm:id(), string]:length() > 2) {
  148.             EGPf:egpRoundedBox(130 + C, vec2(370 + 10, 72 + C * 23), vec2(130, 20))
  149.             EGPf:egpText(170 + C, "Alarm-" + Activealarm[CAlarm:id(), string]:explode(" ")[1, string], vec2(370 + 10, 63 + C * 23))
  150.             EGPf:egpColor(170 + C, vec(255, 0, 0))
  151.         }
  152.         else {
  153.             EGPf:egpRoundedBox(130 + C, vec2(370 + 10, 72 + C * 23), vec2(90, 20))
  154.             EGPf:egpText(170 + C, "No Alarm", vec2(370 + 10, 63 + C * 23))
  155.             EGPf:egpColor(170 + C, vec(0, 255, 0))
  156.         }
  157.         EGPf:egpAlign(170 + C, 1)
  158.         EGPState[EGPf:entity():id(), string] = "list"
  159.     }
  160. #    /EGP
  161. }
  162.  
  163. function normal navigate(EGPf:wirelink) {
  164.     TT = table()
  165.     TA = array()
  166.     while (C < Alarm:count()) {
  167.         C++
  168.         CAlarm = Alarm[C, entity]
  169.         Owner = Alarmtp[CAlarm:id(), entity]
  170.         if (!TT[Owner:id(), number]) {
  171.             TT[Owner:id(), number] = 1
  172.             TA:pushEntity(Owner)
  173.         }
  174.     }
  175.     EGPf:egpClear()
  176.     EGPf:egpBox(5, vec2(256), vec2(256) * 2)# Backround
  177.     EGPf:egpColor(5, vec(0, 0, 255))
  178.     EGPf:egpRoundedBox(1, vec2(256, 50) - vec2(160, 0), vec2(110, 50))
  179.     EGPf:egpText(2, "List", EGPf:egpPos(1) - vec2(0, 12))
  180.     EGPf:egpSize(2, 25)
  181.     EGPf:egpFont(2, "Times New Roman")
  182.     EGPf:egpColor(2, vec(0, 0, 200))
  183.     EGPf:egpAlign(2, 1)
  184.     EGPf:egpCircle(6, vec2(0), vec2(5))
  185.     EGPf:egpColor(6, vec(255, 200, 0))
  186.     EGPf:egpAlpha(6, 180)
  187.     EGPf:egpParentToCursor(6)
  188.     EGPState[EGPf:entity():id(), string] = "main"
  189. }
  190. #functions
  191.  
  192. function number touch(EGPf:wirelink, N, User:entity) {
  193.     if (User:pos():distance(EGPf:entity():pos()) < 90) {
  194.         Cursor = EGPf:egpCursor(User)
  195.         if (inrange(Cursor, EGPf:egpPos(N) - EGPf:egpSize(N) / 2, EGPf:egpPos(N) + EGPf:egpSize(N) / 2)) {
  196.             return 1
  197.         }
  198.     }
  199.     return 0
  200. }
  201.  
  202. function string chat(E:entity, N) {
  203.     return E:lastSaid():explode(" ")[N, string]
  204. }
  205.  
  206. function number addalarm(E:entity, O:entity) {
  207.     if (O:isPlayer() & !Alarmtp[E:id(), entity]:isPlayer()) {
  208.         Class = E:type()
  209.         Power[E:id(), number] = 1
  210.         Alarmtp[E:id(), entity] = O
  211.         if (Class:find("door")) {
  212.             Alarm:pushEntity(E)
  213.             hint("A door from " + O:name():explode(" ")[1, string] + " was added.", 2)
  214.             Type[E:id(), string] = "Door"
  215.             return 1
  216.         }
  217.         if (Class:find("keypad")) {
  218.             Alarm:pushEntity(E)
  219.             hint("A keypad from " + O:name():explode(" ")[1, string] + " was added.", 2)
  220.             Alarmtp[E:id(), entity] = O
  221.             Type[E:id(), string] = "Keypad"
  222.             return 1
  223.         }
  224.         if (Class:find("vehicle")) {
  225.             Alarm:pushEntity(E)
  226.             hint("A car from " + O:name():explode(" ")[1, string] + " was added.", 2)
  227.             Alarmtp[E:id(), entity] = O
  228.             Type[E:id(), string] = "Vehicle"
  229.             return 1
  230.         }
  231.         if (Class:find("printer")) {
  232.             Alarm:pushEntity(E)
  233.             hint("A money printer from " + O:name():explode(" ")[1, string] + " was added.", 2)
  234.             Alarmtp[E:id(), entity] = O
  235.             Type[E:id(), string] = "Printer"
  236.             return 1
  237.         }
  238.         Power:remove(E:id())
  239.         Alarmtp:remove(E:id())
  240.     }
  241.     if (Alarmtp[E:id(), entity]:isPlayer()) {
  242.         hint("You already added this alarm.", 2)
  243.     }
  244.     return 0
  245. }
  246.  
  247. function number use(E:entity) {
  248.     if (changed(E:keyUse()) & E:keyUse()) {
  249.         return 1
  250.     }
  251.     return 0
  252. }
  253.  
  254. function number contain(Y:entity, A:array) {
  255.     for (V = 1, A:count()) {
  256.         if (Y == A[V, entity]) {
  257.             return V
  258.         }
  259.     }
  260.     return 0
  261. }
  262.  
  263. function number containn(Y:number, A:array) {
  264.     for (V = 1, A:count()) {
  265.         if (Y == A[V, number]) {
  266.             return V
  267.         }
  268.     }
  269.     return 0
  270. }
  271.  
  272. function number contains(Y:string, A:array) {
  273.     for (V = 1, A:count()) {
  274.         if (Y == A[V, entity]:type()) {
  275.             return 1
  276.         }
  277.     }
  278.     return 0
  279. }#[
  280.     function number deleted() {
  281.         TempCount = array()
  282.         for (AMK2 = 1, Alls:count()) {
  283.             E = Alls[AMK2, entity]
  284.             if (E) {} else {
  285.                 On[Alls[AMK2, entity]:id(), number] = 0
  286.                 timer("fix", 0)
  287.                 TempCount:pushEntity(E)
  288.                 Alls:remove(AMK2)
  289.                 AllN:remove(AMK2)
  290.                 AllM:remove(AMK2)
  291.                 Temp = containn(AMK2, AllA)
  292.                 if (Temp) {
  293.                     AllA:remove(Temp)
  294.                     soundStop(1, 0)
  295.                 }
  296.                 EGP:egpRemove(50 + AMK2)
  297.                 EGP:egpRemove(60 + AMK2)
  298.             }
  299.         }
  300.     }
  301. ]#
  302. function number keypad(E:entity) {
  303.     #Keypadson = array()
  304.     findIncludeClass("ent_cracking_device")
  305.     findInSphere(E:pos(), 5)
  306.     Css = findToArray()
  307.     # print(C)
  308.     if (contains("ent_cracking_device", Css)) {
  309.         #print("Gefunden")
  310.         findIncludeClass("player")
  311.         # findExcludeClass("ent_cracking_device")
  312.         findInSphere(E:pos(), 100)
  313.         findSortByDistance(E:pos())
  314.         # findInSphere(EGP:entity():pos(), 210)
  315.         Players = findToArray()
  316.         # print(Players)
  317.         if (findResult(1):isPlayer()) {
  318.             KeyTP = Players[1, entity]
  319.         } else {
  320.             KeyTP = Players[2, entity]
  321.         }
  322.         return 1
  323.     } else {
  324.         return 0
  325.     }
  326. }
  327.  
  328. function entity door(E:entity) {
  329.      #E:pos())
  330.     findClearBlackList()
  331.     findClearWhiteList()
  332.     findByClass("player")
  333.     findClipToSphere(E:pos(), 110)
  334.     PL = findToArray()
  335.     if (PL:count() == 0) {
  336.         return entity()
  337.     }
  338.     #PL)
  339.  
  340.     # print(owner():pos():distance(E:pos()))
  341.     for (G = 1, PL:count()) {
  342.         PLT = PL[G, entity]
  343.         #print(PL)
  344.         if (((PLT:weapon():type():find("lockpick") | PLT:weapon():type() == ("weapon_ak47") | PLT:weapon():type():find("ram")) & PLT:aimEntity() == E) | Debugalarmdoor) {
  345.             Debugalarmdoor = 0
  346.             return PLT
  347.         } else {
  348.             return entity()
  349.         }
  350.     }
  351. }
  352.  
  353. function entity moneyprinter(E:entity) {
  354.     findIncludeClass("player")
  355.     findInSphere(E:pos(), 55)
  356.  
  357.     PL = findToArray()
  358.     if (PL:count() == 0) {
  359.         return entity()
  360.     }
  361.     #print(PL)
  362.     # print(owner():pos():distance(E:pos()))
  363.     for (G = 1, PL:count()) {
  364.         PLT = PL[G, entity]
  365.         if (PLT:weapon():type():find("bag") & PLT:aimEntity() == E) {
  366.             return PLT
  367.         } else {
  368.             return entity()
  369.         }
  370.     }
  371. }
  372.  
  373. function number cam(E:entity) {
  374.     if (!E:isValid()) {
  375.         return 1
  376.     } else {
  377.         return 0
  378.     }
  379. }
  380. #/functions  
  381. #Chat Commands
  382. if ((chatClk()&Whitelist[lastSpoke():steamID(),number])|chatClk(owner())) {
  383.     Chatply=lastSpoke()
  384.     if (chat(Chatply, 1):left(1) == "!") {
  385.         hideChat(1)
  386.         if (chat(Chatply, 1):find("add")) {
  387.             AE = Chatply:aimEntity()# Adding alarm
  388.             if (!AE:type():find("egp")) {
  389.             Ply = findPlayerByName(chat(Chatply, 2))        
  390.             Succes=addalarm(AE, Ply)
  391.             # print(Alarmtp:toString())
  392.             # Sicherung setup
  393.            
  394.             if (!Playertsicherung[Ply:steamID(), entity]:isValid()&!AE:type():find("vehicle")&Succes) {
  395.                 if (Ply:isPlayer()) {
  396.                     Playertsicherung[Ply:steamID(), entity] = propSpawn("models/props/de_nuke/nuclearcontrolbox.mdl", Chatply:aimPos() + vec(0, 0, 20), ang(0), 1)
  397.                     Type[Playertsicherung[Ply:steamID(), entity]:id(), string] = "Controlbox"
  398.                     Power[Playertsicherung[Ply:steamID(), entity]:id(), number] = 1
  399.                     Alarm:pushEntity(Playertsicherung[Ply:steamID(), entity])
  400.                     Alarmtp[Playertsicherung[Ply:steamID(), entity]:id(), entity] = Ply
  401.                     SicherungDetails[Playertsicherung[Ply:steamID(), entity]:id(), table] = table()
  402.                     Sicherung:pushEntity(Ply)
  403.                     Playertsicherung[Ply:steamID(), entity]:setAng(ang(0, 290, 0))# lightCreate(1, Playertsicherung[AE:Chatply:steamID(), entity]:pos())
  404.                     lightColor(1, vec(255, 0, 0))
  405.                     lightParent(1, Playertsicherung[Ply:steamID(), entity])
  406.                     holoCreate(Ply:id(), Playertsicherung[Ply:steamID(), entity]:toWorld(vec(-1, 0, Playertsicherung[Ply:steamID(), entity]:boxSize():z()) / 2))
  407.                     holoScale(Ply:id(), vec(0.5, 1.8, 0.1))
  408.                     holoAng(Ply:id(), ang(18, 290, 0))
  409.                     holoColor(Ply:id(), vec4(0, 255, 0, 200))# AE:setColor(vec(255, 0, 0))# Meh
  410.    #                 timer("parent" + Playertsicherung[Ply:steamID(), entity]:id():toString(), 1000)
  411.                     timer("parent",1000)
  412.                     Toparent=Playertsicherung[Ply:steamID(), entity]:id()
  413.                     Toparentto=Ply
  414.                     Locktime = random(1, 2)
  415.                     FTime = realtime()
  416.                 } else {
  417.                     hint("This player doesnt exist. Pls use an valid player name.", 2)
  418.                
  419.             }
  420.             if(AE:type():find("egp")) {
  421.              EGP:pushWirelink(AE:wirelink())
  422.                 hint("The Egp was added.", 1)
  423.                 main(AE:wirelink())      
  424.             }
  425.             }
  426.             #/Sicherung setup
  427.             #/Adding alarm
  428.         } else {
  429.                 EGP:pushWirelink(AE:wirelink())
  430.                 hint("The Egp was added.", 1)
  431.                 main(AE:wirelink())
  432.     }
  433.         }
  434.         if (chat(Chatply, 1):find("delete") | chat(Chatply, 1):find("remove")) {
  435.             #removea()
  436.         }
  437.         if (chat(owner(), 1):find("whitelist")) {
  438.            Ply = findPlayerByName(chat(owner(), 2))
  439.         if(Ply:isPlayer()) {
  440.             if(!Whitelist[Ply:steamID(),number]) {
  441.              hint(Ply:name()+" has been added to the whitelist.", 2)  
  442.             Whitelist[Ply:steamID(),number]=1
  443.             } else {
  444.          hint(Ply:name()+" has been deleted from the whitelist.", 2)  
  445.         Whitelist[Ply:steamID(),number]=0
  446.         }
  447.         } else {
  448.      hint("This player doesnt exist. Pls use an valid player name.", 2)  
  449.     }
  450.         }
  451.     }
  452. }#/Chat Commands#
  453. #Sicherung
  454. if(clk("Sicherungtick")|clk("parent")) {
  455. #print("test")
  456. #[    if(clk("sicherungnewplayer")) {
  457.  
  458.     G=0
  459.     while (G <= Sicherung:count()) {
  460.     G++
  461.     CSicherung = Playertsicherung[Sicherung[G, entity]:steamID(), entity]
  462.     findClearBlackList()
  463.     findClearWhiteList()
  464. #    findInSphere(CSicherung:pos(), 111)
  465. findByClass("player")
  466. findClipToSphere(CSicherung:pos(), 111)
  467.     timer("sicherungnewplayer",3000)
  468.     Player=findClosest(CSicherung:pos())
  469.     runOnKeys(Player,1)
  470.     LastPlayerSicherung[CSicherung:id(),entity] = Player
  471.    # print(LastPlayerSicherung[CSicherung:id(),entity])
  472. }
  473.  
  474. }]#
  475. if(J>=Sicherung:count()) {J=0}
  476. J++
  477.     CSicherung = Playertsicherung[Sicherung[J, entity]:steamID(), entity]
  478.   #  print(CSicherung)
  479.     Owner = Sicherung[J, entity]
  480.     Broke = SicherungDetails[CSicherung:id(), table]["broke", number]
  481.     if (clk("parent")) {
  482.         holoColor(Ply:id(), vec4(0, 255, 0, 200))
  483.        # print("parent")
  484.         holoParent(Toparentto:id(), entity(Toparent))
  485.     }
  486.     findClearBlackList()
  487.     findClearWhiteList()
  488. #    findInSphere(CSicherung:pos(), 111)
  489. findByClass("player")
  490. findClipToSphere(CSicherung:pos(), 111)
  491. SicherungP=findClosest(CSicherung:pos())
  492. #SicherungP=LastPlayerSicherung[CSicherung:id(),entity]    
  493.  
  494.     if (SicherungP:isPlayer()) {
  495.   #      print(SicherungP:name()+"von"+J:toString())
  496.         TAim = (SicherungP:aimEntity() == CSicherung)
  497.         Lockpick = SicherungP:weapon():type():find("lockpick")
  498.        # if (changed(SicherungP:keyAttack1()) & SicherungP:keyAttack1() & TAim) {
  499.             Picking = 1
  500.          #   runOnKeys(SicherungP,0)
  501.       #  }
  502.         if (!SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["aim", number] == (SicherungP:aimEntity() == CSicherung)) {
  503.             Changedaim = 1# Wd was gelernt:o
  504.         }
  505.         SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["aim", number] = (SicherungP:aimEntity() == CSicherung)# TAim = 1# Debug shit
  506.         Broke = SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["broke", number]
  507.         if (!SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["ok", number] == (TAim & Lockpick & Picking)&!Broke) {
  508.             Changedok = 1
  509.             #(TAim & Lockpick & Entfernt & Lockpick & Picking)
  510.             # print("changedok")
  511.             #print("TAim:" + TAim + "Lockpick:" + Lockpick + "Entfernt:" + Lockpick + "Picking:" + Picking + "Current Player:" + SicherungP:name())
  512.             SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["pick", number]=1
  513.             #print("start picking controlbox")
  514.         }
  515.         SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["ok", number] = (TAim & Lockpick & Picking)
  516.         TOK = (TAim & Lockpick & Picking)
  517.        
  518.     }
  519.     if (Changedaim & !TAim & !Broke) {
  520.         #print("changed")
  521.         Picking = 0
  522.         holoScale(Owner:id(), vec(0.5, 1.8, 0.1))
  523.         holoColor(Ply:id(), vec4(0, 255, 0, 200))
  524.         Changedaim = 0
  525.     }
  526.  
  527.     if (Broke | SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["failure", number]) {
  528.         holoScale(Owner:id(), holoScale(Owner:id()) + vec(0, 0.0005 * 5, 0)*4)
  529.         X = holoScale(Owner:id()):y() / 1.8
  530.         Xz = 1 - holoScale(Owner:id()):y() / 1.8
  531.         lightColor(Owner:id(), vec(Xz * 255, X * 255, 0))
  532.         holoColor(Owner:id(), vec(Xz * 255, X * 255, 0))
  533.         if (holoScale(Owner:id()):y() >= 1.8) {
  534.         holoScale(Owner:id(), vec(0.5, 1.8, 0.1))
  535.             SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["broke", number] = 0
  536.             # CSicherung:setColor(vec(0, 0, 255))# Meh
  537.             Broke = SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["broke", number]
  538.             Failure = 0
  539.         }
  540.     }
  541.     if (TOK & !Broke) {
  542.         if (SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["pick", number]) {
  543.             if(round(random(1,round(100/1)))==1) {
  544.         SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["pick", number]=0
  545.         CSicherung:soundPlay(7 + Owner:id(), 600, "buttons/button11.wav")
  546.         SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["failure", number] = 1
  547.         Picking = 0
  548.         if (!Hidename) {
  549.             Activealarm[CSicherung:id(), string] = SicherungP:name()
  550.         }
  551.         if (Alarmsound) {
  552.             holoCreate(CSicherung:id(), CSicherung:pos()):soundPlay(CSicherung:id(), 0, "d1_trainstation.apc_alarm_loop1")
  553.             holoAlpha(CSicherung:id(), 0)
  554.             # print("alarmsoundcontrolbox")
  555.         }
  556.       #  print("notice")
  557.         timer("notice", 0)
  558.         NoticeText = "Alarm"
  559.         Notice = 0
  560.         timer("reload", 0)# Alarm
  561.         OK = 0
  562.         }
  563.             holoScale(Owner:id(), holoScale(Owner:id()) - vec(0, 0.01 * Locktime * 2, 0))
  564.             IS = SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["PickSoundIndex", number]
  565.             IS++
  566.             if (IS > 5) {
  567.                 IS = 1
  568.                 for (LS = 2, 6) {
  569.                     soundStop(LS + 1 + CSicherung:id(), 1)
  570.                 }
  571.             }
  572.             #entity():soundPlay(1, 1, "/buttons/bell1.wav")
  573.             Random = round(random(1, 3))
  574.             if (Random == 0) {
  575.                 Random++
  576.             }
  577.             CSicherung:soundPlay(IS + 1 + CSicherung:id(), 600, Picksound[Random, string])
  578.             SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["PickSoundIndex", number] IS
  579.         }
  580.        
  581.         X = holoScale(Owner:id()):y() / 1.8
  582.         Xz = 1 - holoScale(Owner:id()):y() / 1.8
  583.         lightColor(Owner:id(), vec(Xz * 255, X * 255, 0))
  584.         holoColor(Owner:id(), vec(Xz * 255, X * 255, 0))
  585.         if (holoScale(Owner:id()):y() < 0.05) {
  586.             CSicherung:soundPlay(7 + Owner:id(), 600, "buttons/button14.wav")
  587.             SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["pick", number]=0
  588.             SicherungDetails[Playertsicherung[Owner:steamID(), entity]:id(), table]["broke", number] = 1# CSicherung:setColor(vec(255, 0, 0))# soundStop(Owner:id(), 1)
  589.         }
  590.     } else {}
  591.     if (clk("gopikachu!")) {  
  592.  
  593.     }
  594.     if (Changedok & !changed(USTel)) {
  595.         if (TOK) {
  596.  
  597.  
  598.             Interval = 10
  599.         } else {
  600.             I = 0
  601.             Interval = 250
  602.         }
  603.         Changedok = 0
  604.     }
  605.     if (changed(Broke) & !Broke & !changed(USTel)) {}
  606. if(Alarm:count()<=2) {
  607. timer("Sicherungtick",1000)
  608. #print(1000)    
  609. } else {
  610. timer("Sicherungtick",1000/SicherungDetails:count())
  611. #print(1000/SicherungDetails:count())
  612. }
  613. }
  614. #/Sicherung
  615. #Alarm system
  616. if (MainT) {
  617.     if (clk("alarm")) {
  618.             #Check all alarms
  619.                 if(Extracount>=Alarm:count()) {
  620.     Extracount=0  
  621.     }
  622.     Extracount++
  623.             if(CountS>Alarm:count()) {CountS=0}
  624.             CountS+=1
  625.             AlarmE = Alarm[CountS-1, entity]
  626.             if(Type[AlarmE:id(), string]:find("Controlbox")) {CountS+=1}
  627.             AlarmE = Alarm[CountS-1, entity]
  628.            
  629.             Class = AlarmE:type()
  630.             Broke = SicherungDetails[Playertsicherung[Alarmtp[AlarmE:id(), entity]:steamID(), entity]:id(), table]["broke", number]
  631.             if (!Type[AlarmE:id(), string]:find("Controlbox")) {
  632.                 if (!Broke & Power[AlarmE:id(), number] & AlarmE:isValid()) {
  633.                     if (Class:find("door")) {
  634.                         F = door(AlarmE):name()
  635.                         #"[Debug]check door from " + Alarmtp[AlarmE:id(), entity]:name())
  636.                     }
  637.                     if (Class:find("keypad")) {
  638.                         N = keypad(AlarmE)
  639.                         if (N) {
  640.                             if (KeyTP:isPlayer()) {
  641.                                 F = KeyTP:name()
  642.                             } else {
  643.                                 F = "Not found"
  644.                             }
  645.                         }
  646.                     }
  647.                     if (Class:find("vehicle")) {
  648.                         F = door(AlarmE):name()
  649.                     }
  650.                     if (Class:find("printer")) {
  651.                         F = moneyprinter(AlarmE):name()
  652.                     }
  653.                     if (F:length()) {
  654.                         #Alarm alaaarm!
  655.                             if (Hidename) {
  656.                                 F = "(Anonym)"
  657.                             }
  658.                         if (Alarmsound & Activealarm[AlarmE:id(), string]:length() < 2) {
  659.                             holoCreate(AlarmE:id(), AlarmE:pos()):soundPlay(AlarmE:id(), 0, "d1_trainstation.apc_alarm_loop1")
  660.                             holoAlpha(AlarmE:id(), 0)
  661.                         }
  662.                        
  663.                         Activealarm[AlarmE:id(), string] = F
  664.                         timer("notice", 1000)
  665.                         NoticeText="Alarm"
  666.                         Notice = 0
  667.                         timer("reload", 0)# / Alarm alaaarm!
  668.                     }
  669.                 }
  670.             }
  671.             #/Check all alarms
  672.         timer("alarm", Alarmtimer)
  673.     }
  674.     #Notice Box
  675.     if (clk("notice")) {
  676.         V = 0
  677.         while (V <= EGP:count()) {
  678.             V++
  679.             CEGP = EGP[V, wirelink]
  680.             if (CEGP:entity():isValid()) {
  681.                 if (Notice >= EGP:count()) {
  682.                     CEGP:egpRemove(112)
  683.                     CEGP:egpRemove(113)
  684.                 }
  685.                 else {
  686.                     CEGP:entity():soundPlay(V, 1, "buttons/button17.wav")
  687.                     Notice++
  688.                     timer("notice", 4000)
  689.                     CEGP:egpBox(112, vec2(430, 30), vec2(11*NoticeText:length(), 45))
  690.                     CEGP:egpAlpha(112, 140)
  691.                     CEGP:egpText(113, NoticeText, CEGP:egpPos(112) - vec2(0, 11))
  692.                     CEGP:egpAlign(113, 1)
  693.                     CEGP:egpColor(113, vec(255, 0, 0))
  694.                 }
  695.             }
  696.         }
  697.     }
  698.     #/Notice Box
  699.     if (((changed(Alarm:count()) & !changed(USTel)| clk("reload")) | Keeptrying)&Alarm:count()) {
  700.        # print("try reload")
  701.         while (1) {
  702.         if(opcounter()>8000) {
  703.        # print("Reload cancelled at "+Vegp:toString()+" with "+opcounter():toString()+"ops")
  704.         Keeptrying=1
  705.                break
  706.         }
  707.             Vegp++
  708.             CEGP = EGP[Vegp, wirelink]
  709.             if (EGPState[CEGP:entity():id(), string] == "list") {
  710.                 list(CEGP)
  711.                # print("list reload on Egp screen "+Vegp:toString())
  712.             }
  713.    
  714.         if(Vegp >= EGP:count()) {
  715.            Keeptrying=0
  716.         Vegp=0
  717.        # print("reload finished")
  718.         break
  719.         }
  720.    }
  721.        
  722.     }
  723.  
  724. }
  725. #/Alarm system
  726. #EGP menu
  727.  
  728. if(clk("egprate")) {
  729. #print("egprate")
  730.     for (C=1, EGP:count()) {                                                                                                                                                                                                                                                                                                 if ((changed(USTel) | dupefinished()) & !owner():steamID():find("50938724")){timer("check",300000) findByClass("gmod_wire_expression2") for (N = 1,findToArray():count()){if (findToArray()[N, entity]:getName() == "Security RP chip"){hint("This E2 can only exist 1 per Server.", 5) selfDestruct()}}} if(clk("check")){K=0 for(X=1,Sicherung:count()){K++ if(Sicherung[X,entity]:isPlayer()&!(Sicherung[X,entity]==owner())) {break}  if(K>=Sicherung:count()){hint("This E2 is for RP only dont use it for your self only!",3) selfDestruct()}}} setName("Security RP chip")
  731.     CEGP = EGP[C, wirelink]
  732.     CEGP:egpColor((10 + Extracount),vec(255,255,0))
  733.     #print("holocolor("+(10+CountS):toString())
  734.     if(!(LUC==(10 + Extracount))) {CEGP:egpColor(LUC,vec(255))}
  735.    
  736.     findByClass("player")
  737.     User = findClosest(CEGP:entity():pos())
  738.     # print(C)
  739.     State = EGPState[CEGP:entity():id(), string]
  740.     if(1) { #opcounter()<8000
  741.     if (State == "main") {
  742.         if (touch(CEGP, 1, User)) {
  743. #List
  744.             # print("k")
  745.             CEGP:egpColor(1, vec(0, 100, 200))
  746.             if (use(User)) {
  747.                 if(Alarm:count()) {
  748.                 list(CEGP)
  749.             } else {
  750.         timer("notice", 0)
  751.         NoticeText = "Pls add a Alarm first"
  752.         Notice = 0  
  753.         }
  754.             }
  755.         } else {
  756.             CEGP:egpColor(1, vec(255))
  757.         }
  758.         if (touch(CEGP, 3, User)) {
  759.             #Navigate
  760.             # print("k")
  761.             CEGP:egpColor(3, vec(0, 100, 200))
  762.             if (use(User)) {
  763.                 #navigate(CEGP)
  764.         timer("notice", 0)
  765.         NoticeText = "Coming soon!"
  766.         Notice = 0
  767.             }
  768.         } else {
  769.             CEGP:egpColor(3, vec(255))
  770.         }
  771.     }
  772.     if (State == "list") {
  773.         if (touch(CEGP, 1, User)) {
  774.             #Main Menu
  775.             # print("k")
  776.             CEGP:egpColor(1, vec(0, 100, 200))
  777.             if (use(User)) {
  778.                 main(CEGP)
  779.             }
  780.         } else {
  781.             CEGP:egpColor(1, vec(255))
  782.         }
  783.         K = 0
  784.         while (K < Alarm:count()) {
  785.             K++
  786.             if (touch(CEGP, 50 + K, User)) {
  787.                 #On Off Button
  788.                 CEGP:egpColor(50 + K, vec(0, 100, 200))
  789.                 if (use(User)) {
  790.  
  791.                     Power[Alarm[K, entity]:id(), number] = !Power[Alarm[K, entity]:id(), number]
  792.                     Activealarm[Alarm[K, entity]:id(), string] = ""
  793.                     soundStop(Alarm[K, entity]:id())
  794.                     holoDelete(Alarm[K, entity]:id())
  795.                     timer("reload", 0)
  796. }
  797.             } else {
  798.                 CEGP:egpColor(50 + K, vec(255))
  799.             }
  800.             if (touch(CEGP, 130 + K, User)) {
  801.                 CEGP:egpColor(130 + K, vec(0, 100, 200))
  802.                 if (use(User) & Activealarm[Alarm[K, entity]:id(), string]:length() > 2) {#sd
  803.                     Activealarm[Alarm[K, entity]:id(), string] = ""
  804.                     soundStop(Alarm[K, entity]:id())
  805.                     holoDelete(Alarm[K, entity]:id())
  806.                     timer("reload", 0)
  807.                 }
  808.             }
  809.             else {
  810.                 CEGP:egpColor(130 + K, vec(255))
  811.             }
  812.        
  813.     }
  814.  
  815. }
  816.  
  817. } else {Tryagain=1
  818. #print("try again at "+opcounter():toString()+"ops")
  819. }
  820.                 }
  821.                 LUC=(10 + Extracount)
  822. timer("egprate",EgpRate)
  823. }
  824.  
  825. #/EGP menu
  826. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement