Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-06-02, 21:05


Logic







Wiek: 29
Na forum: 2700 dni
Posty: 1
Nick w MP: Logic



Respekt: 50

Witam!
Mam problem ze skrypter z paczki WestRPG a m?j problem polega na tym ?e jak si? tego u?ywa to w konsoli ca?y czas wyskakuje co? takiego a wyskakuje to w tych skryptach w ktorych zostalo zastosowana funkcja z dxLibrary.

[19-06-02 20:57] DIAGNOSTIC: JazzySwan96 #1013 HTTP server file mismatch (notifications) pasek.png [Got size:0 MD5:00000000000000000000000000000000, wanted MD5:ED0A6697B7F258AC908304066285396E]

Kod:

--[[
Skrypt zosta? wykonany przez:
   -Asper (nezymr69@gmail.com).

Na potrzeby serwera:
   -WestRPG (2018).

Jedyne i wy??czone prawo do u?ywania kodu ma serwer WestRPG oraz autor skryptu. (Asper)
]]

local sw,sh = guiGetScreenSize()
local baseX = 1920
local scale = 1
local minScale = 1.1
if sw < baseX then
    scale = math.min(minScale, baseX/sw)
end

local dxLibary = {}

function isMouseIn(x, y, w, h)
    if not isCursorShowing() then return end

    local pos = {getCursorPosition()}
    pos[1],pos[2] = (pos[1]*sw),(pos[2]*sh)

    if pos[1] >= x and pos[1] <= (x+w) and pos[2] >= y and pos[2] <= (y+h) then
        return true
    end
    return false
end

function dxLibary:Load()
  self['font_quality'] = 'cleartype_natural'
  self['font_bold'] = false
  self['fonts'] = {
    [0] = dxCreateFont('fonts/czcionka.ttf', 9/scale, self['font_bold'], self['font_quality']),
    [1] = dxCreateFont('fonts/czcionka.ttf', 10/scale, self['font_bold'], self['font_quality']),
    [2] = dxCreateFont('fonts/czcionka.ttf', 11/scale, self['font_bold'], self['font_quality']),
    [3] = dxCreateFont('fonts/czcionka.ttf', 12/scale, self['font_bold'], self['font_quality']),
    [4] = dxCreateFont('fonts/czcionka.ttf', 13/scale, self['font_bold'], self['font_quality']),
    [5] = dxCreateFont('fonts/czcionka.ttf', 14/scale, self['font_bold'], self['font_quality']),
    [6] = dxCreateFont('fonts/czcionka.ttf', 15/scale, self['font_bold'], self['font_quality']),
    [7] = dxCreateFont('fonts/czcionka.ttf', 16/scale, self['font_bold'], self['font_quality']),
    [8] = dxCreateFont('fonts/czcionka.ttf', 17/scale, self['font_bold'], self['font_quality']),
    [9] = dxCreateFont('fonts/czcionka.ttf', 18/scale, self['font_bold'], self['font_quality']),
    [10] = dxCreateFont('fonts/czcionka.ttf', 19/scale, self['font_bold'], self['font_quality']),
    [11] = dxCreateFont('fonts/czcionka.ttf', 20/scale, self['font_bold'], self['font_quality']),
    [12] = dxCreateFont('fonts/czcionka.ttf', 21/scale, self['font_bold'], self['font_quality']),
    [13] = dxCreateFont('fonts/czcionka.ttf', 22/scale, self['font_bold'], self['font_quality']),
    [14] = dxCreateFont('fonts/czcionka.ttf', 23/scale, self['font_bold'], self['font_quality']),
    [15] = dxCreateFont('fonts/czcionka.ttf', 24/scale, self['font_bold'], self['font_quality']),
    [16] = dxCreateFont('fonts/czcionka.ttf', 25/scale, self['font_bold'], self['font_quality']),
    [17] = dxCreateFont('fonts/czcionka.ttf', 26/scale, self['font_bold'], self['font_quality']),
    [18] = dxCreateFont('fonts/czcionka.ttf', 27/scale, self['font_bold'], self['font_quality']),
  }

  self['tick'] = getTickCount()
  self['click'] = false

  self['txd_rectangle'] = createTexture('images/rectangle.png')
  self['txd_window'] = createTexture('images/window.png')
  self['txd_window-small'] = createTexture('images/window_small.png')
  self['txd_window-max-small'] = createTexture('images/window_max_small.png')
  self['txd_pasek'] = createTexture('images/pasek.png')
end

function dxLibary:Window(x, y, w, h)
  local txd = h <= 150 and self['txd_window-max-small'] or h > 150 and h <= 300 and self['txd_window-small'] or self['txd_window']
  dxDrawImage(x, y, w, h, txd, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  dxDrawImage(x, (y + h), w, 2, self['txd_pasek'], 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function dxLibary:WindowAlpha(x, y, w, h, alpha)
  dxDrawImage(x, y, w, h, self['txd_window'], 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  dxDrawImage(x, (y + h), w, 2, self['txd_pasek'], 0, 0, 0, tocolor(255, 255, 255, alpha), false)
end

function dxLibary:Button(text, x, y, w, h, size)
  if isMouseIn(x, y, w, h) then
    if getKeyState('mouse1') and self['click'] ~= true then
      playSoundFrontEnd(20)
      self['click'] = true
    elseif not getKeyState('mouse1') and self['click'] == true then
      self['click'] = false
    end

    local a = interpolateBetween(125, 0, 0, 175, 0, 0, (getTickCount() - self['tick'])/1500, 'SineCurve')
    dxDrawImage(x, y, w, h, self['txd_rectangle'], 0, 0, 0, tocolor(0, 75, 255, a), false)
  else
    dxDrawImage(x, y, w, h, self['txd_rectangle'], 0, 0, 0, tocolor(30, 30, 30, 230), false)
  end

  dxLibary_shadowText(text, x, y, (w + x), (h + y), tocolor(255, 255, 255, 255), size, 'default', 'center', 'center', false, true, false)
end

function dxLibary:ButtonAlpha(text, x, y, w, h, size, alpha, focus)
  if isMouseIn(x, y, w, h) then
    if getKeyState('mouse1') and self['click'] ~= true then
      playSoundFrontEnd(20)
      self['click'] = true
    elseif not getKeyState('mouse1') and self['click'] == true then
      self['click'] = false
    end

    if alpha >= 175 then
        a = interpolateBetween(125, 0, 0, 175, 0, 0, (getTickCount() - self['tick'])/1500, 'SineCurve')
    else
        a = alpha
    end
        
    dxDrawImage(x, y, w, h, self['txd_rectangle'], 0, 0, 0, tocolor(0, 75, 255, a), false)
  else
    if not focus then
      dxDrawImage(x, y, w, h, self['txd_rectangle'], 0, 0, 0, tocolor(30, 30, 30, alpha), false)
    elseif focus then
        if alpha >= 175 then
            a = interpolateBetween(125, 0, 0, 175, 0, 0, (getTickCount() - self['tick'])/1500, 'SineCurve')
        else
            a = alpha
        end

        dxDrawImage(x, y, w, h, self['txd_rectangle'], 0, 0, 0, tocolor(0, 75, 255, a), false)
    end
  end

  self:ShadowTextAlpha(text, x, y, (w + x), (h + y), alpha, size, 'default', 'center', 'center', false, true, false)
end

function dxLibary:Text(text, x, y, w, h, color, size, _, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  size = size or 1
  font = self['fonts'][size] or self['fonts'][1]
  alignX = alignX or 'left'
  alignY = alignY or 'top'

  dxDrawText(text, x, y, w, h, color, 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
end

function dxLibary:ShadowText(text, x, y, w, h, color, size, _, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  size = size or 1
  font = self['fonts'][size] or self['fonts'][1]
  alignX = alignX or 'left'
  alignY = alignY or 'top'

  dxDrawText(text, x - 1, y - 1, w - 1, h - 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y - 1, w + 1, h - 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x - 1, y + 1, w - 1, h + 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y + 1, w + 1, h + 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x - 1, y, w - 1, h, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y, w + 1, h, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x, y - 1, w, h - 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x, y + 1, w, h + 1, tocolor(0, 0, 0, 50), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)

  dxDrawText(text, x, y, w, h, color, 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
end

function dxLibary:ShadowTextAlpha(text, x, y, w, h, a, size, _, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  size = size or 1
  font = self['fonts'][size] or self['fonts'][1]
  alignX = alignX or 'left'
  alignY = alignY or 'top'

  local _a = a > 205 and a-205 or 0

  dxDrawText(text, x - 1, y - 1, w - 1, h - 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y - 1, w + 1, h - 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x - 1, y + 1, w - 1, h + 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y + 1, w + 1, h + 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x - 1, y, w - 1, h, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x + 1, y, w + 1, h, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x, y - 1, w, h - 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x, y + 1, w, h + 1, tocolor(0, 0, 0, _a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)

  dxDrawText(text, x, y, w, h, tocolor(255, 255, 255, a), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
end

function dxLibary:ShadowText_New(text, x, y, w, h, color, size, _, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  size = size or 1
  font = self['fonts'][size] or self['fonts'][1]
  alignX = alignX or 'left'
  alignY = alignY or 'top'

  dxDrawText(text, x + 1, y + 1, w + 1, h + 1, tocolor(0, 0, 0, 255), 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
  dxDrawText(text, x, y, w, h, color, 1, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY)
end

function dxLibary_shadowText(...)
  dxLibary:ShadowText(...)
end

function dxLibary_shadowText2(...)
  dxLibary:ShadowText_New(...)
end

function dxLibary_text(...)
  dxLibary:Text(...)
end

function dxLibary_createButton(...)
  dxLibary:Button(...)
end

function dxLibary_createButtonAlpha(...)
  dxLibary:ButtonAlpha(...)
end

function dxLibary_createWindow(...)
   dxLibary:Window(...)
end

function dxLibary_createWindowAlpha(...)
  dxLibary:WindowAlpha(...)
end

function dxLibary_formatTextPosition(x, y, w, h)
  return x, y, w + x, h + y
end

function dxLibary_getFont(size)
  return dxLibary['fonts'][size] or dxLibary['fonts'][1]
end

function createTexture(filePath, textureFormat, mipmaps, textureEdge)
  if not filePath then return false end

  textureFormat = textureFormat or 'dxt5'
  mipmaps = mipmaps or false
  textureEdge = textureEdge or 'clamp'

  local texture = dxCreateTexture(filePath, textureFormat, mipmaps, textureEdge) -- create texture
  if texture and fileExists(filePath) then -- check if texture successfully created and file exists then
    fileDelete(filePath) -- delete file from user computer
  end

  return texture -- send texture
end

addEventHandler('onClientResourceStart', resourceRoot, function()
  dxLibary:Load()
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-05, 18:19


.RiV







Wiek: 26
Na forum: 3729 dni
Posty: 554
Nick w MP: Split

Piwa: 2598

Respekt: 597,8
Respekt: 597,8

Istnieje plik pasek.png w katalogu images?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-06, 11:47


DylemaT929

Nikt






Wiek: 28
Na forum: 4182 dni
Posty: 340
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

".WhiteBlue" napisał/a:

Istnieje plik pasek.png w katalogu images?


Istnieje na pewno, bo sam sprawdza?em tego gma, ?cie?ki r?wnie? prawid?owe i faktycznie ci?gle to wyskakiwa?o co napisa?.

Postaw piwo autorowi tego posta
 

 
Tagi: dxlibrary :: west :: rpg
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » dxLibrary WEST RPG Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku