Wysłany: 2017-09-27, 10:51
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
Dobry wszystkim. Ostatnio zacz??em troch? wi?cej czasu sp?dzam przy lua i napotka?em na jeden problem. Poniewa? robie Panel wyboru spawniu dla premium, ale niestety, ?adnego b??du w db3 nie ma. (Mo?e jakis by? przyk?ad na nowo)
local screenW , screenH = guiGetScreenSize ()
local sy , sx = guiGetScreenSize ()
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
function panelik_p ()
if not isMouseIn ( screenW * 0.2773 , screenH * 0.5056 , screenW * 0.1406 , screenH * 0.0625 ) then dxDrawRectangle ( screenW * 0.2773 , screenH * 0.5056 , screenW * 0.1406 , screenH * 0.0625 , tocolor ( 0 , 14 , 157 , 255 ), false )
end
dxDrawText ( "Tw?j dom" , screenW * 0.2820 , screenH * 0.5194 , screenW * 0.4125 , screenH * 0.5556 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default" , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( screenW * 0.2773 , screenH * 0.5056 , screenW * 0.1406 , screenH * 0.0625 ) then
setElementData ( localPlayer , "player:spawn" ,{ 1486.23 , - 1740.98 , 13.55 })
cusun ()
end
if isMouseIn ( screenW * 0.2773 , screenH * 0.5083 , screenW * 0.1406 , screenH * 0.0583 ) then
setElementData ( localPlayer , "player:spawn" ,{ 1486.23 , - 1740.98 , 13.55 })
cusun ()
end
if isMouseIn ( screenW * 0.2773 , screenH * 0.5083 , screenW * 0.1406 , screenH * 0.0583 ) then
local domek = getElementData ( localPlayer , "player:house" )
if not domek then
setElementData ( localPlayer , "player:spawn" ,{ 1486.23 , - 1740.98 , 13.55 })
outputChatBox ( "*Nie posiadasz domku" )
end
cusun ()
end
end
end )
function cusun ()
showCursor ( false )
removeEventHandler ( "onClientRender" , root , panelik_p )
end
i doda?em ten cusun, aby kasowa?o p??niej gui jak wybierze. Kto? co? poradzi, tak mo?e du?o b??d?w zrobi?em, ale si?y ju? na to nie mam.
Wysłany: 2017-09-27, 11:20
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
DylemaT929 , dok?adniej o co ci chodzi? jakie? b??dy?
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2017-09-27, 11:25
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
"BarteQ03" napisał/a :DylemaT929 , dok?adniej o co ci chodzi? jakie? b??dy?
Ten kod co widzisz wy?ej. Chce aby dzia?a? w ten spos?b ?e jak kliknie si? na dxa Urz?d to ?eby teleportowa?o do urz?du. Pokazuje mi si? myszka, ?adnych b??d?w nie ma ale jak klikn? w urz?d nie teleportuje.
a gdybym w taki spos?b zrobi? to za dzia?a ?
if not isMouseIn ( screenW * 0.2773 , screenH * 0.5056 , screenW * 0.1406 , screenH * 0.0625 ) then dxDrawRectangle ( screenW * 0.2773 , screenH * 0.5056 , screenW * 0.1406 , screenH * 0.0625 , tocolor ( 0 , 14 , 157 , 255 ), false ) else setElementPosition ( localPlayer , - 2757.34 , 371.16 , 4.35 )
end
Kolejny problem klikne F5 i od razu teleportuje. Jakie? rady
dxDrawText ( "Tw?j dom" , screenW * 0.2820 , screenH * 0.5194 , screenW * 0.4125 , screenH * 0.5556 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default" , "center" , "center" , false , false , false , false , false )
if isMouseIn ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 ) then dxDrawRectangle ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 , tocolor ( 0 , 14 , 157 , 255 ), false ) else setElementPosition ( localPlayer , 1482.14 , - 1749.36 , 15.45 )
end
Wysłany: 2017-09-27, 11:48
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
M?wisz o f5 a ja tu nigdzie bindkey nie widz? a setElementPosition daj przy evencie "onClientClick"
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Wysłany: 2017-09-27, 11:52
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
"BarteQ03" napisał/a :M?wisz o f5 a ja tu nigdzie bindkey nie widz? a setElementPosition daj przy evencie "onClientClick"
Masz ju?ci daje
local screenW , screenH = guiGetScreenSize ()
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * screenW , cy * screenH
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
function panelik_p ()
dxDrawText ( "Tw?j dom" , screenW * 0.2820 , screenH * 0.5194 , screenW * 0.4125 , screenH * 0.5556 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default" , "center" , "center" , false , false , false , false , false )
if isMouseIn ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 ) then dxDrawRectangle ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 , tocolor ( 0 , 14 , 157 , 255 ), false ) else setElementPosition ( localPlayer , 1482.14 , - 1749.36 , 15.45 )
end
end
function gui ()
if guiGetVisible ( button ) then
showCursor ( false )
removeEventHandler ( "onClientRender" , root , panelik_p )
guiSetVisible ( button , false )
else
addEventHandler ( "onClientRender" , root , panelik_p )
showCursor ( true , false )
guiSetVisible ( button , true )
end
end
bindKey ( "F5" , "down" , gui )
W taki spos?b
local screenW , screenH = guiGetScreenSize ()
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * screenW , cy * screenH
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
function panelik_p ()
dxDrawText ( "Tw?j dom" , screenW * 0.2820 , screenH * 0.5194 , screenW * 0.4125 , screenH * 0.5556 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default" , "center" , "center" , false , false , false , false , false )
if isMouseIn ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 ) then dxDrawRectangle ( screenW * 0.2773 , screenH * 0.5042 , screenW * 0.1406 , screenH * 0.0667 , tocolor ( 0 , 14 , 157 , 255 ), false ) else setElementPosition ( localPlayer , 1482.14 , - 1749.36 , 15.45 )
end
end
function gui ()
if guiGetVisible ( button ) then
showCursor ( false )
removeEventHandler ( "onClientRender" , root , panelik_p )
guiSetVisible ( button , false )
else
addEventHandler ( "onClientRender" , root , panelik_p )
showCursor ( true , false )
guiSetVisible ( button , true )
end
end
addEventHandler ( "onClientClick" , getRootElement (), panelik_p )
bindKey ( "F5" , "down" , gui )
Wysłany: 2017-09-27, 12:09
Avenged
Młodszy Szkrypter
Wiek: 23 Na forum: 3510 dni Posty: 654
Nick w MP: Avenged
Piwa : 1570
DylemaT929 , no tutaj masz zrobione tak ?e klikasz f5 otwiera ci gui i teleportuje odrazu. Jak wr?c? do domu to dam ci poprawny kod bo narazie jestem na tel. A dodaj w evencie (stw?rz funkcj? czy jak w pierwszym po?cie mia?e? tam onClientClick wtedy dopiero po klikni?ciu b?dzie Ci? teleportowa? a nie jak teraz po klikni?ciu f5
Podpis
LUA, JS, PHP
Zapraszam do skorzystania z moich usług: Klik
Tagi: dodany :: przycisk :: nie :: teleportuje
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: