Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Witam posiadam skrypt na mechanika z serwera BackToRPG , na pocz?tku wszystko dzia?a?o okej lecz teraz nie zabiera pieni?dzy graczowi za naprawion? cz??? , moja podstawa to pys 3.0 tak jak na BackToRPG.
skrypt c.lua
local sx , sy = guiGetScreenSize ()
local px , py = ( sx / 1920 ),( sy / 1080 )
local font = dxCreateFont ( "cz.ttf" , 12 )
local normal15 = dxCreateFont ( "normal.ttf" , 15 )
local normal18 = dxCreateFont ( "normal.ttf" , 18 )
local naprawiany_pojazd = false
local okno1 = false
local okno2 = false
local okno3 = false
local okno4 = false
function shadowText ( text , x , y , w , h , color , size , font , xx , yy , x1 , x2 , x3 , x4 , x5 )
dxDrawText ( text , x + 1 , y + 1 , w + 1 , h + 1 , tocolor ( 0 , 0 , 0 ), size , font , xx , yy , x1 , x2 , x3 , x4 , x5 )
dxDrawText ( text , x , y , w , h , color , size , font , xx , yy , x1 , x2 , x3 , x4 , x5 )
end
createBlip (- 328.82 , 804.52 , 17.94 , 27 , 0 , 0 , 0 , 275 )
local stanowiska = {
-- LV G ?? wny mechanik
{- 315.35 , 804.62 , 17.94 , 5 },
{- 328.82 , 804.52 , 17.94 , 5 },
{- 342.47 , 804.09 , 17.94 , 5 },
}
for i , v in ipairs ( stanowiska ) do
marker = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 5 , "cylinder" , v [ 4 ], 0 , 0 , 0 , 80 )
addEventHandler ( "onClientMarkerHit" , marker , function( gracz )
if gracz ~= localPlayer then return end
local pojazd = getPedOccupiedVehicle ( localPlayer )
if not pojazd then return end
if getVehicleController ( pojazd ) ~= localPlayer then return end
if isElement ( naprawa1 ) then
destroyElement ( naprawa1 )
end
if isElement ( naprawa2 ) then
destroyElement ( naprawa2 )
end
if isElement ( naprawa3 ) then
destroyElement ( naprawa3 )
end
if isElement ( naprawa4 ) then
destroyElement ( naprawa4 )
end
local x , y , z = getElementPosition ( pojazd )
naprawa1 = createMarker ( x , y , z - 2 , "cylinder" , 1.5 , 245 , 119 , 4 , 255 )
addEventHandler ( "onClientMarkerHit" , naprawa1 , naprawaprzod )
naprawa2 = createMarker ( x , y , z - 2 , "cylinder" , 1.5 , 245 , 119 , 4 , 255 )
addEventHandler ( "onClientMarkerHit" , naprawa2 , naprawatyl )
naprawa3 = createMarker ( x , y , z - 2 , "cylinder" , 1.5 , 245 , 119 , 4 , 255 )
addEventHandler ( "onClientMarkerHit" , naprawa3 , naprawaprawy )
naprawa4 = createMarker ( x , y , z - 2 , "cylinder" , 1.5 , 245 , 119 , 4 , 255 )
addEventHandler ( "onClientMarkerHit" , naprawa4 , naprawalewy )
setElementData ( naprawa1 , "naprawianypojazd" , pojazd )
setElementData ( naprawa2 , "naprawianypojazd" , pojazd )
setElementData ( naprawa3 , "naprawianypojazd" , pojazd )
setElementData ( naprawa4 , "naprawianypojazd" , pojazd )
attachElements ( naprawa1 , pojazd , 0 , 3.3 , - 0.6 - 1.1 )
attachElements ( naprawa2 , pojazd , 0 , - 3.3 , - 0.6 - 1.1 )
attachElements ( naprawa3 , pojazd , 2 , 0 , - 0.6 - 1.1 )
attachElements ( naprawa4 , pojazd , - 2 , 0 , - 0.6 - 1.1 )
setElementData ( pojazd , "naprawiany" , true )
end )
addEventHandler ( "onClientMarkerLeave" , marker , function( gracz )
if gracz ~= localPlayer then return end
local pojazd = getPedOccupiedVehicle ( localPlayer )
if not pojazd then return end
if getVehicleController ( pojazd ) ~= localPlayer then return end
if isElement ( naprawa1 ) then
destroyElement ( naprawa1 )
end
if isElement ( naprawa2 ) then
destroyElement ( naprawa2 )
end
if isElement ( naprawa3 ) then
destroyElement ( naprawa3 )
end
if isElement ( naprawa4 ) then
destroyElement ( naprawa4 )
end
end )
end
-- przod
local czesciprzod = {
{ "Silnik" , 1 , 3000 , "engine_icon" },
{ "Maska" , 2 , 1500 , "hood_icon" },
{ "Szyba przednia" , 8 , 1500 , "front_glass_icon" },
{ "Zderzak przedni" , 9 , 1500 , "front_bumper_icon" },
{ "?wiat?o lewy prz?d" , 11 , 1500 , "light_icon" },
{ "?wiat?o prawy prz?d" , 12 , 1500 , "light_icon" },
}
function sprawdz_czesc1 ( czesc )
if czesc == 1 then
if getElementHealth ( naprawiany_pojazd ) > 1000 then
return true
else
return false
end
elseif czesc == 2 then
if getVehicleDoorState ( naprawiany_pojazd , 0 ) == 0 then
return true
else
return false
end
elseif czesc == 8 then
if getVehiclePanelState ( naprawiany_pojazd , 4 ) == 0 then
return true
else
return false
end
elseif czesc == 9 then
if getVehiclePanelState ( naprawiany_pojazd , 5 ) == 0 then
return true
else
return false
end
elseif czesc == 11 then
if getVehicleLightState ( naprawiany_pojazd , 0 ) == 0 then
return true
else
return false
end
elseif czesc == 12 then
if getVehicleLightState ( naprawiany_pojazd , 1 ) == 0 then
return true
else
return false
end
end
end
local grid1 = { }
function naprawaprzod ( gracz )
if gracz ~= localPlayer then return end
if getPedOccupiedVehicle ( localPlayer ) then return end
naprawiany_pojazd = getElementData ( source , "naprawianypojazd" )
for i , v in ipairs ( czesciprzod ) do
if sprawdz_czesc1 ( tonumber ( v [ 2 ])) ~= true then
table . insert ( grid1 , { 1 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ]})
end
end
okno1 = true
addEventHandler ( "onClientRender" , root , gui1 )
showCursor ( true )
setElementFrozen ( localPlayer , true )
end
function gui1 ()
dxDrawImage ( 610 * px , 260 * py , 700 * px , 555 * py , "grafiki/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Naprawanie cze?ci z przodu" , 980 * px , 320 * py , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal18 , "center" , "center" , false , false , false , false , false )
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) then
dxDrawImage ( 1259 * px , 274 * py , 27 * px , 27 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
else
dxDrawImage ( 1260 * px , 275 * py , 25 * px , 25 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
end
for i , v in ipairs ( grid1 ) do
local dodatekY = ( 75 * py )*( i - 1 )
local dodatekY2 = ( 150 * py )*( i - 1 )
dxDrawRectangle ( 650 * px , 337 * py + dodatekY , 625 * px , 70 * py , tocolor ( 50 , 50 , 50 , 120 ), false )
dxDrawImage ( 670 * px , 342 * py + dodatekY , 60 * px , 60 * py , "grafiki/" .. v [ 5 ].. ".png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
shadowText ( v [ 2 ], 750 * px , 430 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
shadowText ( "Cena naprawy: " .. v [ 4 ].. " PLN" , 750 * px , 493 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) then
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons_on.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 220 , 220 , 220 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
else
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
end
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
for i , v in ipairs ( grid1 ) do
local dodatekY = ( scale_y ( 63 ))*( i - 1 )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) and okno1 == true then
local hajs = getPlayerMoney ( localPlayer ) or 0
if hajs >= tonumber ( v [ 4 ]) then
exports [ "np-notyfikacje" ]: noti ( "Naprawi?e? " .. v [ 2 ].. " za " .. v [ 4 ].. " PLN" )
table . remove ( grid1 , i )
triggerServerEvent ( "napraw:czesc" , localPlayer , naprawiany_pojazd , v [ 3 ])
triggerServerEvent ( "bier:kasemech" , localPlayer , tonumber ( v [ 4 ]))
else
exports [ "np-notyfikacje" ]: noti ( "Niestac ci? na naprawe tej cz??ci" , "error" )
end
end
end
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) and okno1 == true then
removeEventHandler ( "onClientRender" , root , gui1 )
okno1 = false
showCursor ( false )
grid1 = { }
setElementFrozen ( localPlayer , false )
end
end
end )
-- tyl
local czescityl = {
{ "Baga?nik" , 3 , 1500 , "trunk_icon" },
{ "Zderzak tylni" , 10 , 1500 , "rear_bumper_icon" },
}
function sprawdz_czesc2 ( czesc )
if czesc == 3 then
if getVehicleDoorState ( naprawiany_pojazd , 1 ) == 0 then
return true
else
return false
end
elseif czesc == 10 then
if getVehiclePanelState ( naprawiany_pojazd , 6 ) == 0 then
return true
else
return false
end
end
end
local grid2 = { }
function naprawatyl ( gracz )
if gracz ~= localPlayer then return end
if getPedOccupiedVehicle ( localPlayer ) then return end
naprawiany_pojazd = getElementData ( source , "naprawianypojazd" )
for i , v in ipairs ( czescityl ) do
if sprawdz_czesc2 ( tonumber ( v [ 2 ])) ~= true then
table . insert ( grid2 , { 1 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ]})
end
end
okno2 = true
addEventHandler ( "onClientRender" , root , gui2 )
showCursor ( true )
setElementFrozen ( localPlayer , true )
end
function gui2 ()
dxDrawImage ( 610 * px , 260 * py , 700 * px , 555 * py , "grafiki/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Naprawanie cze?ci z ty?u" , 980 * px , 320 * py , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal18 , "center" , "center" , false , false , false , false , false )
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) then
dxDrawImage ( 1259 * px , 274 * py , 27 * px , 27 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
else
dxDrawImage ( 1260 * px , 275 * py , 25 * px , 25 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
end
for i , v in ipairs ( grid2 ) do
local dodatekY = ( 75 * py )*( i - 1 )
local dodatekY2 = ( 150 * py )*( i - 1 )
dxDrawRectangle ( 650 * px , 337 * py + dodatekY , 625 * px , 70 * py , tocolor ( 50 , 50 , 50 , 120 ), false )
dxDrawImage ( 670 * px , 342 * py + dodatekY , 60 * px , 60 * py , "grafiki/" .. v [ 5 ].. ".png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
shadowText ( v [ 2 ], 750 * px , 430 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
shadowText ( "Cena naprawy: " .. v [ 4 ].. " PLN" , 750 * px , 493 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) then
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons_on.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 220 , 220 , 220 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
else
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
end
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
for i , v in ipairs ( grid2 ) do
local dodatekY = ( scale_y ( 63 ))*( i - 1 )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) and okno2 == true then
local hajs = getPlayerMoney ( localPlayer ) or 0
if hajs >= tonumber ( v [ 4 ]) then
exports [ "np-notyfikacje" ]: noti ( "Naprawi?e? " .. v [ 2 ].. " za " .. v [ 4 ].. " PLN" )
table . remove ( grid2 , i )
triggerServerEvent ( "napraw:czesc" , localPlayer , naprawiany_pojazd , v [ 3 ])
triggerServerEvent ( "bier:kasemech" , localPlayer , tonumber ( v [ 4 ]))
else
exports [ "np-notyfikacje" ]: noti ( "Niestac ci? na naprawe tej cz??ci" , "error" )
end
end
end
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) and okno2 == true then
removeEventHandler ( "onClientRender" , root , gui2 )
okno2 = false
showCursor ( false )
grid2 = { }
setElementFrozen ( localPlayer , false )
end
end
end )
-- lewa strona
local czescilewa = {
{ "Drzwi lewy prz?d" , 4 , 1500 , "door_car_icon" },
{ "Drzwi lewy ty?" , 6 , 1500 , "door_car_icon" },
}
function sprawdz_czesc3 ( czesc )
if czesc == 4 then
if getVehicleDoorState ( naprawiany_pojazd , 2 ) == 0 then
return true
else
return false
end
elseif czesc == 6 then
if getVehicleDoorState ( naprawiany_pojazd , 4 ) == 0 then
return true
else
return false
end
end
end
local grid3 = { }
function naprawalewy ( gracz )
if gracz ~= localPlayer then return end
naprawiany_pojazd = getElementData ( source , "naprawianypojazd" )
if getPedOccupiedVehicle ( localPlayer ) then return end
for i , v in ipairs ( czescilewa ) do
if sprawdz_czesc3 ( tonumber ( v [ 2 ])) ~= true then
table . insert ( grid3 , { 1 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ]})
end
end
okno3 = true
addEventHandler ( "onClientRender" , root , gui3 )
showCursor ( true )
setElementFrozen ( localPlayer , true )
end
function gui3 ()
dxDrawImage ( 610 * px , 260 * py , 700 * px , 555 * py , "grafiki/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Naprawanie cze?ci z lewej strony" , 980 * px , 320 * py , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal18 , "center" , "center" , false , false , false , false , false )
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) then
dxDrawImage ( 1259 * px , 274 * py , 27 * px , 27 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
else
dxDrawImage ( 1260 * px , 275 * py , 25 * px , 25 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
end
for i , v in ipairs ( grid3 ) do
local dodatekY = ( 75 * py )*( i - 1 )
local dodatekY2 = ( 150 * py )*( i - 1 )
dxDrawRectangle ( 650 * px , 337 * py + dodatekY , 625 * px , 70 * py , tocolor ( 50 , 50 , 50 , 120 ), false )
dxDrawImage ( 670 * px , 342 * py + dodatekY , 60 * px , 60 * py , "grafiki/" .. v [ 5 ].. ".png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
shadowText ( v [ 2 ], 750 * px , 430 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
shadowText ( "Cena naprawy: " .. v [ 4 ].. " PLN" , 750 * px , 493 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) then
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons_on.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 220 , 220 , 220 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
else
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
end
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
for i , v in ipairs ( grid3 ) do
local dodatekY = ( scale_y ( 63 ))*( i - 1 )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) and okno3 == true then
local hajs = getPlayerMoney ( localPlayer ) or 0
if hajs >= tonumber ( v [ 4 ]) then
exports [ "np-notyfikacje" ]: noti ( "Naprawi?e? " .. v [ 2 ].. " za " .. v [ 4 ].. " PLN" )
table . remove ( grid3 , i )
triggerServerEvent ( "napraw:czesc" , localPlayer , naprawiany_pojazd , v [ 3 ])
triggerServerEvent ( "bier:kasemech" , localPlayer , tonumber ( v [ 4 ]))
else
exports [ "np-notyfikacje" ]: noti ( "Niestac ci? na naprawe tej cz??ci" , "error" )
end
end
end
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) and okno3 == true then
removeEventHandler ( "onClientRender" , root , gui3 )
okno3 = false
showCursor ( false )
grid3 = { }
setElementFrozen ( localPlayer , false )
end
end
end )
-- prawa strona
local czesciprawa = {
{ "Drzwi prawy prz?d" , 5 , 1500 , "door_car_icon" },
{ "Drzwi prawy ty?" , 7 , 1500 , "door_car_icon" },
}
function sprawdz_czesc4 ( czesc )
if czesc == 5 then
if getVehicleDoorState ( naprawiany_pojazd , 3 ) == 0 then
return true
else
return false
end
elseif czesc == 7 then
if getVehicleDoorState ( naprawiany_pojazd , 5 ) == 0 then
return true
else
return false
end
end
end
local grid4 = { }
function naprawaprawy ( gracz )
if gracz ~= localPlayer then return end
naprawiany_pojazd = getElementData ( source , "naprawianypojazd" )
if getPedOccupiedVehicle ( localPlayer ) then return end
for i , v in ipairs ( czesciprawa ) do
if sprawdz_czesc4 ( tonumber ( v [ 2 ])) ~= true then
table . insert ( grid4 , { 1 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ]})
end
end
okno4 = true
addEventHandler ( "onClientRender" , root , gui4 )
showCursor ( true )
setElementFrozen ( localPlayer , true )
end
function gui4 ()
dxDrawImage ( 610 * px , 260 * py , 700 * px , 555 * py , "grafiki/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Naprawanie cze?ci z prawej strony" , 980 * px , 320 * py , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal18 , "center" , "center" , false , false , false , false , false )
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) then
dxDrawImage ( 1259 * px , 274 * py , 27 * px , 27 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
else
dxDrawImage ( 1260 * px , 275 * py , 25 * px , 25 * py , "grafiki/cross.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
end
for i , v in ipairs ( grid4 ) do
local dodatekY = ( 75 * py )*( i - 1 )
local dodatekY2 = ( 150 * py )*( i - 1 )
dxDrawRectangle ( 650 * px , 337 * py + dodatekY , 625 * px , 70 * py , tocolor ( 50 , 50 , 50 , 120 ), false )
dxDrawImage ( 670 * px , 342 * py + dodatekY , 60 * px , 60 * py , "grafiki/" .. v [ 5 ].. ".png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
shadowText ( v [ 2 ], 750 * px , 430 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
shadowText ( "Cena naprawy: " .. v [ 4 ].. " PLN" , 750 * px , 493 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "left" , "center" , false , false , false , false , false )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) then
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons_on.png" , 0 , 0 , 0 , tocolor ( 200 , 200 , 200 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 220 , 220 , 220 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
else
dxDrawImage ( 1100 * px , 347 * py + dodatekY , 140 * px , 47 * py , "grafiki/buttons.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , alpha ), false )
shadowText ( "Napraw" , 1406 * px , 463 * py + dodatekY2 , 934 * px , 279 * py , tocolor ( 255 , 255 , 255 , 255 ), 1 * px , normal15 , "center" , "center" , false , false , false , false , false )
end
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
for i , v in ipairs ( grid4 ) do
local dodatekY = ( scale_y ( 63 ))*( i - 1 )
if mysz ( 1100 * px , 350 * py + dodatekY , 140 * px , 47 * py ) and okno4 == true then
local hajs = getPlayerMoney ( localPlayer ) or 0
if hajs >= tonumber ( v [ 4 ]) then
exports [ "np-notyfikacje" ]: noti ( "Naprawi?e? " .. v [ 2 ].. " za " .. v [ 4 ].. " PLN" )
table . remove ( grid4 , i )
triggerServerEvent ( "napraw:czesc" , localPlayer , naprawiany_pojazd , v [ 3 ])
triggerServerEvent ( "bier:kasemech" , localPlayer , tonumber ( v [ 4 ]))
else
exports [ "np-notyfikacje" ]: noti ( "Niestac ci? na naprawe tej cz??ci" , "error" )
end
end
end
if mysz ( 1260 * px , 275 * py , 25 * px , 25 * py ) and okno4 == true then
removeEventHandler ( "onClientRender" , root , gui4 )
okno4 = false
showCursor ( false )
grid4 = { }
setElementFrozen ( localPlayer , false )
end
end
end )
addEventHandler ( "onClientVehicleEnter" , root , function( thePlayer , seat )
if seat ~= 0 then return end
if thePlayer ~= localPlayer then return end
if getElementData ( source , "naprawiany" ) then
if isElement ( naprawa1 ) then
destroyElement ( naprawa1 )
end
if isElement ( naprawa2 ) then
destroyElement ( naprawa2 )
end
if isElement ( naprawa3 ) then
destroyElement ( naprawa3 )
end
if isElement ( naprawa4 ) then
destroyElement ( naprawa4 )
end
end
end )
-- dodatki
function scale_x ( value )
local result = ( value / 1440 ) * sx
return result
end
function scale_y ( value )
local result = ( value / 900 ) * sy
return result
end
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
s.lua
addEvent ( "bier:kasemech" , true )
addEventHandler ( "bier:kasemech" , root , function( value , value2 )
if not getElementData ( source , "player:logged" ) then return end
takePlayerMoney ( source , value )
end )
addEvent ( "napraw:czesc" , true )
addEventHandler ( "napraw:czesc" , root , function( veh , czesc )
if czesc == 1 then
setElementHealth ( veh , 10000 )
end
if czesc == 2 then
setVehicleDoorState ( veh , 0 , 0 )
end
if czesc == 3 then
setVehicleDoorState ( veh , 1 , 0 )
end
if czesc == 4 then
setVehicleDoorState ( veh , 2 , 0 )
end
if czesc == 5 then
setVehicleDoorState ( veh , 3 , 0 )
end
if czesc == 6 then
setVehicleDoorState ( veh , 4 , 0 )
end
if czesc == 7 then
setVehicleDoorState ( veh , 5 , 0 )
end
if czesc == 8 then
setVehiclePanelState ( veh , 4 , 0 )
end
if czesc == 9 then
setVehiclePanelState ( veh , 5 , 0 )
end
if czesc == 10 then
setVehiclePanelState ( veh , 6 , 0 )
end
if czesc == 11 then
setVehicleLightState ( veh , 0 , 0 )
end
if czesc == 12 then
setVehicleLightState ( veh , 1 , 0 )
end
if czesc == 13 then
setVehicleLightState ( veh , 2 , 0 )
end
if czesc == 14 then
setVehicleLightState ( veh , 3 , 0 )
end
end )
B??du w db3 brak