Jump to content

Perigo

Members
  • Posts

    4
  • Joined

  • Last visited

Perigo's Achievements

Vic

Vic (3/54)

0

Reputation

  1. Meu painel fica assim mas eu adicionei corretamente no Acl
  2. Hello, I'm having a problem with a hud that the player's hunger/thirst doesn't reduce for him to feel hungry/thirsty, I tried to reduce manually by the script defining the limit and I also realized that the character is not degrading his life by hunger/thirst, could you help. 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 ) configs = { ['Elements'] = { ['Fome'] = 'hunger', ['Sede'] = 'sede', ['Stress'] = 'AC-Stress', ['fuel'] = 'Gasolina', }, }
  3. 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 )
×
×
  • Create New...