Jump to content

أستفسار ||.


#FeldMan

Recommended Posts

ايش المشكلة يعني لهدرجة صعب الموضوع؟

function isElementMoving (theElement )
   if isElement ( theElement ) then                                   -- First check if the given argument is an element
      return Vector3( getElementVelocity( theElement ) ).length ~= 0
   end
   return false
end

-- Keep the text visible with onClientRender.
addEventHandler ( "onClientRender", root, idleCheck )

addEvnetHandler( "onClientRender", root, function()
   if ( isElementMoving(localPlayer) ) then
      dxDrawText("Hello"......etc)
   end
end) 
   
   

 

Link to comment
7 minutes ago, *RayaN-Alharbi. said:

نفس الطريقة فرقت يعني.؟


function isElementMoving (theElement )
   if isElement ( theElement ) then                                   -- First check if the given argument is an element
      return Vector3( getElementVelocity( theElement ) ).length ~= 0
   end
   return false
end




local screenWidth, screenHeight = guiGetScreenSize ()

local x,y = guiGetScreenSize()

local show = true

setElementData(localPlayer, "thirsty", 30)



function drawHud()

	if (show==true) then

		local thirsty = getElementData(localPlayer, "thirsty")


		local playermoney = getPlayerMoney()


		dxDrawRectangle(473, 109, 92, 27, tocolor(0, 0, 0, 150))

		dxDrawRectangle(x-326, 34+80, thirsty*3, 17, tocolor(1, 96, 253, 255))

		dxDrawText("Fatigue" .. (isElementMoving(getPedOccupiedVehicle(localPlayer) or localPlayer) and ".") or ("idling").. "!", 499, 114, 563, 131, tocolor(255, 255, 255), 1, "default-bold", "center")





	end
end

addEventHandler("onClientRender", root, drawHud)


setTimer(function()

    local under1 = getElementData(localPlayer, "thirsty")

    setElementData(localPlayer, "thirsty", under1-1)

end, 2000, 0) 

addEventHandler("onClientRender", root, setTimer)





function die()

	local piageci = getElementData(localPlayer, "thirsty")



	if (piageci==0) then


		setElementData(localPlayer, "thirsty", 30)


		setElementHealth(localPlayer, 0)




	end

end

addEventHandler("onClientElementDataChange", root, die)



-- Hide the hud when the resource is started

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }



addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),

function ()

	for _, component in ipairs( components ) do

		setPlayerHudComponentVisible( component, false )

	end

end)



function fixhud()

	setPlayerHudComponentVisible( component, false )

end

addCommandHandler("fixhud", fixhud)

تقدر تركبه على ذأ الكود لأني مبتدأ في البرمجة 

*RayaN-Alharbi.

Link to comment
On 01/12/2018 at 10:28, *RayaN-Alharbi. said:

نفس الطريقة فرقت يعني.؟
 

فشلتنا الرجال يأخي الله يهديك ذذ ..

function isElementMoving (theElement )
   if isElement ( theElement ) then                                   -- First check if the given argument is an element
      return Vector3( getElementVelocity( theElement ) ).length ~= 0
   end
   return false
end




local screenWidth, screenHeight = guiGetScreenSize ()

local x,y = guiGetScreenSize()

local show = true

setElementData(localPlayer, "thirsty", 30)



function drawHud()

	if (show==true) then

		local thirsty = getElementData(localPlayer, "thirsty")


		local playermoney = getPlayerMoney()


		dxDrawRectangle(473, 109, 92, 27, tocolor(0, 0, 0, 150))

		dxDrawRectangle(x-326, 34+80, thirsty*3, 17, tocolor(1, 96, 253, 255))

		dxDrawText("Fatigue" .. (isElementMoving(getPedOccupiedVehicle(localPlayer) or localPlayer) and ".") or ("idling").. "!", 499, 114, 563, 131, tocolor(255, 255, 255), 1, "default-bold", "center")





	end
end

addEventHandler("onClientRender", root, drawHud)


setTimer(function()

    local under1 = getElementData(localPlayer, "thirsty")

    setElementData(localPlayer, "thirsty", under1-1)

end, 2000, 0) 

addEventHandler("onClientRender", root, setTimer)





function die()

	local piageci = getElementData(localPlayer, "thirsty")



	if (piageci==0) then


		setElementData(localPlayer, "thirsty", 30)


		setElementHealth(localPlayer, 0)




	end

end

addEventHandler("onClientElementDataChange", root, die)



-- Hide the hud when the resource is started

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }



addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),

function ()

	for _, component in ipairs( components ) do

		setPlayerHudComponentVisible( component, false )

	end

end)



function fixhud()

	setPlayerHudComponentVisible( component, false )

end

addCommandHandler("fixhud", fixhud)

. جرب

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