Jump to content

مساعده في مود hud


sawser

Recommended Posts

السلام عليكم 
 كيف اخلي الدم يكون دم السياره مب دم اللعب 



local screenW, screenH = guiGetScreenSize()


    function test()

	local hp = getElementHealth(localPlayer)
	
	
	setPlayerHudComponentVisible("health",false)
	
	
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412/100*hp, screenH * 0.0404, tocolor(254, 0, 0, 255), false)
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412, screenH * 0.0404, tocolor(254, 0, 0, 72), true)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) - 1, (screenW * 0.9926) - 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) - 1, (screenW * 0.9926) + 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) + 1, (screenW * 0.9926) - 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) + 1, (screenW * 0.9926) + 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", screenW * 0.8507, screenH * 0.5378, screenW * 0.9926, screenH * 0.5781, tocolor(255, 255, 255, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
    end

addEventHandler('onClientRender',root,test)

function trueHud()

	setPlayerHudComponentVisible("health",true)

end
addEventHandler('onResourceStop',root,trueHud)

 

Link to comment

هتيجي قبل المتغير اللي اسمو 

Hp

و تعمل كدة 

local veh = getPedOccupiedVehicle ( localPlayer)
if veh then --علشان لو مش في السيارة ميطلعلكش خطاء
  local hp = getElementHealth ( veh ) 
end 

اسف الكود من الموبايل

Edited by mohamed hussein
Link to comment
On 12/20/2017 at 07:42, mohamed hussein said:

هتيجي قبل المتغير اللي اسمو 

Hp

و تعمل كدة 


local veh = getPedOccupiedVehicle ( localPlayer)
if veh then --علشان لو مش في السيارة ميطلعلكش خطاء
  local hp = getElementHealth ( veh ) 
end 

اسف الكود من الموبايل

X

local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root,
    function (  )
	if ( isPedInVehicle(localPlayer) ) then
	local Vehicle = getPedOccupiedVehicle( localPlayer )
	local hp = getElementHealth(Vehicle);
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412 * hp / 100, screenH * 0.0404, tocolor(254, 0, 0, 255), false)
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412 , screenH * 0.0404, tocolor(254, 0, 0, 255), true)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) - 1, (screenW * 0.9926) - 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) - 1, (screenW * 0.9926) + 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) + 1, (screenW * 0.9926) - 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) + 1, (screenW * 0.9926) + 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", screenW * 0.8507, screenH * 0.5378, screenW * 0.9926, screenH * 0.5781, tocolor(255, 255, 255, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
    end
	end
)

try..

Edited by #Himoo
Link to comment
3 hours ago, #Himoo said:

X


local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", root,
    function (  )
	if ( isPedInVehicle(localPlayer) ) then
	local Vehicle = getPedOccupiedVehicle( localPlayer )
	local hp = getElementHealth(Vehicle);
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412 * hp / 100, screenH * 0.0404, tocolor(254, 0, 0, 255), false)
        dxDrawLine((screenW * 0.8515) - 1, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, (screenH * 0.5378) - 1, (screenW * 0.8515) - 1, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine((screenW * 0.8515) - 1, screenH * 0.5781, screenW * 0.9926, screenH * 0.5781, tocolor(0, 0, 0, 255), 1, true)
        dxDrawLine(screenW * 0.9926, screenH * 0.5781, screenW * 0.9926, (screenH * 0.5378) - 1, tocolor(0, 0, 0, 255), 1, true)
        dxDrawRectangle(screenW * 0.8515, screenH * 0.5378, screenW * 0.1412 , screenH * 0.0404, tocolor(254, 0, 0, 255), true)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) - 1, (screenW * 0.9926) - 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) - 1, (screenW * 0.9926) + 1, (screenH * 0.5781) - 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) - 1, (screenH * 0.5378) + 1, (screenW * 0.9926) - 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", (screenW * 0.8507) + 1, (screenH * 0.5378) + 1, (screenW * 0.9926) + 1, (screenH * 0.5781) + 1, tocolor(0, 0, 0, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText(""..math.floor(hp).."%", screenW * 0.8507, screenH * 0.5378, screenW * 0.9926, screenH * 0.5781, tocolor(255, 255, 255, 255), 1.30, "pricedown", "center", "center", false, false, false, false, false)
    end
	end
)

try..

isn't  X

getPedOccupiedVehicle

Returns the vehicle that the specified ped is in, or false if the ped is not in a vehicle or is an invalid ped.

it's true ................. @_@

==

علعموم كود الأخ الي فوق صحيح وما اشوف اي خطأ أتمنى تراجع الويكي قبل ماتقول انه خطأ .._..

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