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

Wysłany: 2019-08-15, 22:21


TheBAMBO

restMTA






Wiek: 22
Na forum: 2953 dni
Posty: 73
Nick w MP: zexty

Piwa: 12314

Respekt: 75,8

Witam, napisa?em panel F1, lecz gdy go wlaczam nie dzia?aj? ?adne elementy w cgui, za pomoc stawiam :piwo:


Kod:


--[[

@Autor: TheNoobisty

- Zabrania si? edytowania skryptu bez zgody jego autora -

]]--


zakladka = guiCreateLabel(0.02, 0.09, 0.71, 0.84, "", true)
local font0_normal = guiCreateFont(":pd_gui/fonts/normal.ttf", 13)
guiSetFont(zakladka, font0_normal)
guiLabelSetHorizontalAlign(zakladka, "center", false)
guiLabelSetVerticalAlign(zakladka, "center")


label = guiCreateLabel(0.02, 0.02, 0.70, 0.07, "", true)
local font1_gtav = guiCreateFont(":pd_gui/fonts/gtav.ttf", 39)
guiSetFont(label, font1_gtav)
guiLabelSetHorizontalAlign(label, "center", false)
guiLabelSetVerticalAlign(label, "center")


local screenW, screenH = guiGetScreenSize()
F1 = false

function cursorPosition(x, y, w, h) 
if (not isCursorShowing()) then 
return false 
end 
local mx, my = getCursorPosition() 
local fullx, fully = guiGetScreenSize() 
cursorx, cursory = mx*fullx, my*fully 
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then 
return true 
else 
return false 
end 
end 


-- Zakladki
Przewodnik = "Przewodnik"
Prace = "Prace"
Komendy = "Komendy"
Bindy = "Bindy"
Premium = "Premium"



local dxfont0_gtav = dxCreateFont(":pd_gui/fonts/gtav.ttf", 49)
local dxfont1_normal = dxCreateFont(":pd_gui/fonts/normal.ttf", 12)

function render()
        dxDrawRectangle(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, tocolor(65, 65, 65, 225), false)

 
        if cursorPosition(screenW * 0.9440, screenH * 0.1629, screenW * 0.0560, screenH * 0.0219) then
        dxDrawRectangle(screenW * 0.9440, screenH * 0.1629, screenW * 0.0560, screenH * 0.0219, tocolor(35,35,35,225), false)
        else
        dxDrawRectangle(screenW * 0.9440, screenH * 0.1629, screenW * 0.0560, screenH * 0.0219, tocolor(65,65,65,225), false)
        end

        if cursorPosition(screenW * 0.9440, screenH * 0.1905, screenW * 0.0560, screenH * 0.0219) then
        dxDrawRectangle(screenW * 0.9440, screenH * 0.1905, screenW * 0.0560, screenH * 0.0219, tocolor(35,35,35,225), false)
        else
        dxDrawRectangle(screenW * 0.9440, screenH * 0.1905, screenW * 0.0560, screenH * 0.0219, tocolor(65,65,65,225), false)
        end

          if cursorPosition(screenW * 0.9440, screenH * 0.2162, screenW * 0.0560, screenH * 0.0219) then
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2162, screenW * 0.0560, screenH * 0.0219, tocolor(35,35,35,225), false)
        else
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2162, screenW * 0.0560, screenH * 0.0219, tocolor(65,65,65,225), false)
        end

        if cursorPosition(screenW * 0.9440, screenH * 0.2429, screenW * 0.0560, screenH * 0.0219) then
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2429, screenW * 0.0560, screenH * 0.0219, tocolor(35,35,35,225), false)
        else
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2429, screenW * 0.0560, screenH * 0.0219, tocolor(65,65,65,225), false)
        end


        if cursorPosition(screenW * 0.9440, screenH * 0.2686, screenW * 0.0560, screenH * 0.0219) then
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2686, screenW * 0.0560, screenH * 0.0219, tocolor(35,35,35,225), false)
        else
        dxDrawRectangle(screenW * 0.9440, screenH * 0.2686, screenW * 0.0560, screenH * 0.0219, tocolor(65,65,65,225), false)
        end


        --dxDrawText("Panel Pomocy", screenW * 0.7315, screenH * 0.0133, screenW * 0.9940, screenH * 0.1029, tocolor(255, 255, 255, 255), 1.00, dxfont0_gtav, "center", "center", false, false, true, false, false)
        dxDrawText("Przewodnik", screenW * 0.9446, screenH * 0.1638, screenW * 0.9940, screenH * 0.1857, tocolor(255, 255, 255, 255), 1.00, dxfont1_normal, "right", "center", false, false, true, false, false)
        dxDrawText("Prace", screenW * 0.9446, screenH * 0.1905, screenW * 0.9940, screenH * 0.2124, tocolor(255, 255, 255, 255), 1.00, dxfont1_normal, "right", "center", false, false, true, false, false)
        dxDrawText("Bindy", screenW * 0.9446, screenH * 0.2429, screenW * 0.9940, screenH * 0.2648, tocolor(255, 255, 255, 255), 1.00, dxfont1_normal, "right", "center", false, false, true, false, false)
        dxDrawText("Komendy", screenW * 0.9446, screenH * 0.2162, screenW * 0.9940, screenH * 0.2381, tocolor(255, 255, 255, 255), 1.00, dxfont1_normal, "right", "center", false, false, true, false, false)
        dxDrawText("Premium", screenW * 0.9446, screenH * 0.2695, screenW * 0.9940, screenH * 0.2914, tocolor(255, 255, 255, 255), 1.00, dxfont1_normal, "right", "center", false, false, true, false, false)



end

addEventHandler("onClientClick", getRootElement(), function(button, state)
    if button == "left" and state == "down" then
        if cursorPosition(screenW * 0.9440, screenH * 0.1629, screenW * 0.0560, screenH * 0.0219) then
            guiSetVisible(label, true)
            guiSetVisible(zakladka, true)
            guiSetText(zakladka, "1")
            guiSetText(label, Przewodnik)
        elseif cursorPosition(screenW * 0.9440, screenH * 0.1905, screenW * 0.0560, screenH * 0.0219) then
            guiSetVisible(label, true)
            guiSetVisible(zakladka, true)
            guiSetText(zakladka, "2")
            guiSetText(label, Prace)
        elseif cursorPosition(screenW * 0.9440, screenH * 0.2162, screenW * 0.0560, screenH * 0.0219) then
            guiSetVisible(label, true)
            guiSetVisible(zakladka, true)
            guiSetText(zakladka, "3")
            guiSetText(label, Komendy)
        elseif cursorPosition(screenW * 0.9440, screenH * 0.2429, screenW * 0.0560, screenH * 0.0219) then
            guiSetVisible(label, true)
            guiSetVisible(zakladka, true)
            guiSetText(zakladka, "4")
            guiSetText(label, Bindy)
        elseif cursorPosition(screenW * 0.9440, screenH * 0.2686, screenW * 0.0560, screenH * 0.0219) then
            guiSetVisible(label, true)
            guiSetVisible(zakladka, true)
            guiSetText(zakladka, "5")
            guiSetText(label, Premium)
    end
end
end)

function F1()
    if F1 == false then
        if getElementData(localPlayer, "dashboard") then return end
        if getElementData(localPlayer, "player:radar:ko?owy") then
        setPlayerHudComponentVisible("radar",false)
        setElementData(localPlayer, "nimaradaru", true)
        end
        addEventHandler("onClientRender", getRootElement(), render)
        guiSetVisible(label, true)
        guiSetVisible(zakladka, true)
        guiSetText(zakladka, "Witaj na BackToRPG!")
        guiSetText(label, "Panel Pomocy")
        setElementData(localPlayer, "notshowhud", true)
        setElementData(localPlayer, "f1", true)
        showCursor(true)
        showChat(false)
        F1=true
    else
        if getElementData(localPlayer, "player:radar:ko?owy") then
        setPlayerHudComponentVisible("radar",true)
        setElementData(localPlayer, "nimaradaru", false)
        end
        removeEventHandler("onClientRender", getRootElement(), render)
        guiSetVisible(label, false)
        guiSetVisible(zakladka, false)
        showCursor(false)
        showChat(true)
        setElementData(localPlayer, "notshowhud", false)
        setElementData(localPlayer, "f1", false)
        F1=false
    end
end
bindKey("F1", "down", F1)


function convertNumber ( number )  
    local formatted = number  
    while true do      
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
        if ( k==0 ) then      
            break   
        end  
    end  
    return formatted
end



Podpis

Discord
zexty00
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-16, 00:23


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Jakie? b??dy?
Co masz na my?li m?wi?c, ?e nie dzia?a? Nie wy?wietla si?, jak klikasz to nic si? nie dzieje?

Czy elementy CeGUI tworz? si? nad elementami DX?
Pr?bowa?e? uruchomi? skrypt ale bez wszystkich element?w DX?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-16, 00:35


TheBAMBO

restMTA






Wiek: 22
Na forum: 2953 dni
Posty: 73
Nick w MP: zexty

Piwa: 12314

Respekt: 75,8

Wilq, gdy skrypt jest wlaczony, kazde inne gui itd w CGUI nie dzia?a, nie wiem w czym problem.

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: (dxdraw) :: nie :: działa
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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