Szerző Téma: MTA MOZGATHATÓ HUD, ÉS KAJACSíK  (Megtekintve 1388 alkalommal)

MTA MOZGATHATÓ HUD, ÉS KAJACSíK
« Dátum: 2017. Augusztus 18. - 20:21:50 »
0
Sziasztok!
 
Van egy hudom, ami egy alap hud és nem lehet mozgatni. Szeretném, ha lehetne mozgatni. Van egy script amit találtam ehez, viszont ha lenyomom az m betűt, akkor előhoz egy szürke kockát és azt tudom mozgatni nem a hudot, pedig beleírtam a hudot.  Ja és bocsi, hogyha hülyeséget írtam, de 1 napja kezdtem el az egészet. Meg, ha valaki tudna segítséget nyújtani abban, hogy hogyan lehet egy kajacsíkot írni a hudba azt nagyon megköszönném.
 
Előre is köszönöm a segítséget!
 
Ez lenne a script:
 

local screenWidth, screenHeight = guiGetScreenSize();
local rectangleWidth, rectangleHeight = 450, 300;
local rectangleX, rectangleY = (screenWidth / 2) - (rectangleWidth / 2), (screenHeight / 2) - (rectangleHeight / 2);
local textMargin = 10;
local movingOffsetX, movingOffsetY = 0, 0;
local isMoving = false;
local rectangleOnScreen = false;
bindKey(\'m\', \'down\',
function()
   showCursor(not isCursorShowing());
   rectangleOnScreen = not rectangleOnScreen;
end
)
addEventHandler(\'onClientRender\', getRootElement(),
function()
   if (rectangleOnScreen) then
      --> Calculate cursor position
      if (isCursorShowing() and isMoving) then
         local cursorX, cursorY = getCursorPosition();
   
         cursorX = cursorX * screenWidth;
         cursorY = cursorY * screenHeight;
         
         rectangleX = cursorX - movingOffsetX;
         rectangleY = cursorY - movingOffsetY;
      end
      
      --> Background
      dxDrawRectangle(rectangleX, rectangleY, rectangleWidth, rectangleHeight, tocolor(0, 0, 0, 200));
      
      --> Some texts
      local sx, sy = guiGetScreenSize()
local hudState = true
local hudX, hudY, hudW, hudH = sx - 300 - 5, 5, 300, 100
local hudComponents = {\'clock\', \'ammo\', \'weapon\', \'money\', \'breath\', \'health\', \'armour\'}
addEventHandler(\'onClientResourceStart\', resourceRoot, function()
for k, v in pairs(hudComponents) do
   setPlayerHudComponentVisible(v, false)
end
end)
addEventHandler(\'onClientRender\', root, function()
if not hudState then return end
local playerHP = math.floor(getElementHealth(localPlayer))
local playerArmour = math.floor(getPedArmor(localPlayer))
local playerMoney = getPlayerMoney()
dxDrawRectangle(hudX, hudY, hudW, hudH, tocolor(0, 0, 0, 0))
dxDrawRectangle(hudX + 5, hudY + 5, hudW - 10, 26, tocolor(0, 0, 0, 150))
dxDrawRectangle(hudX + 5, hudY + 5, playerHP*2.9, 26, tocolor(255, 0, 0, 150))
dxDrawText(playerHP .. \'%\', hudX + 5 + hudW - 10, hudY + 5 + 26, hudX + 5, hudY + 5, tocolor(255, 255, 255, 255), 1, \'default-bold\', \'center\', \'center\')
dxDrawRectangle(hudX + 5, hudY + 5 + 26 + 5, hudW - 10, 26, tocolor(0, 0, 0, 150))
dxDrawRectangle(hudX + 5, hudY + 5 + 26 + 5, playerArmour*2.9, 26, tocolor(0, 161, 255, 202))
dxDrawText(playerArmour .. \'%\', hudX + 5 + hudW - 10, hudY + 5 + 26 + 5 + 26, hudX + 5, hudY + 5 + 26 + 5, tocolor(255, 255, 255, 255), 1, \'default-bold\', \'center\', \'center\')
dxDrawText(playerMoney .. \'#E80404$\', hudX + hudW, hudY + hudH*2 - 35, hudX, hudY, tocolor(255, 255, 255, 255), 1.25, \'pricedown\', \'center\', \'center\', false, false, false, true)
end)
addCommandHandler(\'toghud\', function()
hudState = not hudState
end)
   end
end
)
addEventHandler(\'onClientClick\', getRootElement(),
function(button, state, cursorX, cursorY)
   if (rectangleOnScreen) then
      if (button == \'left\' and state == \'down\') then
         if (cursorX >= rectangleX and cursorX <= rectangleX + rectangleWidth and cursorY >= rectangleY and cursorY <= rectangleY + rectangleHeight) then
            isMoving = true;
            movingOffsetX = cursorX - rectangleX;
            movingOffsetY = cursorY - rectangleY;
         end
      else
         isMoving = false;
      end
   end
end
)

 
 

Nem elérhető Fr3d

MTA MOZGATHATÓ HUD, ÉS KAJACSíK
« Válasz #1 Dátum: 2017. Augusztus 24. - 13:55:01 »
+1
Éhség -> GetElementData, és SetElementData
 
 

MTA MOZGATHATÓ HUD, ÉS KAJACSíK
« Válasz #2 Dátum: 2017. Augusztus 24. - 14:54:00 »
0
Aztán kilépésnél feltölteni adatbázisba, belépésnél meg setElementDatázni az adatbázisból.
« Utoljára szerkesztve: 2017. Augusztus 24. - 14:54:12 írta thegergo02 »

Nem elérhető Fr3d

MTA MOZGATHATÓ HUD, ÉS KAJACSíK
« Válasz #3 Dátum: 2017. Augusztus 24. - 22:59:54 »
+1
Amúgy ez Beester hudja:)

Nem elérhető Fr3d

MTA MOZGATHATÓ HUD, ÉS KAJACSíK
« Válasz #4 Dátum: 2017. Augusztus 25. - 10:46:16 »
0
Illetve ha mozgatni szeretnéd akkor talán írd meg magadtól és legalább tudod, hogy mi hol van:D

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal