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

Wysłany: 2017-07-23, 19:36


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Witajcie u?ytkownicy gtao . Mam do was dzi? pytanie odno?nie autorozdzielczosci . Mam taki oto kod i nwm czemu to nie dzia?a , moja rozdzielczo?? to 1366x768


local screenWscreenH guiGetScreenSize()

okno guiCreateStaticImage(0.190.290.650.41"interakcja.png"true)
silnik guiCreateButton(30725327132"Silnik"false)
guiSetFont(silnik"default-bold-small")
reczny guiCreateButton(82425327132"R?czny"false)
guiSetFont(reczny"default-bold-small")
swiatla guiCreateButton(82436227633"?wiat?a"false)
guiSetFont(swiatla"default-bold-small")
drzwi guiCreateButton(82446827633"Drzwi"false)
guiSetFont(drzwi"default-bold-small")
maska guiCreateButton(30746827633"Maska"false)
guiSetFont(maska"default-bold-small")
bagaznik guiCreateButton(30736227633"Baga?nik"false)
guiSetFont(bagaznik"default-bold-small")    
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)

function wybory()
if source == silnik then
    triggerServerEvent("silnik"localPlayer)
elseif source == reczny then
    triggerServerEvent("r?czny"localPlayer)
elseif source == swiatla then
    triggerServerEvent("?wiat?a"localPlayer)
elseif source == drzwi then
    triggerServerEvent("drzwi"localPlayer)
elseif source == maska then
    triggerServerEvent("maska"localPlayer)
elseif source == bagaznik then
    triggerServerEvent("baga?nik"localPlayer)
end
end
addEventHandler("onClientGUIClick",silnik,wybory)
addEventHandler("onClientGUIClick",reczny,wybory)
addEventHandler("onClientGUIClick",swiatla,wybory)
addEventHandler("onClientGUIClick",drzwi,wybory)
addEventHandler("onClientGUIClick",maska,wybory)
addEventHandler("onClientGUIClick",bagaznik,wybory)
  
function otworz()
local veh getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleController(veh) ~= localPlayer then return end
if not getElementData(localPlayer,"shift"then
setElementData(localPlayer,"shift",true)
guiSetVisible(okno,true)
guiSetVisible(silnik,true)
guiSetVisible(reczny,true)
guiSetVisible(swiatla,true)
guiSetVisible(drzwi,true)
guiSetVisible(maska,true)
guiSetVisible(bagaznik,true)
showCursor(true)
else
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)
setElementData(localPlayer,"shift",false)
showCursor(false)
end
end
bindKey("lshift""down"otworz)
bindKey("lshift""up"otworz)



Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 19:40


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5


addEventHandler("onClientGUIClick",silnik,wybory)
addEventHandler("onClientGUIClick",reczny,wybory)
addEventHandler("onClientGUIClick",swiatla,wybory)
addEventHandler("onClientGUIClick",drzwi,wybory)
addEventHandler("onClientGUIClick",maska,wybory)
addEventHandler("onClientGUIClick",bagaznik,wybory)

Zamie? te 5 linii na jedn?:

addEventHandler("onClientGUIClick"getRootElement(), wybory)

W razie dalszych problem?w podaj db3



@edit
Po za tym GUI b?dzie wy?wietlane poprawnie tylko na twojej rozdzielczo?ci, jak chcesz to mog? ci wyskalowa?.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
sasik12
Wysłany: 2017-07-23, 20:05


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Jak mo?esz to wyskaluj i wyt?umacz jak to sie robi jak mozesz .

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 20:18


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

A teraz normalnie dzia?a kod?

Wyskalowane GUI:

local sxsy guiGetScreenSize()

okno guiCreateStaticImage(0.190.290.650.41"interakcja.png"true)
silnik guiCreateButton(sx*307/1366sy*253/768sx*271/1366sy*32/768"Silnik"false)
guiSetFont(silnik"default-bold-small")
reczny guiCreateButton(sx*824/1366sy*253/768sx*271/1366sy*32/768"R?czny"false)
guiSetFont(reczny"default-bold-small")
swiatla guiCreateButton(sx*824/1366sy*362/768sx*276/1366sy*33/768"?wiat?a"false)
guiSetFont(swiatla"default-bold-small")
drzwi guiCreateButton(sx*824/1366sy*468/768sx*276/1366sy*33/768"Drzwi"false)
guiSetFont(drzwi"default-bold-small")
maska guiCreateButton(sx*307/1366sy*468/768sx*276/1366sy*33/768"Maska"false)
guiSetFont(maska"default-bold-small")
bagaznik guiCreateButton(sx*307/1366sy*362/768sx*276/1366sy*33/768"Baga?nik"false)
guiSetFont(bagaznik"default-bold-small")    
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)

function wybory()
if source == silnik then
    triggerServerEvent("silnik"localPlayer)
elseif source == reczny then
    triggerServerEvent("r?czny"localPlayer)
elseif source == swiatla then
    triggerServerEvent("?wiat?a"localPlayer)
elseif source == drzwi then
    triggerServerEvent("drzwi"localPlayer)
elseif source == maska then
    triggerServerEvent("maska"localPlayer)
elseif source == bagaznik then
    triggerServerEvent("baga?nik"localPlayer)
end
end
addEventHandler("onClientGUIClick"getRootElement ( ) ,wybory)
  
function otworz()
local veh getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleController(veh) ~= localPlayer then return end
if not getElementData(localPlayer,"shift"then
setElementData(localPlayer,"shift",true)
guiSetVisible(okno,true)
guiSetVisible(silnik,true)
guiSetVisible(reczny,true)
guiSetVisible(swiatla,true)
guiSetVisible(drzwi,true)
guiSetVisible(maska,true)
guiSetVisible(bagaznik,true)
showCursor(true)
else
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)
setElementData(localPlayer,"shift",false)
showCursor(false)
end
end
bindKey("lshift""down"otworz)
bindKey("lshift""up"otworz)


Skalowanie masz opisane tutaj:

Więcej informacji znajdziesz w Wikipedii MTA:

guiGetScreenSize



Sory jak b?dzie jaki? b??d ale pisa?em to 15 minut na telefonie :-?

Ostatnio zmieniony przez neku^ 2017-07-23, 20:23, w całości zmieniany 3 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 20:19


Artystek







Wiek: 23
Na forum: 3520 dni
Posty: 143
Nick w MP: Artystek

Piwa: 74

Respekt: 55,3

W GUI Editor jest taka opcja przy tworzeniu GUI "Output type" i tutaj nale?y zaznaczy? "relative", aby wy?wietla?o si? dobrze na ka?dej rozdzielczo?ci.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 20:20


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Nie zawsze b?dziesz robi? GUI w edytorze :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 20:21


Artystek







Wiek: 23
Na forum: 3520 dni
Posty: 143
Nick w MP: Artystek

Piwa: 74

Respekt: 55,3

"dbn69" napisał/a:

A teraz normalnie dzia?a kod?

Wyskalowane GUI:

local screenWscreenH guiGetScreenSize()

okno guiCreateStaticImage(0.190.290.650.41"interakcja.png"true)
silnik guiCreateButton(sx*307/1366sy*253/768sx*271/1366sy*32/768"Silnik"true)
guiSetFont(silnik"default-bold-small")
reczny guiCreateButton(sx*824/1366sy*253/768sx*271/1366sy*32/768"R?czny"true)
guiSetFont(reczny"default-bold-small")
swiatla guiCreateButton(sx*824/1366sy*362/768sx*276/1366sy*33/768"?wiat?a"true)
guiSetFont(swiatla"default-bold-small")
drzwi guiCreateButton(sx*824/1366sy*468/768sx*276/1366sy*33/768"Drzwi"true)
guiSetFont(drzwi"default-bold-small")
maska guiCreateButton(sx*307/1366sy*468/768sx*276/1366sy*33/768"Maska"true)
guiSetFont(maska"default-bold-small")
bagaznik guiCreateButton(sx*307/1366sy*362/768sx*276/1366sy*33/768"Baga?nik"true)
guiSetFont(bagaznik"default-bold-small")    
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)

function wybory()
if source == silnik then
    triggerServerEvent("silnik"localPlayer)
elseif source == reczny then
    triggerServerEvent("r?czny"localPlayer)
elseif source == swiatla then
    triggerServerEvent("?wiat?a"localPlayer)
elseif source == drzwi then
    triggerServerEvent("drzwi"localPlayer)
elseif source == maska then
    triggerServerEvent("maska"localPlayer)
elseif source == bagaznik then
    triggerServerEvent("baga?nik"localPlayer)
end
end
addEventHandler("onClientGUIClick"getRootElement ( ) ,wybory)
  
function otworz()
local veh getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleController(veh) ~= localPlayer then return end
if not getElementData(localPlayer,"shift"then
setElementData(localPlayer,"shift",true)
guiSetVisible(okno,true)
guiSetVisible(silnik,true)
guiSetVisible(reczny,true)
guiSetVisible(swiatla,true)
guiSetVisible(drzwi,true)
guiSetVisible(maska,true)
guiSetVisible(bagaznik,true)
showCursor(true)
else
guiSetVisible(okno,false)
guiSetVisible(silnik,false)
guiSetVisible(reczny,false)
guiSetVisible(swiatla,false)
guiSetVisible(drzwi,false)
guiSetVisible(maska,false)
guiSetVisible(bagaznik,false)
setElementData(localPlayer,"shift",false)
showCursor(false)
end
end
bindKey("lshift""down"otworz)
bindKey("lshift""up"otworz)


Skalowanie masz opisane tutaj:

Więcej informacji znajdziesz w Wikipedii MTA:

guiGetScreenSize



Sory jak b?dzie jaki? b??d ale pisa?em to 15 minut na telefonie :-?


Zamiast sx, sy trzeba poda? screenW, screenH, poniewa? tak jest w localu podane, gdyby tam by?o sx,sy to mo?na by by?o zrobi? tak jak poda?e?.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
neku^
Wysłany: 2017-07-23, 20:49


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Nie dzia?aj? klawisze . Ze odpala silnik itp.

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 20:50


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

B??d w db3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 21:02


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Brak

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 21:14


Artystek







Wiek: 23
Na forum: 3520 dni
Posty: 143
Nick w MP: Artystek

Piwa: 74

Respekt: 55,3

Na pewno brak? Zobacz przy restarcie skryptu, klikaniu tych klawiszy itp.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-23, 21:40


sasik12







Wiek: 26
Na forum: 3763 dni
Posty: 182

Piwa: 7

Respekt: 60

Ju? po problemie , dzi?ki za pomoc :)

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Tagi: auto :: rozdzielczosc
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