Jump to content

RESOLVIDO | Help


Recommended Posts

Tentei colocar esse comando só para determinado ACL Group e não conseguir encaixar o comando nesse script alguém poderia mim ajudar ?

LADO CLIENT

sw, sh = guiGetScreenSize() 
stream = {}
cctvC = {}
cctvT = {}
localC = {}
active = {}
active.modes = {}
active.currentmode = 1
active.switch = false
localT = {}
playerMatrix = {}
viewList = {}
viewID = 0
localObject = false
localMarker = false
markerType = "cylinder"
wallcam = 2921
ceilcam = 1886
terminalModel = 2190
inMarker = false
offsets = {}
offsets.wallAngle = -53
offsets.wallZ = 0.225
offsets.wallLens = 1.03  
offsets.ceilAngle = -180
offsets.ceilZ = -0.525
offsets.ceilLens = 0.33
offsets.interference = 1
black = tocolor(0, 0, 0, 255)
white = tocolor(255, 255, 255, 255)
gray = tocolor(128, 128, 128, 255)
viewCamera = false
scan = "gfx/scanlines.png"
flicker = 1
camDist = 50
placing = false
 
buttons = {
  ["num_1"] = {0,2, 64,128},
  ["num_2"] = {1,2, 64,64},
  ["num_3"] = {2,2, 64,192},
  ["num_4"] = {0,1, 0,0},
  ["num_5"] = {1,1, 128,0},
  ["num_6"] = {2,1, 64,0},
  ["num_7"] = {0,0, 0,128},
  ["num_8"] = {1,0, 0,64},
  ["num_9"] = {2,0, 0,192},
-- ["num_add"] = {3,0, 192,0}
}
 
buttonColors = {}
buttonColors.active = tocolor(255,255,255,192)
buttonColors.inactive = tocolor(128,128,128,128)
buttonColors.pressed = tocolor(255,255,255,255)
 
addEventHandler("onClientResourceStart", resourceRoot,
    function ()
    sw, sh = guiGetScreenSize()
    addEventHandler("onClientRender", root, cctvView)
   
    -- error window
        cctvErrorWindow = guiCreateWindow(sw/2 - 200, sh/2 - 50, 400, 100, "Error!", false)
    cctvErrorText = guiCreateLabel(.1, .35, .94, .3, "Error:",true, cctvErrorWindow)
    cctvErrorClose = guiCreateButton(.3, .7, .4, .3, "OK", true, cctvErrorWindow)    
    guiLabelSetColor(cctvErrorText, 255, 5, 5)
    guiSetFont(cctvErrorText, "default-bold-small")
    guiWindowSetSizable(cctvErrorWindow, false) 
    guiSetVisible(cctvErrorWindow, false)
   
    -- camera view controls
    cctvControl = guiCreateWindow(sw-180, sh-200, 152, 187, "CCTV", false)
    cctvControlInfo = guiCreateLabel(.1,.87,.9,.2, "PRESS NUM+ TO EXIT", true, cctvControl)
    guiLabelSetColor(cctvControlInfo, 125, 125, 125)
    guiSetFont(cctvControlInfo, "default-bold-small")
    guiWindowSetSizable(cctvControl, false) 
    guiSetVisible(cctvControl, false)
   
    -- main setup window  
    cctvWindow = guiCreateWindow(sw/2-300, sh/2-200, 600, 400, "CCTV Setup", false)
    setElementData(cctvWindow, "tooltip-color", "#222222", false)
    setElementData(cctvWindow, "tooltip-background", "#bbbbbb", false)
    guiWindowSetSizable(cctvWindow, false) 
    cctvTabs = guiCreateTabPanel(0, .07, 1, .8, true, cctvWindow)
    cctvSetup = guiCreateTab("Management", cctvTabs)  
    cctvAddCam = guiCreateTab("Add/Edit camera", cctvTabs)  
    cctvAddTerminal = guiCreateTab("Add/Edit terminal", cctvTabs)  
    cctvRR = guiCreateTab("Reset/Reload", cctvTabs)  
    cctvClose = guiCreateButton(.82, .9, .2, .1, "Close", true, cctvWindow)    
    cctvBB = guiCreateLabel(.03,.91,.6,.08, "Big Brother is watching you.", true, cctvWindow)
    guiLabelSetColor(cctvBB, 55, 55, 55)
    cctvClr = guiCreateButton(.67, .9, .14, .1, "Clear", true, cctvWindow)    
    setElementData(cctvClr, "tooltip-text", "Clear all settings in camera/terminal editing tabs", false)
   
    -- Management tab
    guiSetFont(guiCreateLabel(.03,.03,.44,.07, "Terminals list:", true, cctvSetup),"default-bold-small")
    guiSetFont(guiCreateLabel(.53,.03,.44,.07, "Cameras list:", true, cctvSetup),"default-bold-small")
    cctvTList = guiCreateGridList(.03, .1, .44, .75, true, cctvSetup)
    setElementData(cctvTList, "tooltip-text", "Double click a terminal to display connected cameras", false)
    cctvTListName = guiGridListAddColumn(cctvTList, "Terminal ID", .6)
    cctvTListCams = guiGridListAddColumn(cctvTList, "Cams", .31)
    cctvCList = guiCreateGridList(.53, .1, .44, .75, true, cctvSetup)
    setElementData(cctvCList, "tooltip-text", "Double click a camera to view", false)
    cctvCListName = guiGridListAddColumn(cctvCList, "Camera ID", .5)
    cctvCListTerminal = guiGridListAddColumn(cctvCList, "Connected to", .41)
    guiSetFont(cctvTList,"default-small")
    guiSetFont(cctvCList,"default-small")
    cctvFreeCams = guiCreateButton(.47, .1, .055, .22, "---", true, cctvSetup)    
    setElementData(cctvFreeCams, "tooltip-text", "Show all disconnected cameras", false)
    cctvCamList = guiCreateButton(.47, .33, .055, .22, "All", true, cctvSetup)    
    setElementData(cctvCamList, "tooltip-text", "Show all cameras", false)
    cctvConnect = guiCreateButton(.47, .56, .055, .22, "<<", true, cctvSetup)    
    setElementData(cctvConnect, "tooltip-text", "Connect selected camera to selected terminal", false)
    --guiSetFont(cctvPort,"default-small")
    cctvTDelete = guiCreateButton(.03, .87, .11, .1, "Delete", true, cctvSetup)    
    cctvTView = guiCreateButton(.15, .87, .1, .1, "View", true, cctvSetup)    
    cctvTEdit = guiCreateButton(.26, .87, .1, .1, "Edit", true, cctvSetup)    
    cctvPort = guiCreateButton(.37, .87, .1, .1, "Port", true, cctvSetup)    
    setElementData(cctvPort, "tooltip-text", "Teleport to selected terminal location", false)
    cctvCDelete = guiCreateButton(.53, .87, .14, .1, "Delete", true, cctvSetup)    
    cctvCDisc = guiCreateButton(.68, .87, .14, .1, "Disconnect", true, cctvSetup)    
    cctvCEdit = guiCreateButton(.83, .87, .14, .1, "Edit", true, cctvSetup)    
   
    -- Add camera tab
    guiSetFont(guiCreateLabel(.03,.04,.22,.06, "Camera ID:", true, cctvAddCam),"default-small")
    cctvAddCamName = guiCreateEdit(.03, .1, .22, .1, "", true, cctvAddCam)
    guiEditSetMaxLength(cctvAddCamName, 10)
    guiSetFont(guiCreateLabel(.25,.04,.22,.06, "Terminal ID (optional):", true, cctvAddCam),"default-small")
    cctvAddCamTerminal = guiCreateEdit(.25, .1, .22, .1, "", true, cctvAddCam)
    setElementData(cctvAddCamTerminal, "tooltip-text", "Camera will be connected to this terminal (leave it blank to leave camera disconnected)", false)
    guiEditSetMaxLength(cctvAddCamTerminal, 10)
    guiSetFont(guiCreateLabel(.03,.22,.4,.06, "Camera options:", true, cctvAddCam),"default-bold-small")
    cctvAddCamMotor = guiCreateCheckBox(.03,.27,.22,.1, "Motorized", false, true, cctvAddCam)
    setElementData(cctvAddCamMotor, "tooltip-text", "Allows panning and tilting camera in view mode", false)
    cctvAddCamZoom = guiCreateCheckBox(.25,.27,.22,.1, "Zoom enabled", false, true, cctvAddCam)
    cctvAddCamIR = guiCreateCheckBox(.03,.34,.22,.1, "Thermal (IR)*", false, true, cctvAddCam)
    --cctvAddCamIRP = guiCreateCheckBox(.03,.41,.22,.1, "Thermal Plus*", false, true, cctvAddCam)
    cctvAddCamNight = guiCreateCheckBox(.25,.34,.22,.1, "Nightvision*", false, true, cctvAddCam)
    cctvNote11 = guiCreateLabel(.03,.44,.44,.05, " * thermal/nightvision modes work only MTA 1.1+ ", true, cctvAddCam)
    guiSetFont(cctvNote11,"default-small")
    guiLabelSetColor(cctvNote11, 128, 128, 128)
 
    guiSetFont(guiCreateLabel(.03,.5,.4,.06, "Camera placement:", true, cctvAddCam),"default-bold-small")
    cctvWall = guiCreateRadioButton(.03, .55, .22, .1, "Wall mount",true,cctvAddCam)
    cctvCeiling = guiCreateRadioButton(.25, .55, .22, .1, "Ceiling mount",true,cctvAddCam)
    guiRadioButtonSetSelected(cctvWall, true)
    cctvAddCamX = guiCreateEdit(.03, .65, .11, .1, "", true, cctvAddCam)
    cctvAddCamY = guiCreateEdit(.14, .65, .11, .1, "", true, cctvAddCam)
    cctvAddCamZ = guiCreateEdit(.25, .65, .11, .1, "", true, cctvAddCam)
    cctvAddCamPlace = guiCreateButton(.36, .65, .11, .1, "Place", true, cctvAddCam)
    guiSetFont(guiCreateLabel(.03,.76,.44,.06, "* X/Y/Z of the camera, click 'Place' to place camera", true, cctvAddCam),"default-small")
    cctvAddCamLive = guiCreateCheckBox(.03,.85,.22,.1, "Setup live view", false, true, cctvAddCam)
    cctvAddCamSave = guiCreateButton(.25,.85,.22,.1, "SAVE CAMERA", true, cctvAddCam)
    guiSetFont(cctvAddCamSave, "default-bold-small")
    guiSetFont(guiCreateLabel(.95,.04,.1,.06, "U/D", true, cctvAddCam),"default-small")
    cctvAddCamUp = guiCreateScrollBar(.95, .1, .033, .86, false, true, cctvAddCam)
    guiSetFont(guiCreateLabel(.5,.04,.4,.06, "Scanlines RGB colorization:", true, cctvAddCam),"default-small")
    cctvAddCamR = guiCreateScrollBar(.5, .1, .44, .07, true, true, cctvAddCam)
    cctvAddCamG = guiCreateScrollBar(.5, .17, .44, .07, true, true, cctvAddCam)
    cctvAddCamB = guiCreateScrollBar(.5, .24, .44, .07, true, true, cctvAddCam)
    guiSetFont(guiCreateLabel(.5,.31,.4,.06, "Scanlines intensity:", true, cctvAddCam),"default-small")
    cctvAddCamS = guiCreateScrollBar(.5, .37, .44, .07, true, true, cctvAddCam)
    guiSetFont(guiCreateLabel(.5,.44,.4,.06, "Scanline size:", true, cctvAddCam),"default-small")
    cctvAddCamSS = guiCreateScrollBar(.5, .5, .44, .07, true, true, cctvAddCam)
    guiSetFont(guiCreateLabel(.5,.57,.4,.06, "Flicker level:", true, cctvAddCam),"default-small")
    cctvAddCamF = guiCreateScrollBar(.5, .63, .44, .07, true, true, cctvAddCam)
    guiSetFont(guiCreateLabel(.5,.7,.4,.06, "Field of View:", true, cctvAddCam),"default-small")
    cctvAddCamFov = guiCreateScrollBar(.5, .76, .44, .07, true, true, cctvAddCam)
    guiScrollBarSetScrollPosition(cctvAddCamFov, 90)
    guiSetFont(guiCreateLabel(.5,.83,.4,.06, "Horizontal angle:", true, cctvAddCam),"default-small")
    cctvAddCamPan = guiCreateScrollBar(.5, .89, .44, .07, true, true, cctvAddCam)
 
    -- Add terminal tab
    guiSetFont(guiCreateLabel(.03,.04,.22,.06, "Terminal ID:", true, cctvAddTerminal),"default-small")
    cctvAddTerName = guiCreateEdit(.03, .1, .22, .1, "", true, cctvAddTerminal)
    guiEditSetMaxLength(cctvAddTerName, 10)
    guiSetFont(guiCreateLabel(.25,.04,.22,.06, "Password/Team/ACL:", true, cctvAddTerminal),"default-small")
    cctvAddTerAccess = guiCreateEdit(.25, .1, .22, .1, "", true, cctvAddTerminal)
    setElementData(cctvAddTerAccess, "tooltip-text", "Type password/team name or ACL group name here, depending on acces option selected", false)
    guiEditSetMaxLength(cctvAddTerAccess, 32)
    guiSetFont(guiCreateLabel(.03,.22,.4,.06, "Terminal access restriction:", true, cctvAddTerminal),"default-bold-small")
    cctvAddTerPublic = guiCreateRadioButton(.03,.28,.22,.1, "Public", true, cctvAddTerminal)
    setElementData(cctvAddTerPublic, "tooltip-text", "Everyone will be able to use this terminal", false)
    cctvAddTerPass = guiCreateRadioButton(.25,.28,.22,.1, "by Password*", true, cctvAddTerminal)
    setElementData(cctvAddTerPass, "tooltip-text", "Everyone who knows the password will be able to use this terminal", false)
    cctvAddTerTeam = guiCreateRadioButton(.03,.36,.22,.1, "by Team*", true, cctvAddTerminal)
    setElementData(cctvAddTerTeam, "tooltip-text", "Only specific team will be able to use this terminal", false)
    cctvAddTerAcl = guiCreateRadioButton(.25,.36,.22,.1, "by ACL Group*", true, cctvAddTerminal)
    setElementData(cctvAddTerAcl, "tooltip-text", "Only specific ACL group will be able to use this terminal", false)
    guiRadioButtonSetSelected(cctvAddTerPublic, true)
    guiSetFont(guiCreateLabel(.03,.46,.44,.2, "* Don't forget to specify Password/Team/ACL in the field\n above according to the selected option!", true, cctvAddTerminal),"default-small")
    guiSetFont(guiCreateLabel(.03,.83,.4,.06, "Rotation:", true, cctvAddTerminal),"default-small")
    cctvAddTerRot = guiCreateScrollBar(.03, .89, .44, .07, true, true, cctvAddTerminal)
    guiSetFont(guiCreateLabel(.03,.57,.4,.06, "Terminal placement:", true, cctvAddTerminal),"default-bold-small")
    cctvAddTerX = guiCreateEdit(.03, .65, .11, .1, "", true, cctvAddTerminal)
    cctvAddTerY = guiCreateEdit(.14, .65, .11, .1, "", true, cctvAddTerminal)
    cctvAddTerZ = guiCreateEdit(.25, .65, .11, .1, "", true, cctvAddTerminal)
    cctvAddTerPlace = guiCreateButton(.36, .65, .11, .1, "Place", true, cctvAddTerminal)
    guiSetFont(guiCreateLabel(.03,.76,.44,.06, "* X/Y/Z of the terminal, click 'Place' to place it", true, cctvAddTerminal),"default-small")
    guiSetFont(guiCreateLabel(.5,.04,.4,.06, "Terminal marker RGB color:", true, cctvAddTerminal),"default-small")
    cctvAddTerR = guiCreateScrollBar(.5, .1, .48, .07, true, true, cctvAddTerminal)
    cctvAddTerG = guiCreateScrollBar(.5, .17, .48, .07, true, true, cctvAddTerminal)
    cctvAddTerB = guiCreateScrollBar(.5, .24, .48, .07, true, true, cctvAddTerminal)
    guiSetFont(guiCreateLabel(.5,.31,.4,.06, "Marker opacity:", true, cctvAddTerminal),"default-small")
    cctvAddTerA = guiCreateScrollBar(.5, .37, .48, .07, true, true, cctvAddTerminal)
    guiScrollBarSetScrollPosition(cctvAddTerA, 50)
    guiSetFont(guiCreateLabel(.5,.44,.4,.06, "Marker size:", true, cctvAddTerminal),"default-small")
    cctvAddTerSize = guiCreateScrollBar(.5, .5, .48, .07, true, true, cctvAddTerminal)
    guiScrollBarSetScrollPosition(cctvAddTerSize, 20)
    cctvAddTerMO = guiCreateCheckBox(.5,.57,.48,.1, "Use only marker (without PC object)", false, true, cctvAddTerminal)
    cctvAddTerMView = guiCreateCheckBox(.5,.85,.22,.1, "Preview marker", false, true, cctvAddTerminal)
    cctvAddTerSave = guiCreateButton(.75,.85,.23,.1, "SAVE TERMINAL", true, cctvAddTerminal)
    guiSetFont(cctvAddTerSave, "default-bold-small")
   
    -- Reset tab
    cctvRReload = guiCreateButton(.03,.85,.46,.1, "Reload everything from DB", true, cctvRR)
    cctvRReset = guiCreateButton(.51,.85,.46,.1, "Reset/delete everything", true, cctvRR)
   
    guiSetVisible(cctvWindow, false)
   
    addEventHandler("onClientGUIScroll", source,
      function(bar)
        if bar == cctvAddCamR then localC.r = guiScrollBarGetScrollPosition(cctvAddCamR)*2  
        elseif bar == cctvAddCamG then localC.g = guiScrollBarGetScrollPosition(cctvAddCamG)*2
        elseif bar == cctvAddCamB then localC.b = guiScrollBarGetScrollPosition(cctvAddCamB)*2
        elseif bar == cctvAddCamS then localC.scanlines = guiScrollBarGetScrollPosition(cctvAddCamS)
        elseif bar == cctvAddCamF then localC.flicker = 1 + math.floor(guiScrollBarGetScrollPosition(cctvAddCamF)/10)
        elseif bar == cctvAddCamSS then localC.scansize = guiScrollBarGetScrollPosition(cctvAddCamSS)*5
        elseif bar == cctvAddCamFov then
          localC.fov = 20+guiScrollBarGetScrollPosition(cctvAddCamFov)
          if viewCamera then updateCam() end
        elseif bar == cctvAddCamUp then
          localC.height = guiScrollBarGetScrollPosition(cctvAddCamUp)
          if viewCamera then updateCam() end
        elseif bar == cctvAddCamPan then
          localC.angle = math.floor(guiScrollBarGetScrollPosition(cctvAddCamPan)*3.6)
          local offA = 0
          if localC.type == wallcam then offA = offsets.wallAngle
          else offA = offsets.ceilAngle end
          if localObject and isElement(localObject) then setElementRotation(localObject, 0, 0, offA - localC.angle) end
          if viewCamera then updateCam() end
        elseif bar == cctvAddTerRot then
          localT.rz = math.floor(guiScrollBarGetScrollPosition(cctvAddTerRot)*3.6)
          if localObject and isElement(localObject) then setElementRotation(localObject, 0, 0, localT.rz) end
          if localMarker and isElement(localMarker) then
            local mx, my = getRotation(localT.x, localT.y, 0.7, 195 - localT.rz)      
            setElementPosition(localMarker, mx, my, localT.z-0.5)
          end
        elseif bar == cctvAddTerR then
          localT.mr = math.floor(guiScrollBarGetScrollPosition(cctvAddTerR)*2.5)
          if isElement(localMarker) then setMarkerColor(localMarker, localT.mr, localT.mg, localT.mb, localT.ma) end
        elseif bar == cctvAddTerG then
          localT.mg =
Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...