Wysłany: 2021-05-22, 12:58
!ryzee
rebornMTA
Wiek: 19 Na forum: 2254 dni Posty: 111
Nick w MP: drakovskyy
Piwa : 55
Siemka u?ytkownicy! Mam problem, pobra?em jeden ze skrypt?w z GTAO, lecz GUI w nim nie jest raczej wyskalowane, gram na 640x480, rozdzielczo?ci z powod?w na wi?kszych drobnych ?cinek, czego nie lubi?.
Tak wygl?da GUI: https://imgur.com/a/6SZQKc3
KOD:
local screenW , screenH = guiGetScreenSize ()
window = guiCreateWindow ( 0.35 , 0.30 , 0.30 , 0.38 , "Ustawianie opisu" , true )
guiWindowSetSizable ( window , false )
label = guiCreateLabel ( 0.02 , 0.07 , 0.96 , 0.09 , "Znajdujesz si? w panelu do ustawiania opisu pojazdu, lub swojej postaci.\n Wystarczy ?e wpiszesz interesuj?cy Ci? opis i zatwierdzisz odpowiednim przyciskiem na dole." , true , window )
guiLabelSetHorizontalAlign ( label , "center" , false )
memo = guiCreateMemo ( 0.02 , 0.18 , 0.68 , 0.78 , "" , true , window )
combobox = guiCreateComboBox ( 0.71 , 0.19 , 0.26 , 0.17 , "Pojazd" , true , window )
guiComboBoxAddItem ( combobox , "Pojazd" ) -- 0
guiComboBoxAddItem ( combobox , "Posta?" ) -- 1
buttoncancel = guiCreateButton ( 0.71 , 0.88 , 0.28 , 0.08 , "Wyjd?" , true , window )
buttonmain = guiCreateButton ( 0.71 , 0.77 , 0.28 , 0.08 , "Ustaw opis" , true , window )
guiSetVisible ( window , false )
addCommandHandler ( "opis" , function()
if guiGetVisible ( window ) == true then
guiSetVisible ( window , false )
showCursor ( false )
removeEventHandler ( "onClientGUIClick" , buttonmain , main )
removeEventHandler ( "onClientGUIClick" , buttoncancel , cancel )
elseif guiGetVisible ( window ) == false then
guiSetVisible ( window , true )
showCursor ( true )
addEventHandler ( "onClientGUIClick" , buttonmain , main )
addEventHandler ( "onClientGUIClick" , buttoncancel , cancel )
end
end )
function cancel ()
guiSetVisible ( window , false )
showCursor ( false )
removeEventHandler ( "onClientGUIClick" , buttonmain , main )
removeEventHandler ( "onClientGUIClick" , buttoncancel , cancel )
end
function main ()
local item = guiComboBoxGetSelected ( combobox )
local itemname = guiComboBoxGetItemText ( combobox , item )
local description = guiGetText ( memo )
if itemname == "Posta?" then
if description == "" then
setElementData ( localPlayer , "player:desc" , "" )
else
setElementData ( localPlayer , "player:desc" , description )
end
guiSetVisible ( window , false )
showCursor ( false )
removeEventHandler ( "onClientGUIClick" , buttonmain , main )
removeEventHandler ( "onClientGUIClick" , buttoncancel , cancel )
elseif itemname == "Pojazd" then
local vehicle = getPedOccupiedVehicle ( localPlayer )
if not vehicle then return outputChatBox ( "Nie znajdujesz si? w samochodzie, do kt?rego chcesz da? opis!" ) end
if description == "" then
setElementData ( vehicle , "vehicle:desc" , "" )
else
setElementData ( vehicle , "vehicle:desc" , description )
end
guiSetVisible ( window , false )
showCursor ( false )
removeEventHandler ( "onClientGUIClick" , buttonmain , main )
removeEventHandler ( "onClientGUIClick" , buttoncancel , cancel )
end
end
addEventHandler ( "onClientRender" , root , function()
local cmX , cmY , cmZ = getCameraMatrix ()
for i , v in ipairs ( getElementsByType ( "vehicle" , root )) do
local description = getElementData ( v , "vehicle:desc" )
if description then
local x , y , z = getElementPosition ( v )
local distance = getDistanceBetweenPoints3D ( cmX , cmY , cmZ , x , y , z )
if distance <= 20 then
local wpX , wpY = getScreenFromWorldPosition ( x , y , z , 200 )
if wpX and wpY then
dxDrawText ( description , wpX -( screenW / 5 ), wpY , wpX +( screenW / 5 ), wpY , tocolor ( 255 , 255 , 255 , 255 ), 1 , "default-bold" , "center" , "center" )
end
end
end
end
for i , v in ipairs ( getElementsByType ( "player" , root )) do
local description = getElementData ( v , "player:desc" )
if description then
local x , y , z = getElementPosition ( v )
local distance = getDistanceBetweenPoints3D ( cmX , cmY , cmZ , x , y , z )
if distance <= 20 then
local wpX , wpY = getScreenFromWorldPosition ( x , y , z , 200 )
if wpX and wpY then
dxDrawText ( description , wpX -( screenW / 5 ), wpY , wpX +( screenW / 5 ), wpY , tocolor ( 240 , 86 , 255 , 255 ), 0.8 , "default-bold" , "center" , "center" , false , true )
end
end
end
end
end )
Wysłany: 2021-05-22, 13:40
NewStories
Wiek: 22 Na forum: 2639 dni Posty: 65
Nick w MP: Dobrich
Piwa : 4
dostosowanie gui pod taka rozdzialke mija sie z celem nikt na takiej juz nie gra + ciezko wyskalowac gui tak by bylo zgodne z 1920x1080 i 640x480, jasne jest to mozliwe, ale czy warto?
Wysłany: 2021-05-22, 18:08
Matikmontana
Modern Stories
Wiek: 22 Na forum: 2473 dni Posty: 423
Nick w MP: Mazeusz*
Piwa : 1015
Naprawd? nie da si? gra? na wy?szych rozdzielczo?ciach typu 1024x768, ja bym radzi? zmieni? komputer. Na moim 9 letnim laptopie w 1366x768 MTA chodzi?o na 30FPS. Samo gui jest ju? przeskalowane za pomoc? relative.
Wysłany: 2021-05-22, 19:56
xyzzz^
A nic
Wiek: 18 Na forum: 1993 dni Posty: 319
Nick w MP: Aspyk21
Piwa : 308
Same GTA SA ma wymagania no... szczerze takie s?abe, ?e nawet z?om je uci?gnie [ gta na steam ]
Je?li nie mo?esz gra? minimalnie na 1000x500 (itd) to nawet za tworzenie serwer?w.
Co do tego GUI, pewnie ma u?yte z?e skalowanie, pomijaj?c fakt nie jest mo?liwe, ?e 1920x1080 na 640x480 b?dzie przeskalowane
Tagi: skalowanie :: gui
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: