Jump to content

wanted level


fairyoggy

Recommended Posts

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
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 by SaNoR
  • Like 1
Link to comment
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
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

 

  • Like 1
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...