Wysłany: 2017-07-23, 19:36
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
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 screenW , screenH = guiGetScreenSize ()
okno = guiCreateStaticImage ( 0.19 , 0.29 , 0.65 , 0.41 , "interakcja.png" , true )
silnik = guiCreateButton ( 307 , 253 , 271 , 32 , "Silnik" , false )
guiSetFont ( silnik , "default-bold-small" )
reczny = guiCreateButton ( 824 , 253 , 271 , 32 , "R?czny" , false )
guiSetFont ( reczny , "default-bold-small" )
swiatla = guiCreateButton ( 824 , 362 , 276 , 33 , "?wiat?a" , false )
guiSetFont ( swiatla , "default-bold-small" )
drzwi = guiCreateButton ( 824 , 468 , 276 , 33 , "Drzwi" , false )
guiSetFont ( drzwi , "default-bold-small" )
maska = guiCreateButton ( 307 , 468 , 276 , 33 , "Maska" , false )
guiSetFont ( maska , "default-bold-small" )
bagaznik = guiCreateButton ( 307 , 362 , 276 , 33 , "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.
Wysłany: 2017-07-23, 19:40
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
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?.
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
Jak mo?esz to wyskaluj i wyt?umacz jak to sie robi jak mozesz .
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2017-07-23, 20:18
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
A teraz normalnie dzia?a kod?
Wyskalowane GUI:
local sx , sy = guiGetScreenSize ()
okno = guiCreateStaticImage ( 0.19 , 0.29 , 0.65 , 0.41 , "interakcja.png" , true )
silnik = guiCreateButton ( sx * 307 / 1366 , sy * 253 / 768 , sx * 271 / 1366 , sy * 32 / 768 , "Silnik" , false )
guiSetFont ( silnik , "default-bold-small" )
reczny = guiCreateButton ( sx * 824 / 1366 , sy * 253 / 768 , sx * 271 / 1366 , sy * 32 / 768 , "R?czny" , false )
guiSetFont ( reczny , "default-bold-small" )
swiatla = guiCreateButton ( sx * 824 / 1366 , sy * 362 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "?wiat?a" , false )
guiSetFont ( swiatla , "default-bold-small" )
drzwi = guiCreateButton ( sx * 824 / 1366 , sy * 468 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "Drzwi" , false )
guiSetFont ( drzwi , "default-bold-small" )
maska = guiCreateButton ( sx * 307 / 1366 , sy * 468 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "Maska" , false )
guiSetFont ( maska , "default-bold-small" )
bagaznik = guiCreateButton ( sx * 307 / 1366 , sy * 362 / 768 , sx * 276 / 1366 , sy * 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:
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
Wysłany: 2017-07-23, 20:19
Artystek
Wiek: 23 Na forum: 3520 dni Posty: 143
Nick w MP: Artystek
Piwa : 74
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.
Wysłany: 2017-07-23, 20:20
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Nie zawsze b?dziesz robi? GUI w edytorze
Wysłany: 2017-07-23, 20:21
Artystek
Wiek: 23 Na forum: 3520 dni Posty: 143
Nick w MP: Artystek
Piwa : 74
"dbn69" napisał/a :A teraz normalnie dzia?a kod?
Wyskalowane GUI:
local screenW , screenH = guiGetScreenSize ()
okno = guiCreateStaticImage ( 0.19 , 0.29 , 0.65 , 0.41 , "interakcja.png" , true )
silnik = guiCreateButton ( sx * 307 / 1366 , sy * 253 / 768 , sx * 271 / 1366 , sy * 32 / 768 , "Silnik" , true )
guiSetFont ( silnik , "default-bold-small" )
reczny = guiCreateButton ( sx * 824 / 1366 , sy * 253 / 768 , sx * 271 / 1366 , sy * 32 / 768 , "R?czny" , true )
guiSetFont ( reczny , "default-bold-small" )
swiatla = guiCreateButton ( sx * 824 / 1366 , sy * 362 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "?wiat?a" , true )
guiSetFont ( swiatla , "default-bold-small" )
drzwi = guiCreateButton ( sx * 824 / 1366 , sy * 468 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "Drzwi" , true )
guiSetFont ( drzwi , "default-bold-small" )
maska = guiCreateButton ( sx * 307 / 1366 , sy * 468 / 768 , sx * 276 / 1366 , sy * 33 / 768 , "Maska" , true )
guiSetFont ( maska , "default-bold-small" )
bagaznik = guiCreateButton ( sx * 307 / 1366 , sy * 362 / 768 , sx * 276 / 1366 , sy * 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:
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?.
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
Nie dzia?aj? klawisze . Ze odpala silnik itp.
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2017-07-23, 20:50
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Wysłany: 2017-07-23, 21:02
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Brak
Podpis
Uczeń LUA . Mapper MTA.
Wysłany: 2017-07-23, 21:14
Artystek
Wiek: 23 Na forum: 3520 dni Posty: 143
Nick w MP: Artystek
Piwa : 74
Na pewno brak? Zobacz przy restarcie skryptu, klikaniu tych klawiszy itp.
Wysłany: 2017-07-23, 21:40
sasik12
Wiek: 26 Na forum: 3763 dni Posty: 182
Piwa : 7
Ju? po problemie , dzi?ki za pomoc
Podpis
Uczeń LUA . Mapper MTA.
Tagi: auto :: rozdzielczosc
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: