Krzemo1234
Wiek: 26 Na forum: 3751 dni Posty: 387
Nick w MP: Krzemo
Piwa : 16
addEvent ( "pokazPanelTuningu" , true )
addEventHandler ( "pokazPanelTuningu" , localPlayer , function( veh )
if not isElement ( GUIEditor . window [ 1 ]) then
if getElementData ( veh , "vehicle:spawn" ) then
showCursor ( true )
veh1 = veh
setElementData ( localPlayer , "tune:car" , veh )
local screenW , screenH = guiGetScreenSize ()
GUIEditor . window [ 1 ] = guiCreateWindow (( screenW - 888 ) / 2 , ( screenH - 546 ) / 2 , 888 * width , 546 * height , "---=== Tuningowanie pojazdu ===---" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . button [ 1 ] = guiCreateButton ( 445 * width , 484 * height , 233 * width , 52 * height , "TUNINGUJ\nDEMONTUJ" , false , GUIEditor . window [ 1 ])
guiSetProperty ( GUIEditor . button [ 1 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditor . button [ 2 ] = guiCreateButton ( 212 * width , 484 * height , 233 * width , 52 * height , "ZAMKNIJ OKNO" , false , GUIEditor . window [ 1 ])
guiSetProperty ( GUIEditor . button [ 2 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditor . gridlist [ 1 ] = guiCreateGridList ( 31 * width , 41 * height , 827 * width , 390 * height , false , GUIEditor . window [ 1 ])
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "ID CZESCI" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "TYP" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "AKCJA" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "KOSZT CZESCI" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "NAZWA Czesci" , 0.15 )
-- a = 0
for i = 0 , 16 do
if getVehicleUpgradeOnSlot ( veh , i ) ~= 0 then
local a = guiGridListAddRow ( GUIEditor . gridlist [ 1 ])
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 1 , tostring ( getVehicleUpgradeOnSlot ( veh , i )), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 2 , tostring ( getVehicleUpgradeSlotName ( getVehicleUpgradeOnSlot ( veh , i ))), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 3 , "demtuning" , false , false )
if cenaCzesci [ getVehicleUpgradeOnSlot ( veh , i )] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , tostring ( tonumber ( cenaCzesci [ getVehicleUpgradeOnSlot ( veh , i )]* 9 / 10 )) , false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , "--" , false , false )
end
if nazwaCzesci [ getVehicleUpgradeOnSlot ( veh , i )] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , tostring ( nazwaCzesci [ getVehicleUpgradeOnSlot ( veh , i )]), false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , "PuddinG" , false , false )
end
-- a = a + 1
else
for i2 , v2 in ipairs ( getVehicleCompatibleUpgrades ( veh , i )) do
if cenaCzesci [ v2 ] then
if not wykluczoneCzesci [ v2 ] then
if v2 == 1164 then
if getElementModel ( veh ) == 558 then
local a = guiGridListAddRow ( GUIEditor . gridlist [ 1 ])
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 1 , tostring ( v2 ), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 2 , tostring ( getVehicleUpgradeSlotName ( v2 )), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 3 , "tuning" , false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , tostring ( cenaCzesci [ v2 ]), false , false )
if nazwaCzesci [ v2 ] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , tostring ( nazwaCzesci [ v2 ]), false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , "PuddinG" , false , false )
end
end
else
local a = guiGridListAddRow ( GUIEditor . gridlist [ 1 ])
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 1 , tostring ( v2 ), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 2 , tostring ( getVehicleUpgradeSlotName ( v2 )), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 3 , "tuning" , false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , tostring ( cenaCzesci [ v2 ]), false , false )
if nazwaCzesci [ v2 ] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , tostring ( nazwaCzesci [ v2 ]), false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , "PuddinG" , false , false )
end
-- a = a + 1
end
end
end
end
end
end
GUIEditor . progressbar [ 1 ] = guiCreateProgressBar ( 129 * width , 436 * height , 631 * width , 38 * height , false , GUIEditor . window [ 1 ])
guiProgressBarSetProgress ( GUIEditor . progressbar [ 1 ], 0 )
end
else
setElementData ( localPlayer , "tune:car" , nil )
end
end )
addEvent ( "ukryjPanelTuningu" , true )
addEventHandler ( "ukryjPanelTuningu" , localPlayer , function()
if GUIEditor . window [ 1 ] and isElement ( GUIEditor . window [ 1 ]) then
destroyElement ( GUIEditor . window [ 1 ])
setElementData ( localPlayer , "tune:car" , nil )
showCursor ( false )
end
end )
time = 5000
function onClientGUIClick ()
if GUIEditor . button [ 2 ] and isElement ( GUIEditor . button [ 2 ]) and source == GUIEditor . button [ 2 ] then
if GUIEditor . window [ 1 ] and isElement ( GUIEditor . window [ 1 ]) then
destroyElement ( GUIEditor . window [ 1 ])
showCursor ( false )
end
elseif GUIEditor . button [ 1 ] and isElement ( GUIEditor . button [ 1 ]) and source == GUIEditor . button [ 1 ] then
if GUIEditor . progressbar [ 1 ] and isElement ( GUIEditor . progressbar [ 1 ]) and GUIEditor . gridlist [ 1 ] and isElement ( GUIEditor . gridlist [ 1 ]) then
if guiProgressBarGetProgress ( GUIEditor . progressbar [ 1 ]) == 0 or guiProgressBarGetProgress ( GUIEditor . progressbar [ 1 ]) == 100 then
b = 0
local x , y = guiGridListGetSelectedItem ( GUIEditor . gridlist [ 1 ])
if y == 1 then
removeEventHandler ( "onClientGUIClick" , resourceRoot , onClientGUIClick )
setTimer (function()
b = b + 1
if GUIEditor . progressbar [ 1 ] and isElement ( GUIEditor . progressbar [ 1 ]) then
guiProgressBarSetProgress ( GUIEditor . progressbar [ 1 ], b )
end
end , time / 100 , 100 )
setTimer (function()
addEventHandler ( "onClientGUIClick" , resourceRoot , onClientGUIClick )
local text1 = guiGridListGetItemText ( GUIEditor . gridlist [ 1 ], x , 1 ) -- ID
local text2 = guiGridListGetItemText ( GUIEditor . gridlist [ 1 ], x , 2 ) -- TYP
local text3 = guiGridListGetItemText ( GUIEditor . gridlist [ 1 ], x , 3 ) -- AKCJA
local text4 = guiGridListGetItemText ( GUIEditor . gridlist [ 1 ], x , 4 ) -- CENA
local text5 = guiGridListGetItemText ( GUIEditor . gridlist [ 1 ], x , 5 ) -- nazwa
if text1 and tonumber ( text1 ) and text4 and tonumber ( text4 ) and text3 and tostring ( text3 ) then
-- if not wykluczoneCzesci [ tonumber ( text1 )] then
if cenaCzesci [ tonumber ( text1 )] then
if veh1 and isElement ( veh1 ) and getElementType ( veh1 ) == "vehicle" then
triggerServerEvent ( "montazElementu" , root , veh1 , text3 , text1 , text4 , text5 )
end
end
end
-- end
end , time * 1.14 , 1 )
end
end
end
end
end
addEventHandler ( "onClientGUIClick" , resourceRoot , onClientGUIClick )
Za pomoc oczywi?cie
[ Dodano : 2017-03-06, 16:26 ]
Dok?adnie addEvent ( "pokazPanelTuningu" , true )
addEventHandler ( "pokazPanelTuningu" , localPlayer , function( veh )
if not isElement ( GUIEditor . window [ 1 ]) then
if getElementData ( veh , "vehicle:spawn" ) then
showCursor ( true )
veh1 = veh
setElementData ( localPlayer , "tune:car" , veh )
local screenW , screenH = guiGetScreenSize ()
GUIEditor . window [ 1 ] = guiCreateWindow (( screenW - 888 ) / 2 , ( screenH - 546 ) / 2 , 888 * width , 546 * height , "---=== Tuningowanie pojazdu ===---" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . button [ 1 ] = guiCreateButton ( 445 * width , 484 * height , 233 * width , 52 * height , "TUNINGUJ\nDEMONTUJ" , false , GUIEditor . window [ 1 ])
guiSetProperty ( GUIEditor . button [ 1 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditor . button [ 2 ] = guiCreateButton ( 212 * width , 484 * height , 233 * width , 52 * height , "ZAMKNIJ OKNO" , false , GUIEditor . window [ 1 ])
guiSetProperty ( GUIEditor . button [ 2 ], "NormalTextColour" , "FFAAAAAA" )
GUIEditor . gridlist [ 1 ] = guiCreateGridList ( 31 * width , 41 * height , 827 * width , 390 * height , false , GUIEditor . window [ 1 ])
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "ID CZESCI" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "TYP" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "AKCJA" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "KOSZT CZESCI" , 0.15 )
guiGridListAddColumn ( GUIEditor . gridlist [ 1 ], "NAZWA Czesci" , 0.15 )
-- a = 0
for i = 0 , 16 do
if getVehicleUpgradeOnSlot ( veh , i ) ~= 0 then
local a = guiGridListAddRow ( GUIEditor . gridlist [ 1 ])
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 1 , tostring ( getVehicleUpgradeOnSlot ( veh , i )), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 2 , tostring ( getVehicleUpgradeSlotName ( getVehicleUpgradeOnSlot ( veh , i ))), false , false )
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 3 , "demtuning" , false , false )
if cenaCzesci [ getVehicleUpgradeOnSlot ( veh , i )] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , tostring ( tonumber ( cenaCzesci [ getVehicleUpgradeOnSlot ( veh , i )]* 9 / 10 )) , false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 4 , "--" , false , false )
end
if nazwaCzesci [ getVehicleUpgradeOnSlot ( veh , i )] then
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , tostring ( nazwaCzesci [ getVehicleUpgradeOnSlot ( veh , i )]), false , false )
else
guiGridListSetItemText ( GUIEditor . gridlist [ 1 ], a , 5 , "PuddinG" , false , false )
end