Perigo Posted August 7, 2022 Share Posted August 7, 2022 OLá , estou com problema em um hud que a fome/sede do player nao reduz para ele sentir fome/sede , tentei reduzir manualmnte pelo script definindo o limite e percebi tambem que o personagem não esta a vida degredindo pela fome/sede , poderiam me ajudar local sx, sy = guiGetScreenSize() local link = "http://mta/"..getResourceName(getThisResource()).."/web-side/index.html" local browser = createBrowser(sx, sy, true, true) local components = { "area_name", "radio", "vehicle_name" } setDevelopmentMode(true, true) local player = {} local vehicle = false local voiceEnabled = true function dxHud() dxDrawImage(0, 0, sx, sy, browser) end function updateDX( ) local health = getElementHealth(localPlayer) local armour = getPedArmor(localPlayer) local hunger = getElementData(localPlayer, configs['Elements']['Fome']) or 100 local thirst = getElementData(localPlayer, configs['Elements']['Sede']) or 100 local stress = getElementData(localPlayer, configs['Elements']['Stress']) or 100 local radio = getElementData(localPlayer, "ae.frequencia") or 0 local x,y,z = getElementPosition(localPlayer) local street = getZoneName ( x, y, z, true ) local direction = getZoneName ( x, y, z, false ) local time = getRealTime() local hours = ""..time.hour..":"..time.minute local minutes = time.minute; if getPedOccupiedVehicle(localPlayer) then fuel = getElementData(getPedOccupiedVehicle(getLocalPlayer()), configs['Elements']['fuel']) or 100 speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( getPedOccupiedVehicle(localPlayer) ) ) end SendNUIMessage(browser, { vehicle = vehicle, talking = talking, health = health, armour = armour, thirst = thirst, hunger = hunger, street = street, radio = radio, time = hours, minutes = minutes, direction = direction, voice = voice, speed = speed, fuel = fuel }) end function SendNUIMessage(browser, table) if isElement(browser) and type(table) == "table" then return executeBrowserJavascript(browser, 'window.postMessage('..toJSON(table)..'[0])') end end addEventHandler("onClientBrowserCreated", browser, function() loadBrowserURL(source, link) end) addEventHandler( "onClientBrowserDocumentReady", browser, function (url) SendNUIMessage(browser, {hud = true}) addEventHandler( "onClientRender", getRootElement(), dxHud) end) function EntrarEsair() if getPedOccupiedVehicle(getLocalPlayer()) then vehicle = true else vehicle = false end end setTimer(function() EntrarEsair(1) updateDX(1) end, 50, 10) function setHud() setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) setPlayerHudComponentVisible("radar", false) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setHud) addEventHandler('onClientPlayerVoiceStart', root, function() if (source == localPlayer) then talking = true end end ) addEventHandler('onClientPlayerVoiceStop', root, function() if (source == localPlayer) then talking = false end end ) Link to comment
Moderators Vinyard Posted August 7, 2022 Moderators Share Posted August 7, 2022 Hi, welcome to the forums! I've moved your thread to the Portuguese scripting section so you can get better assistance in your native language. Please make sure to always use English when posting outside this section! Link to comment
Perigo Posted August 7, 2022 Author Share Posted August 7, 2022 5 minutes ago, Vinyard said: Olá, bem vindo aos fóruns! Movi seu tópico para a seção de scripts em português para que você possa obter melhor assistência em seu idioma nativo. Por favor, certifique-se de sempre usar o inglês ao postar fora desta seção! ok 8 minutes ago, Vinyard said: Hi, welcome to the forums! I've moved your thread to the Portuguese scripting section so you can get better assistance in your native language. Please make sure to always use English when posting outside this section! Can you help me? Link to comment
Blaack Posted August 13, 2022 Share Posted August 13, 2022 (edited) Bom dia tudo bem? Não há nada em seu código que faça a fome/sede diminuir... a maioria das huds ela só tem a função de mostrar e não de diminuir. Outra coisa, você não mostra qual essa definição... local hunger = getElementData(localPlayer, configs['Elements']['Fome']) or 100 local thirst = getElementData(localPlayer, configs['Elements']['Sede']) or 100 local stress = getElementData(localPlayer, configs['Elements']['Stress']) or 100 Edited August 13, 2022 by Blaack 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