fairyoggy Posted April 29, 2019 Share Posted April 29, 2019 Hello! Can you help me to write a script for wanted lvl. I want to do so: there will be a picture in format png(star.png) and when player have (example 2 lvl wanted ) then two identical pictures will appear (star.png) in given coordinates(example under the hud). Need custom script for wanted level not default. Link to comment
SaNoR Posted April 29, 2019 Share Posted April 29, 2019 (edited) local sw, sh = guiGetScreenSize() local icon_width, icon_height = 20, 20 -- star.png width, height local space = 1 -- space between icons local x, y = sw - icon_width - 50, sh * 0.5 -- x, y position addEventHandler("onClientRender", root, function() for i = 1, getPlayerWantedLevel() do dxDrawImage(x + (icon_width + space) - i * (icon_width + space), y, icon_width, icon_height, "star.png") end end) Edited April 29, 2019 by SaNoR 1 Link to comment
MIKI785 Posted April 29, 2019 Share Posted April 29, 2019 Or you could use a shader to replace the wanted star icons, that would allow you to keep using the built-in functions while displaying a custom icon. Link to comment
fairyoggy Posted April 29, 2019 Author Share Posted April 29, 2019 5 hours ago, SaNoR said: local sw, sh = guiGetScreenSize() local icon_width, icon_height = 20, 20 -- star.png width, height local space = 1 -- space between icons local x, y = sw - icon_width - 50, sh * 0.5 -- x, y position addEventHandler("onClientRender", root, function() for i = 1, getPlayerWantedLevel() do dxDrawImage(x + (icon_width + space) - i * (icon_width + space), y, icon_width, icon_height, "star.png") end end) Can you tell me how to make the star size the same for all resolutions? Link to comment
SaNoR Posted April 29, 2019 Share Posted April 29, 2019 38 minutes ago, slapz0r said: Can you tell me how to make the star size the same for all resolutions? -- player's screen size width * (icon size / you'r screen size width) -- same with height local sw, sh = guiGetScreenSize() local mineX, mineY = 1280, 720 -- you'r current screen resolution (from video setting) local icon_width, icon_height = sw * (20 / mineX), sh * (20 / mineY) -- star.png width, height local space = sw * (1 / mineX) -- space between icons local x, y = sw - icon_width - sw * (50 / mineX), sh * 0.5 -- x, y position 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now