wojakmati
Wiek: 28 Na forum: 3434 dni Posty: 8
Nick w MP: AlabamaJustice
witam mam problem z mechem,a mianowicie gdy w wchodze w punkt mam klik?? w auto ale nic si? nie dziejie jak klikam
Oto kod
removeWorldModel ( 11360 , 5 , - 2038.873046875 , 169.986328125 , 28.839275360107 )
removeWorldModel ( 11359 , 5 , - 2052.7578125 , 150.462890625 , 28.8359375 )
removeWorldModel ( 11416 , 5 , - 2026.716796875 , 129.830078125 , 28.842931747437 )
removeWorldModel ( 11327 , 5 , - 2026.9326171875 , 129.833984375 , 28.842931747437 )
local kolizja = engineLoadCOL ( "collision.col" )
engineReplaceCOL ( kolizja , 11387 )
local punkty = {
{ 2169.37 , - 2166.21 , 13.55 },
{ 2168.14 , - 2164.38 , 13.55 },
{ 2169.14 , - 2164.38 , 13.55 },
}
for i , v in ipairs ( punkty ) do
createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 0.9 , "cylinder" , 1 , 0 , 0 , 255 , 75 )
end
addEventHandler ( "onClientMarkerHit" , resourceRoot , function( hit ) if hit ~= localPlayer then return end setElementData ( hit , "mechanik" , true ) showCursor ( true , false ) km = true exports [ "nm-noti" ]: noti ( "Aby w??czy? panel naprawy kliknij na pojazd." ) end )
addEventHandler ( "onClientMarkerLeave" , resourceRoot , function( hit ) if hit ~= localPlayer then return end setElementData ( hit , "mechanik" , false ) showCursor ( false ) km = false end )
local text = "Pojazd jest w niskim stanie techniczym (50%)\nCena naprawy wyniesie 150.15 PLN\nAby naprawi? pojazd Banshee kliknij przycisk 'Napraw'."
local cena = false
local pojazd = false
local cuboid = createColCuboid ( 2164.82 , - 2164.44 , 13.55 , 1005 , 7000 , 50000 )
local cuboid2 = createColCuboid ( 2164.82 , - 2164.44 , 13.55 , 15 , 7 , 5 )
local screenW , screenH = guiGetScreenSize ()
local sx , sy = guiGetScreenSize ()
function mysz ( 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
local text = false
local czcionka = dxCreateFont ( ":nm-scoreboard/czcionka.ttf" , 8 )
if not czcionka then czcionka = "default-bold" end
function gui ()
exports [ "nm-blur" ]: dxDrawBluredRectangle ( screenW * 0.3572 , screenH * 0.2813 , screenW * 0.2862 , screenH * 0.2461 , tocolor ( 150 , 150 , 150 , 255 ))
dxDrawRectangle ( screenW * 0.3565 , screenH * 0.2786 , screenW * 0.2870 , screenH * 0.0521 , tocolor ( 25 , 75 , 125 , 155 ), false )
dxDrawText ( "Panel naprawy pojazd?w" , ( screenW * 0.3565 ) + 1 , ( screenH * 0.2786 ) + 1 , ( screenW * 0.6435 ) + 1 , ( screenH * 0.3307 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Panel naprawy pojazd?w" , screenW * 0.3565 , screenH * 0.2786 , screenW * 0.6435 , screenH * 0.3307 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( text , ( screenW * 0.3638 ) + 1 , ( screenH * 0.3385 ) + 1 , ( screenW * 0.6318 ) + 1 , ( screenH * 0.4466 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( text , screenW * 0.3638 , screenH * 0.3385 , screenW * 0.6318 , screenH * 0.4466 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
if mysz ( screenW * 0.3638 , screenH * 0.4570 , screenW * 0.1318 , screenH * 0.0573 ) then
dxDrawRectangle ( screenW * 0.3638 , screenH * 0.4570 , screenW * 0.1318 , screenH * 0.0573 , tocolor ( 25 , 75 , 125 , 180 ), false )
else
dxDrawRectangle ( screenW * 0.3638 , screenH * 0.4570 , screenW * 0.1318 , screenH * 0.0573 , tocolor ( 25 , 75 , 125 , 125 ), false )
end
if mysz ( screenW * 0.4985 , screenH * 0.4570 , screenW * 0.1332 , screenH * 0.0586 ) then
dxDrawRectangle ( screenW * 0.4985 , screenH * 0.4570 , screenW * 0.1332 , screenH * 0.0586 , tocolor ( 25 , 75 , 125 , 180 ), false )
else
dxDrawRectangle ( screenW * 0.4985 , screenH * 0.4570 , screenW * 0.1332 , screenH * 0.0586 , tocolor ( 25 , 75 , 125 , 125 ), false )
end
dxDrawText ( "Napraw pojazd" , ( screenW * 0.3638 ) + 1 , ( screenH * 0.4557 ) + 1 , ( screenW * 0.4956 ) + 1 , ( screenH * 0.5143 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Napraw pojazd" , screenW * 0.3638 , screenH * 0.4557 , screenW * 0.4956 , screenH * 0.5143 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zamknij panel" , ( screenW * 0.4985 ) + 1 , ( screenH * 0.4557 ) + 1 , ( screenW * 0.6318 ) + 1 , ( screenH * 0.5156 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zamknij panel" , screenW * 0.4985 , screenH * 0.4557 , screenW * 0.6318 , screenH * 0.5156 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientClick" , getRootElement (), function ( button , state , _ , _ , _ , _ , _ , cw )
if not cw or button ~= "left" or state ~= "down" then return end
if getElementType ( cw ) ~= "vehicle" then return end
if isElementWithinColShape ( cw , cuboid ) or isElementWithinColShape ( cw , cuboid2 ) then
if not text == false then return end
if getElementData ( localPlayer , "mechanik" ) ~= true then return end
local zycie = getElementHealth ( cw )/ 10
if zycie == 100 then
exports [ "nm-noti" ]: noti ( "Ten pojazd jest sprawny." )
return
end
addEventHandler ( "onClientPreRender" , root , gui )
local stan = "dobrym"
local zycie = getElementHealth ( cw )/ 10
local grosz = math . random ( 0 , 10 )
if zycie > 3 and zycie <= 25 then
cena = "500." .. grosz
stan = "bardzo niskim"
elseif zycie > 25 and zycie <= 50 then
cena = "350." .. grosz
stan = "niskim"
elseif zycie > 50 and zycie <= 75 then
cena = "200." .. grosz
stan = "?rednim"
elseif zycie > 75 and zycie <= 85 then
cena = "100." .. grosz
stan = "dobrym"
elseif zycie > 85 and zycie <= 100 then
cena = "50." .. grosz
stan = "bardzo dobrym"
end
cena = string . format ( "%1.2f" , cena )
local nstan = string . format ( "%1d" , zycie )
pojazd = cw
local np = getVehicleName ( cw )
text = "Pojazd jest w " .. stan .. " stanie techniczym (" .. nstan .. "%)\nCena naprawy wyniesie " .. cena .. " PLN\nAby naprawi? pojazd " .. np .. " kliknij przycisk 'Napraw'."
showCursor ( true , false )
end
end )
addEventHandler ( "onClientClick" , root , function( button , state )
if button ~= "state" and state ~= "down" then return end
if mysz ( screenW * 0.3638 , screenH * 0.4570 , screenW * 0.1318 , screenH * 0.0573 ) and text ~= false then
local hajs = getElementData ( localPlayer , "pieniadze" )
hajs = string . format ( "%1.2f" , hajs )
hajs = tonumber ( hajs )
if hajs > tonumber ( cena ) then
showCursor ( false )
removeEventHandler ( "onClientPreRender" , root , gui )
exports [ "nm-noti" ]: noti ( "Naprawi?e? pojazd " .. getVehicleName ( pojazd ).. " za cene " .. cena .. " PLN." )
triggerServerEvent ( "i:napraw" , localPlayer , pojazd )
setElementData ( localPlayer , "pieniadze" , hajs - cena )
text = false
else
exports [ "nm-noti" ]: noti ( "Potrzebujesz " .. cena .. " PLN aby naprawi? pojazd, masz " .. hajs .. " PLN." )
showCursor ( false )
text = false
removeEventHandler ( "onClientPreRender" , root , gui )
end
elseif mysz ( screenW * 0.4985 , screenH * 0.4570 , screenW * 0.1332 , screenH * 0.0586 ) and text ~= false then
removeEventHandler ( "onClientPreRender" , root , gui )
showCursor ( false )
text = false
end
end )
Ostatnio zmieniony przez _Haze 2017-08-08, 13:12, w całości zmieniany 1 raz