Wysłany: 2018-02-21, 15:02
Vxen
Wiek: 27 Na forum: 4086 dni Posty: 293
Piwa : 1299
Zrobi?em sobie panel no i chcia?em zrobi? lataj?ca kamer? podczas logowania i mam problem kto? mi podpowie gdzie mam da? smoothMoveCamera
local sw , sh = guiGetScreenSize ()
local w , h = ( sw / 1366 ), ( sh / 768 )
local gui = {
login = guiCreateEdit ( 0.39 , 0.29 , 0.23 , 0.08 , "" , true ),
pass = guiCreateEdit ( 0.39 , 0.51 , 0.23 , 0.08 , "" , true ),
}
function renderDX ()
dxDrawRectangle ( 475 * w , 132 * h , 417 * w , 504 * h , tocolor ( 0 , 0 , 0 , 180 ), false )
dxDrawLine ( 475 * w , 530 * h , 890 * w , 530 * h , tocolor ( 255 , 255 , 255 , 127 ), 1 , false )
dxDrawLine ( 475 * w , 583 * h , 890 * w , 583 * h , tocolor ( 255 , 255 , 255 , 127 ), 1 , false )
dxDrawText ( "Zaloguj si?" , 475 * w , 531 * h , 890 * w , 583 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "clear" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zarejestruj si?" , 475 * w , 584 * h , 890 * w , 636 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "clear" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Login:" , 527 * w , 191 * h , 839 * w , 225 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Has?o:" , 527 * w , 355 * h , 839 * w , 389 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
showGUI ( true )
fadeCamera ( true )
guiEditSetMasked ( gui . pass , true )
end )
addEvent ( "closePanel" , true )
addEventHandler ( "closePanel" , resourceRoot , function()
showGUI ( false )
end )
addEventHandler ( "onClientClick" , root , function( btn , state )
local login = guiGetText ( gui . login )
local pass = guiGetText ( gui . pass )
if guiGetVisible ( gui . login ) and guiGetVisible ( gui . pass ) then
if btn == "left" and state == "up" then
if isMouseInPosition ( 475 * w , 530 * h , 415 * w , 53 * h ) then
triggerServerEvent ( "tryLogin" , resourceRoot , login , pass )
elseif isMouseInPosition ( 475 * w , 583 * h , 415 * w , 53 * h ) then
if #login >= 3 and #pass >= 3 then
triggerServerEvent ( "tryRegister" , resourceRoot , login , pass )
else
outputChatBox ( "* Login i/lub has?o musz? mie? minimalnie 3 znaki!" )
end
end
end
end
end )
function showGUI ( value )
if value then
showCursor ( true )
setPlayerHudComponentVisible ( "all" , false )
s = playSound ( "files/intro.mp3" )
addEventHandler ( "onClientRender" , root , renderDX )
guiSetVisible ( gui . login , true )
guiSetVisible ( gui . pass , true )
else
showCursor ( false )
setPlayerHudComponentVisible ( "all" , true )
destroyElement ( s )
removeEventHandler ( "onClientRender" , root , renderDX )
guiSetVisible ( gui . login , false )
guiSetVisible ( gui . pass , false )
end
end
function isMouseInPosition ( x , y , width , height )
if not isCursorShowing () then return false end
local sx , sy = guiGetScreenSize ()
local cx , cy = getCursorPosition ()
local cx , cy = ( cx * sx ), ( cy * sy )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end
Wysłany: 2018-02-21, 16:26
TeeNekk
Cienzaruwka :v
Wiek: 23 Na forum: 3210 dni Posty: 264
Nick w MP: TeeNekk.
Piwa : 919
po;
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
Podpis
Pomogłem Ci
[you]
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Wysłany: 2018-02-21, 19:02
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
Vxen , z czego co widz? nie da?e? obowi?zkowego kodu do tej funkcji
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2018-02-21, 21:34
Vxen
Wiek: 27 Na forum: 4086 dni Posty: 293
Piwa : 1299
Zrobi?em lot kamery klikam zaloguj i kamera stoi local sm = {}
sm . moov = 0
sm . object1 , sm . object2 = nil , nil
local function removeCamHandler ()
if( sm . moov == 1 ) then
sm . moov = 0
end
end
local function camRender ()
if ( sm . moov == 1 ) then
local x1 , y1 , z1 = getElementPosition ( sm . object1 )
local x2 , y2 , z2 = getElementPosition ( sm . object2 )
setCameraMatrix ( x1 , y1 , z1 , x2 , y2 , z2 )
end
end
addEventHandler ( "onClientPreRender" , root , camRender )
function smoothMoveCamera ( x1 , y1 , z1 , x1t , y1t , z1t , x2 , y2 , z2 , x2t , y2t , z2t , time )
if( sm . moov == 1 ) then return false end
sm . object1 = createObject ( 1337 , x1 , y1 , z1 )
sm . object2 = createObject ( 1337 , x1t , y1t , z1t )
setElementAlpha ( sm . object1 , 0 )
setElementAlpha ( sm . object2 , 0 )
setObjectScale ( sm . object1 , 0.01 )
setObjectScale ( sm . object2 , 0.01 )
moveObject ( sm . object1 , time , x2 , y2 , z2 , 0 , 0 , 0 , "InOutQuad" )
moveObject ( sm . object2 , time , x2t , y2t , z2t , 0 , 0 , 0 , "InOutQuad" )
sm . moov = 1
setTimer ( removeCamHandler , time , 1 )
setTimer ( destroyElement , time , 1 , sm . object1 )
setTimer ( destroyElement , time , 1 , sm . object2 )
return true
end
local sw , sh = guiGetScreenSize ()
local w , h = ( sw / 1366 ), ( sh / 768 )
local gui = {
login = guiCreateEdit ( 0.39 , 0.29 , 0.23 , 0.08 , "" , true ),
pass = guiCreateEdit ( 0.39 , 0.51 , 0.23 , 0.08 , "" , true ),
}
function renderDX ()
dxDrawRectangle ( 475 * w , 132 * h , 417 * w , 504 * h , tocolor ( 0 , 0 , 0 , 180 ), false )
dxDrawLine ( 475 * w , 530 * h , 890 * w , 530 * h , tocolor ( 255 , 255 , 255 , 127 ), 1 , false )
dxDrawLine ( 475 * w , 583 * h , 890 * w , 583 * h , tocolor ( 255 , 255 , 255 , 127 ), 1 , false )
dxDrawText ( "Zaloguj si?" , 475 * w , 531 * h , 890 * w , 583 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "clear" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zarejestruj si?" , 475 * w , 584 * h , 890 * w , 636 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "clear" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Login:" , 527 * w , 191 * h , 839 * w , 225 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Has?o:" , 527 * w , 355 * h , 839 * w , 389 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
showGUI ( true )
fadeCamera ( true )
guiEditSetMasked ( gui . pass , true )
-- setCameraMatrix ( 2853.3491 , 1290.9038 , 11.3906 , 2846.6465 , 1290.6720 , 11.3906 )
smoothMoveCamera ( 2850.7278 , 1290.4128 , 11.3906 , 1468.388671875 , - 918.42474365234 , 99.881813049316 , 1500.8785400391 , - 919.25317382813 , 100.15346527 , 1500.388671875 , - 918.42474365234 , 99.881813049316 , 14000 , 14000 )
end )
addEvent ( "closePanel" , true )
addEventHandler ( "closePanel" , resourceRoot , function()
showGUI ( false )
end )
addEventHandler ( "onClientClick" , root , function( btn , state )
local login = guiGetText ( gui . login )
local pass = guiGetText ( gui . pass )
if guiGetVisible ( gui . login ) and guiGetVisible ( gui . pass ) then
if btn == "left" and state == "up" then
if isMouseInPosition ( 475 * w , 530 * h , 415 * w , 53 * h ) then
triggerServerEvent ( "tryLogin" , resourceRoot , login , pass )
elseif isMouseInPosition ( 475 * w , 583 * h , 415 * w , 53 * h ) then
if #login >= 3 and #pass >= 3 then
triggerServerEvent ( "tryRegister" , resourceRoot , login , pass )
else
outputChatBox ( "* Login i/lub has?o musz? mie? minimalnie 3 znaki!" )
end
end
end
end
end )
function showGUI ( value )
if value then
showCursor ( true )
setPlayerHudComponentVisible ( "all" , false )
s = playSound ( "files/intro.mp3" )
addEventHandler ( "onClientRender" , root , renderDX )
guiSetVisible ( gui . login , true )
guiSetVisible ( gui . pass , true )
else
showCursor ( false )
setPlayerHudComponentVisible ( "all" , true )
destroyElement ( s )
removeEventHandler ( "onClientRender" , root , renderDX )
guiSetVisible ( gui . login , false )
guiSetVisible ( gui . pass , false )
end
end
function isMouseInPosition ( x , y , width , height )
if not isCursorShowing () then return false end
local sx , sy = guiGetScreenSize ()
local cx , cy = getCursorPosition ()
local cx , cy = ( cx * sx ), ( cy * sy )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
return true
else
return false
end
end
Wysłany: 2018-02-21, 23:57
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
Vxen , kamera jest od startu skryptu a nie od kilku w zaloguj
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2018-02-22, 00:06
Vxen
Wiek: 27 Na forum: 4086 dni Posty: 293
Piwa : 1299
"Barcioo" napisał/a :Vxen , kamera jest od startu skryptu a nie od kilku w zaloguj
No ok ale jak klikam zaloguj si? to nie spawnuje mi gracza
Wysłany: 2018-02-22, 00:10
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
Więcej informacji znajdziesz w Wikipedii MTA: SpawnPlayer
[ Dodano : 2018-02-22, 00:13 ]
dodaj kod po stronie s
addEvent ( "spawnplayer" , true )
addEventHandler ( "spawnplayer" , getRootElement (),function( x , y , z )
spawnPlayer ( client , x , y , z )
end )
ten kod po kilku w zaloguj
triggerServerEvent ( "spawnplayer" , localPlayer , x , y , z )
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Tagi: smoothmovecamera
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: