Leaderboard
Popular Content
Showing content with the highest reputation on 18/10/24 in all areas
-
In dxDrawRectangle you are using screenWidth and screenHeight, which are probably the dimensions of the screen, but your render target has a size defined by window.windowWidth and window.headerHeight. You are using math_min(window.colors.alpha, 100) and math.min(window.colors.alpha, 250) in different parts of your rendering. you are trying to render the window header to a dxRenderTarget. When calling dxSetRenderTarget you are projecting at the correct size and when a projected window appears, it is being called within onClientRender correctly. Don't forget to call dxSetRenderTarget() at the end of the window.drawHeader() function. Fix your code. janela = {} janela.windowWidth = 600 janela.headerHeight = 600 janela.renderTarget = { mainHeader = dxCreateRenderTarget(janela.windowWidth, janela.headerHeight, true) } janela.cores = { alfa = 0 } janela.currentAlpha = 0 janela.fadeDuration = 1000 janela.isVisible = false janela.isHandlerAdded = false function lxfunction1() dxSetRenderTarget(janela.renderTarget.mainHeader, true) dxDrawRectangle(0, 0, janela.windowWidth, janela.headerHeight, tocolor(10, 10, 10, math.min(janela.cores.alfa, 100))) dxDrawImage(0, 0, janela.windowWidth, janela.headerHeight, "path_to_texture.png", 0, 0, 0, tocolor(30, 30, 30, math.min(janela.cores.alfa, 250))) dxSetRenderTarget() end function lxfunction2() local now = getTickCount() local elapsedTime = now - janela.fadeStartTime local progress = math.min(elapsedTime / janela.fadeDuration, 1) janela.currentAlpha = interpolateBetween(janela.fadeStartAlpha, 0, 0, janela.targetAlpha, 0, 0, progress, "Linear") janela.cores.alfa = math.floor(janela.currentAlpha) if janela.renderTarget.mainHeader then dxDrawImage(janela.headerX, janela.headerY, janela.windowWidth, janela.headerHeight, janela.renderTarget.mainHeader) end if progress == 1 and not janela.isVisible and janela.currentAlpha == 0 then removeEventHandler("onClientRender", root, lxfunction2) janela.isHandlerAdded = false end end function lxfunction3(state) janela.isVisible = state janela.targetAlpha = state and 255 or 0 janela.fadeStartTime = getTickCount() janela.fadeStartAlpha = janela.currentAlpha if not janela.isHandlerAdded then addEventHandler("onClientRender", root, lxfunction2) janela.isHandlerAdded = true end end bindKey("H", "down", function() lxfunction1() lxfunction3(true) end) bindKey("H", "up", function() lxfunction3(false) end)1 point
-
Hey there, This is just a small showcase of how ATMs function as a part of the economy system, and some highlights of the primary features in the police system; these were created for my roleplay gamemode. I hope you enjoy! ATM System There are two types of ATMs that can be created: ones that support deposits and ones that don't - typically the ATMs that support depositing money are placed near banks. In the video below, you can see an example of withdrawing cash from an ATM, the process of depositing is the same except the animation just plays in reverse. There are also multiple ATM card types with different maximum withdrawal values for how much can be withdrawn from an ATM within the period of 24 hours. The ATM also features security such as automatically intaking the card if there are too many unsuccessful PIN attempts. The 'buttons' on the ATM are actually just dxDrawRectangle's created by the UI system and an event listener is triggered every time one of them is triggered, each button has its own element data so we can determine what key is being pressed. The animation for the money flowing in/out of the ATM is done by having seperate images for the cash flap and the money(the money image is actually always behind the flap out of view ready to come out!) so when we want to play the animation, the position of the flap image is raised using an easing function, and the same with the image of the cash moving down; then we simply listen for a click on the cash image to take it out and close the flap. ELS (Emergency Light System) There are multiple light patterns which exist for different vehicles, ranging from all emergency vehicles and also including others such as the Sultan, FBI Rancher, FBI Truck, etc. All strobe elements can be dynamically placed on vehicles in-game through a strobe editor. ALPR (Automatic License Plate Reader) This has the functionality to automatically search the plates of any vehicle that collides with the scanner hitbox, it automatically takes the vehicle's plates (if the vehicle has plates) and looks it up in the database for any existing flags, warrants, etc. and displays them on the vehicle information prompt, this lookup continues for every vehicle that passes and if a flag is found, the information is locked and retained on the display with an audio cue. There are two radars in the vehicle: one in the front and one in the rear, both can be customized to point to either the opposite lane that the vehicle is travelling on or the same lane. It also functions as a speedometer, any vehicle that drives past has its speed checked, and if the speed of the vehicle passing by is higher than what the 'Fast Limit' is as set by the player, then the violating vehicle's information is also locked and the ALPR operator is notified of the speed the vehicle was in excess of along with the direction they were heading - whilst all of this isn't demonstrated in the video, I might record and display this if there is interest for it. MDC System (Mobile Data Computer) The MDC is a fully responsive web application created with the intention of primarily being used on a web browser, though with Bootstrap it sizes quite nicely after being resized into a browser element placed into a small tablet on the screen, the small tablet version exists to allow quick navigation and usage though there is also a mobile data computer item in-game which can be used to open up a larger functional computer-style view for easier navigation. The web application itself is highly dynamic and created using PHP and Javascipt, most AJAX requests are made on the same page to prevent redirection such that the user can stay on the same page for each section (Civilian, Vehicle, Firearm, Property lookups) and also features a large amount of pop-up modals with a refreshing take on responsiveness.1 point