Wysłany: 2021-02-11, 10:11
Patryk545
Wiek: 25 Na forum: 2224 dni Posty: 36
Nick w MP: Patryk545
Piwa : 1
Siema mam prac? import-export i po wej?ciu w blip do jej rozpocz?cia pokazuje si? kursor a gui nie prosz? o pomoc. Kod pracy.
c.lua
local sx , sy = guiGetScreenSize ()
zoom = 1
local minZoom = 2.2
if sx < 2048 then
zoom = math . min ( minZoom , 2048 / sx )
end
local data = false
local clickTick = getTickCount ()
local garageVehicles = {}
local importVehicle = false
local importBlip = false
local font = dxCreateFont ( "files/normal.ttf" , 30 , false )
local vehiclesToTheft = {
[ "models" ] = {
411 , 541 , 477 , 562 , 415 , 451 , 429 , 560 , 402 , 475 , 580
},
[ "positions" ] = {
{- 1697.343 , 9.01 , 3.194 , 359.871 , 0 , 357.735 }, -- SF Garage
{- 617.977 , - 507.099 , 25.16 , 359.927 , 359.912 , 0.641 }, -- SF opuszczony kurier
{ 168.506 , - 22.163 , 1.219 , 359.872 , 0 , 271.001 }, -- BB
{ 1236.067 , 213.407 , 19.194 , 359.87 , 360 , 99.89 }, -- Montogomery
{ 2258.26 , - 83.444 , 26.164 , 359.865 , 0.477 , 269.188 }, -- PC
{ 1544.807 , 16.282 , 23.778 , 359.863 , 0.2 , 303.619 }, -- Autostrada LV - LS
{ 1047.138 , 2133.755 , 10.461 , 359.872 , 0 , 87.67 }, -- LV obok lawety
{ 2625.921 , 1136.281 , 10.461 , 359.872 , 0 , 181.257 }, -- LV stacja
{ 2825.476 , 967.843 , 10.39 , 359.872 , 0.001 , 175.67 }, -- LV magazyny niby
{- 155.495 , 1083.222 , 19.381 , 359.873 , 359.953 , 50.308 }, -- FC
{- 884.932 , 1520.25 , 25.56 , 359.879 , 360 , 54.315 }, -- Za FC Zadupie
{- 1249.279 , 2703.418 , 49.702 , 359.871 , 0 , 118.857 }, -- Za FC jeszcze dalej na stacji zadupie
{- 2293.368 , 2427.888 , 4.554 , 359.872 , 0.006 , 222.779 }, -- BM
{- 2624.756 , 2261.087 , 7.8 , 359.613 , 0.116 , 319.288 }, -- BMV2
{- 897.469 , 1990.15 , 60.554 , 359.871 , 0.004 , 343.726 }, -- Tama
{- 64.692 , - 1110.676 , 0.718 , 359.871 , 0.011 , 69.786 }, -- Obok LS
{ 764.086 , - 1380.652 , 13.294 , 359.93 , 359.457 , 271.053 }, -- LS
{ 1793.8 , - 1439.646 , 13.061 , 359.894 , 0.081 , 135.357 }, -- LSV2
{ 2110.487 , - 2088.994 , 13.197 , 359.805 , 0.119 , 198.806 }, -- LSV3
{ 372.401 , - 2043.309 , 7.312 , 359.872 , 0.001 , 0.117 }, -- LSV4
{- 27.102 , - 2507.003 , 36.331 , 359.915 , 0.004 , 156.122 }, -- Za LS
{- 1578.104 , - 2718.94 , 48.179 , 359.872 , 360 , 56.716 }, -- Za MC
{- 2098.588 , - 2244.222 , 30.28 , 359.891 , 0.014 , 132.408 }, -- AP
{- 1941.707 , - 1085.817 , 30.418 , 359.872 , 0 , 0.639 }, -- SFV2
{- 2076.144 , 1427.784 , 6.742 , 359.872 , 359.873 , 132.286 }, -- SFV3
}
}
local keys = {
"A" , "B" , "C" , "D" , "E" , "F" , "G" , "H" , "I" , "J" , "K" , "L" , "M" , "N" , "O" , "P" , "R" , "S" , "T" , "Y" , "U" , "W" , "X" , "Q" , "Z"
}
hudMaskShader = dxCreateShader ( "files/mask.fx" )
maskTexture = dxCreateTexture ( "files/mask.png" )
dxSetShaderValue ( hudMaskShader , "sMaskTexture" , maskTexture )
local garage = createMarker (- 2724.47 , 74.45 , 4.34 - 1.05 , "cylinder" , 1 , 255 , 200 , 0 , 150 )
addEventHandler ( "onClientMarkerHit" , garage , function( plr )
if plr ~= localPlayer then return end
if getPedOccupiedVehicle ( localPlayer ) then return end
triggerServerEvent ( "checkGarageInfo" , resourceRoot , localPlayer , 1 )
end )
local garageExit = createMarker (- 2727.1999511719 , 101 , - 17.200000762939 - 1.05 , "cylinder" , 1 , 255 , 200 , 0 , 150 )
addEventHandler ( "onClientMarkerHit" , garageExit , function( plr )
if plr ~= localPlayer then return end
if getPedOccupiedVehicle ( localPlayer ) then return end
triggerServerEvent ( "checkGarageInfo" , resourceRoot , localPlayer , 2 )
end )
addEventHandler ( "onClientMarkerLeave" , garage , function( plr )
if plr ~= localPlayer then return end
removeEventHandler ( "onClientRender" , root , renderGarageGUI )
removeEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( false )
end )
addEventHandler ( "onClientMarkerLeave" , garageExit , function( plr )
if plr ~= localPlayer then return end
removeEventHandler ( "onClientRender" , root , renderGarageInteriorGUI )
removeEventHandler ( "onClientClick" , root , clickGarageInteriorGUI )
showCursor ( false )
end )
keysRenderTarget = dxCreateRenderTarget ( 500 , 50 , true )
toggleAllControls ( true )
function renderTheftGUI ()
isEnded = false
dxSetRenderTarget ( keysRenderTarget , true )
for k , v in pairs ( theftKeys ) do
v . x = v . x - 1.5
dxDrawImage ( 250 + v . x - 25 , 0 , 50 , 50 , "files/key.png" , 0 , 0 , 0 , tocolor ( unpack ( v . color )))
dxDrawText ( v . key , 250 + v . x , 25 , 250 + v . x , 25 , tocolor ( unpack ( v . color )), 0.7 , font , "center" , "center" )
dxDrawRectangle ( 247.5 , 0 , 5 , 50 , tocolor ( 0 , 0 , 0 , 255 ))
if v . x < - 25 then
if v . color [ 1 ] == 255 and v . color [ 2 ] == 255 and v . color [ 3 ] == 255 then
v . color = { 255 , 0 , 0 }
end
end
if v . x < - 250 then
if k == #theftKeys then
isEnded = true
end
end
end
dxSetRenderTarget ()
if isEnded then
removeEventHandler ( "onClientRender" , root , renderTheftGUI )
removeEventHandler ( "onClientKey" , root , keyTheftGUI )
toggleAllControls ( true )
local errors = 0
for k , v in pairs ( theftKeys ) do
if v . color [ 1 ] == 255 and v . color [ 2 ] == 0 and v . color [ 3 ] == 0 then
errors = errors + 1
end
end
if errors > 3 then
outputChatBox ( "âś #FFFFFFPope?‚ni?‚e?› zbyt duĹĽo b?‚?™dĂłw, sprĂłbuj ponownie!" , 255 , 0 , 0 , true )
theftCar ()
else
outputChatBox ( "??” #FFFFFFUkradziono auto z powodzeniem!" , 0 , 255 , 0 , true )
model = getElementModel ( importVehicle )
x , y , z = getElementPosition ( importVehicle )
rx , ry , rz = getElementRotation ( importVehicle )
r , g , b , r2 , g2 , b2 = getVehicleColor ( importVehicle )
if importBlip then
destroyElement ( importBlip )
importBlip = false
end
if importVehicle then
destroyElement ( importVehicle )
importVehicle = false
end
if importMarker then
destroyElement ( importMarker )
importMarker = false
end
importMarker = createMarker (- 2729.93 , 77.00 , 3.75 - 1.05 , "cylinder" , 5 , 255 , 200 , 0 , 150 )
importBlip = createBlip (- 2729.93 , 77.00 , 3.75 , 41 )
addEventHandler ( "onClientMarkerHit" , importMarker , function( hit )
if hit ~= localPlayer then return end
veh = getPedOccupiedVehicle ( localPlayer )
if not veh then return end
local theft = getElementData ( veh , "vehicle:theft" )
if theft ~= localPlayer then return end
if importBlip then
destroyElement ( importBlip )
importBlip = false
end
if importMarker then
destroyElement ( importMarker )
importMarker = false
end
setElementPosition ( veh , - 2730.95 , 97.71 ,- 17.2 )
setElementRotation ( veh , 0 , 0 , 180 )
triggerServerEvent ( "setDimension" , resourceRoot , veh , getElementData ( localPlayer , "player:sid" ))
outputChatBox ( "?’? #FFFFFFUstaw pojazd i z niego wysi?…dĹş ĹĽeby go zapisa?‡." , 255 , 255 , 0 , true )
end )
triggerServerEvent ( "stoleCar" , resourceRoot , localPlayer , model , x , y , z , rx , ry , rz , r , g , b , r2 , g2 , b2 )
end
end
dxSetShaderValue ( hudMaskShader , "sPicTexture" , keysRenderTarget )
dxDrawImage ( sx / 2 - 250 / zoom , sy / 2 - 150 / zoom , 500 / zoom , 50 / zoom , hudMaskShader )
end
function keyTheftGUI ( key , press )
if press then
for k , v in pairs ( theftKeys ) do
if v . x > - 25 and v . x < 25 then
if v . color [ 1 ] == 255 and v . color [ 2 ] == 255 and v . color [ 3 ] == 255 then
if string . upper ( key ) == v . key then
v . color = { 0 , 255 , 0 }
else
v . color = { 255 , 0 , 0 }
end
end
end
end
end
end
function theftCar ()
addEventHandler ( "onClientRender" , root , renderTheftGUI )
addEventHandler ( "onClientKey" , root , keyTheftGUI )
theftKeys = {}
offset = 250
toggleAllControls ( false )
for i = 1 , math . random ( 15 , 30 ) do
table . insert ( theftKeys , { x = offset , passed = false , key = keys [ math . random ( 1 , #keys)], color={255, 255, 255}})
offset = offset + 80
end
end
function renderGarageInteriorGUI ()
if not data then return end
count = #fromJSON(data[1]["data"])
dxDrawImage ( sx / 2 - 350 / zoom , sy / 2 - 225 / zoom , 700 / zoom , 450 / zoom , "files/background.png" )
dxDrawText ( "Aktualnie posiadasz " .. count .. "/" .. data [ 1 ][ "limit" ] .. " pojazdĂłw w garaĹĽu.\nWybierz co chcesz teraz zrobi?‡." , sx / 2 , sy / 2 - 25 / zoom , sx / 2 , sy / 2 - 25 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
dxDrawImage ( sx / 2 - 275 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawImage ( sx / 2 - 75 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawImage ( sx / 2 + 125 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawText ( "WyjdĹş" , sx / 2 + 200 / zoom , sy / 2 + 150 / zoom , sx / 2 + 200 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
if count < 1 then
dxDrawText ( "Export" , sx / 2 , sy / 2 + 150 / zoom , sx / 2 , sy / 2 + 150 / zoom , tocolor ( 255 , 255 , 255 , 100 ), 1.5 / zoom , "default-bold" , "center" , "center" )
else
dxDrawText ( "Export" , sx / 2 , sy / 2 + 150 / zoom , sx / 2 , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
end
if count >= data [ 1 ][ "limit" ] then
dxDrawText ( "Import" , sx / 2 - 200 / zoom , sy / 2 + 150 / zoom , sx / 2 - 200 / zoom , sy / 2 + 150 / zoom , tocolor ( 255 , 255 , 255 , 100 ), 1.5 / zoom , "default-bold" , "center" , "center" )
else
dxDrawText ( "Import" , sx / 2 - 200 / zoom , sy / 2 + 150 / zoom , sx / 2 - 200 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
end
end
function clickGarageInteriorGUI ( btn , state )
if btn ~= "left" or state ~= "down" then return end
if clickTick > getTickCount () then return end
clickTick = getTickCount () + 3000
if isMouseInPosition ( sx / 2 + 125 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
removeEventHandler ( "onClientRender" , root , renderGarageInteriorGUI )
removeEventHandler ( "onClientClick" , root , clickGarageInteriorGUI )
showCursor ( false )
triggerServerEvent ( "exitGarage" , resourceRoot , localPlayer , data )
end
if isMouseInPosition ( sx / 2 - 275 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
if count >= data [ 1 ][ "limit" ] then
return outputChatBox ( "âś #FFFFFFGaraĹĽ jest pe?‚en!" , 255 , 0 , 0 , true )
else
if getElementData ( localPlayer , "player:import" ) then return outputChatBox ( "?’? #FFFFFFJuĹĽ rozpocz?…?‚e?› import pojazdu!" , 255 , 255 , 0 , true ) end
removeEventHandler ( "onClientRender" , root , renderGarageInteriorGUI )
removeEventHandler ( "onClientClick" , root , clickGarageInteriorGUI )
showCursor ( false )
triggerServerEvent ( "exitGarage" , resourceRoot , localPlayer , data )
outputChatBox ( "?’? #FFFFFFRozpocz?…?‚e?› import pojazdu, ukradnij pojazd i wrĂłc do garaĹĽu!" , 255 , 255 , 0 , true )
if importBlip then
destroyElement ( importBlip )
importBlip = false
end
if importVehicle then
destroyElement ( importVehicle )
importVehicle = false
end
if importMarker then
destroyElement ( importMarker )
importMarker = false
end
setElementData ( localPlayer , "player:import" , true )
local model = vehiclesToTheft [ "models" ][ math . random ( 1 , #vehiclesToTheft["models"])]
local position = vehiclesToTheft [ "positions" ][ math . random ( 1 , #vehiclesToTheft["positions"])]
importVehicle = createVehicle ( model , unpack ( position ))
importMarker = createMarker ( position [ 1 ], position [ 2 ], position [ 3 ], "cylinder" , 5 )
addEventHandler ( "onClientMarkerHit" , importMarker , function( hit )
if hit ~= localPlayer then return end
if getPedOccupiedVehicle ( localPlayer ) then return end
theftCar ()
end )
importBlip = createBlip ( 0 , 0 , 0 , 41 )
attachElements ( importBlip , importVehicle )
end
end
if isMouseInPosition ( sx / 2 - 75 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
if count < 1 then
return outputChatBox ( "âś #FFFFFFGaraĹĽ jest pusty!" , 255 , 0 , 0 , true )
else
removeEventHandler ( "onClientRender" , root , renderGarageInteriorGUI )
removeEventHandler ( "onClientClick" , root , clickGarageInteriorGUI )
showCursor ( false )
triggerServerEvent ( "exitGarage" , resourceRoot , localPlayer )
outputChatBox ( "?’? #FFFFFFRozpocz?…?‚e?› export pojazdĂłw, dojedĹş do okre?›lonego miejsca!" , 255 , 255 , 0 , true )
setCameraClip ( true , false )
if exportBlip then
destroyElement ( exportBlip )
exportBlip = false
end
if exportMarker then
destroyElement ( exportMarker )
exportMarker = false
end
exportMarker = createMarker ( 867.32 , - 1206.231 , 16.977 - 1.05 , "cylinder" , 5 )
exportBlip = createBlip ( 867.32 , - 1206.231 , 16.977 , 41 )
addEventHandler ( "onClientMarkerHit" , exportMarker , function( hit )
if hit ~= localPlayer then return end
triggerServerEvent ( "endExport" , resourceRoot , localPlayer )
triggerServerEvent ( "deleteVehiclesFromGarage" , resourceRoot , localPlayer )
if exportBlip then
destroyElement ( exportBlip )
exportBlip = false
end
if exportMarker then
destroyElement ( exportMarker )
exportMarker = false
end
end )
triggerServerEvent ( "startExport" , resourceRoot , localPlayer )
end
end
end
function renderGarageGUI ()
if not data then return end
if #data < 1 then
dxDrawImage ( sx / 2 - 350 / zoom , sy / 2 - 225 / zoom , 700 / zoom , 450 / zoom , "files/background.png" )
dxDrawText ( "GaraĹĽ\n\n Import - Export\n\nCena to 250k" , sx / 2 , sy / 2 - 25 / zoom , sx / 2 , sy / 2 - 25 / zoom , white , 2 / zoom , "default-bold" , "center" , "center" )
dxDrawImage ( sx / 2 - 175 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawText ( "Kup" , sx / 2 - 100 / zoom , sy / 2 + 150 / zoom , sx / 2 - 100 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
dxDrawImage ( sx / 2 + 25 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawText ( "Anuluj" , sx / 2 + 100 / zoom , sy / 2 + 150 / zoom , sx / 2 + 100 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
else
dxDrawImage ( sx / 2 - 350 / zoom , sy / 2 - 225 / zoom , 700 / zoom , 450 / zoom , "files/background.png" )
dxDrawText ( "Aktualnie posiadasz " .. #fromJSON(data[1]["data"]) .. " pojazdĂłw w garaĹĽu.\nAby rozpocz?…?‡ import b?…dĹş export\nwejdĹş do markeru w ?›rodku garaĹĽu.", sx/2, sy/2-25/zoom, sx/2, sy/2-25/zoom, white, 1.5/zoom, "default-bold", "center", "center")
dxDrawImage ( sx / 2 - 175 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawText ( "WejdĹş" , sx / 2 - 100 / zoom , sy / 2 + 150 / zoom , sx / 2 - 100 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
dxDrawImage ( sx / 2 + 25 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom , "files/button.png" )
dxDrawText ( "Anuluj" , sx / 2 + 100 / zoom , sy / 2 + 150 / zoom , sx / 2 + 100 / zoom , sy / 2 + 150 / zoom , white , 1.5 / zoom , "default-bold" , "center" , "center" )
end
end
function clickGarageGUI ( btn , state )
if btn ~= "left" or state ~= "down" then return end
if clickTick > getTickCount () then return end
clickTick = getTickCount () + 3000
if #data < 1 then
if isMouseInPosition ( sx / 2 - 175 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
if getPlayerMoney ( localPlayer ) < 250000 then
return outputChatBox ( "?’? #FFFFFFNie posiadasz 250,000$!" , 255 , 255 , 0 , true )
end
triggerServerEvent ( "buyGarage" , resourceRoot , localPlayer )
removeEventHandler ( "onClientRender" , root , renderGarageGUI )
removeEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( false )
end
if isMouseInPosition ( sx / 2 + 25 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
removeEventHandler ( "onClientRender" , root , renderGarageGUI )
removeEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( false )
end
else
if isMouseInPosition ( sx / 2 - 175 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
triggerServerEvent ( "enterGarage" , resourceRoot , localPlayer , data )
for k , v in pairs ( garageVehicles ) do
destroyElement ( v )
v = nil
end
for k , v in pairs ( fromJSON ( data [ 1 ][ "data" ])) do
local veh = createVehicle ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ])
setVehicleColor ( veh , v [ 8 ], v [ 9 ], v [ 10 ], v [ 11 ], v [ 12 ], v [ 13 ])
setElementDimension ( veh , getElementData ( localPlayer , "player:sid" ))
table . insert ( garageVehicles , veh )
end
removeEventHandler ( "onClientRender" , root , renderGarageGUI )
removeEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( false )
end
if isMouseInPosition ( sx / 2 + 25 / zoom , sy / 2 + 125 / zoom , 150 / zoom , 50 / zoom ) then
removeEventHandler ( "onClientRender" , root , renderGarageGUI )
removeEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( false )
end
end
end
addEvent ( "getGarageInfo" , true )
addEventHandler ( "getGarageInfo" , localPlayer , function( result )
data = result
addEventHandler ( "onClientRender" , root , renderGarageGUI )
addEventHandler ( "onClientClick" , root , clickGarageGUI )
showCursor ( true , false )
end )
addEvent ( "adjustPacker" , true )
addEventHandler ( "adjustPacker" , localPlayer , function( veh , value )
setVehicleAdjustableProperty ( veh , value )
end )
addEvent ( "disableCools" , true )
addEventHandler ( "disableCools" , localPlayer , function( veh , veh2 , bool )
setElementCollidableWith ( veh , veh2 , bool )
setElementCollidableWith ( veh2 , veh , bool )
end )
addEvent ( "getGarageInteriorInfo" , true )
addEventHandler ( "getGarageInteriorInfo" , localPlayer , function( result )
data = result
addEventHandler ( "onClientRender" , root , renderGarageInteriorGUI )
addEventHandler ( "onClientClick" , root , clickGarageInteriorGUI )
showCursor ( true , false )
end )
addEvent ( "endExport" , true )
addEventHandler ( "endExport" , localPlayer , function()
if exportBlip then
destroyElement ( exportBlip )
exportBlip = false
end
if exportMarker then
destroyElement ( exportMarker )
exportMarker = 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 )
return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end
s.lua
importVehicles = {}
packers = {}
exportVehicles = {}
gate = createObject ( 975 , - 2730.45000488281 , 79.800003051758 , 4.99999523163 )
gateMarker = createColSphere (- 2730.55 , 79.49 , 4.34 , 5 )
canOpen = true
gateTimer = false
addEventHandler ( "onColShapeHit" , gateMarker , function( hit )
if canOpen == true then
x = getElementPosition ( gate )
x = ((- x ) - 2720 ) / 10
moveObject ( gate , 5000 * x , - 2720 , 79.800003051758 , 4.99999523163 )
canOpen = "opening"
if isTimer ( gateTimer ) then killTimer ( gateTimer ) end
gateTimer = setTimer (function()
canOpen = true
end , 5000 , 1 )
end
end )
setTimer (function()
if canOpen == true then
x = getElementPosition ( gate )
elements = 0
for k , v in pairs ( getElementsWithinColShape ( gateMarker )) do
if getElementType ( v ) == "player" or getElementType ( v ) == "vehicle" then
elements = elements + 1
end
end
if math . floor ( x ) == - 2720 and elements < 1 then
moveObject ( gate , 5000 , - 2730.45000488281 , 79.800003051758 , 4.99999523163 )
end
end
end , 5000 , 0 )
addEvent ( "checkGarageInfo" , true )
addEventHandler ( "checkGarageInfo" , resourceRoot , function( plr , id )
local sid = getElementData ( plr , "player:sid" )
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_importexport WHERE sid=?" , sid )
if id == 1 then
triggerClientEvent ( plr , "getGarageInfo" , plr , result )
else
triggerClientEvent ( plr , "getGarageInteriorInfo" , plr , result )
end
end )
addEvent ( "buyGarage" , true )
addEventHandler ( "buyGarage" , resourceRoot , function( plr )
local sid = getElementData ( plr , "player:sid" )
local result = exports [ "pystories-db" ]: dbSet ( "INSERT INTO `pystories_importexport` (`sid`, `data`, `limit`) VALUES (?, ?, ?)" , sid , toJSON ({}), 2 )
outputChatBox ( "??” #FFFFFFZakupi?‚e?› garaĹĽ!" , plr , 0 , 255 , 0 , true )
takePlayerMoney ( plr , 250000 )
end )
addEvent ( "enterGarage" , true )
addEventHandler ( "enterGarage" , resourceRoot , function( plr , data )
setElementPosition ( plr , - 2727.1999511719 , 99 , - 17.200000762939 )
setElementDimension ( plr , getElementData ( plr , "player:sid" ))
end )
function exitGarage ( plr )
setElementPosition ( plr , - 2722.45 , 74.33 , 4.34 )
setElementDimension ( plr , 0 )
end
addEvent ( "exitGarage" , true )
addEventHandler ( "exitGarage" , resourceRoot , exitGarage )
addEvent ( "stoleCar" , true )
addEventHandler ( "stoleCar" , resourceRoot , function( plr , model , x , y , z , rx , ry , rz , r , g , b , r2 , g2 , b2 )
if importVehicles [ plr ] then
destroyElement ( importVehicles [ plr ])
importVehicles [ plr ] = false
end
importVehicles [ plr ] = createVehicle ( model , x , y , z , rx , ry , rz )
setVehicleColor ( importVehicles [ plr ], r , g , b , r2 , g2 , b2 )
setElementData ( importVehicles [ plr ], "vehicle:theft" , plr )
warpPedIntoVehicle ( plr , importVehicles [ plr ])
end )
addEvent ( "setDimension" , true )
addEventHandler ( "setDimension" , resourceRoot , function( el , dim )
setElementDimension ( el , dim )
end )
attachPositions = {
{ 0 , - 1 , 0.8 , 0 , 0 , 0 },
{ 0 , - 6.5 , 0.2 , 15 , 0 , 0 },
{ 0 , 0 , 2.5 },
{ 0 , - 5.5 , 2.5 },
}
addEvent ( "startExport" , true )
addEventHandler ( "startExport" , resourceRoot , function( plr )
endExport ( plr )
packers [ plr ] = createVehicle ( 443 , - 2720.25 , 84.36 , 5.11 , 0 , 0 , - 90 )
warpPedIntoVehicle ( plr , packers [ plr ])
triggerClientEvent ( root , "adjustPacker" , root , packers [ plr ], 2500 )
sid = getElementData ( plr , "player:sid" )
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_importexport WHERE sid=?" , sid )[ 1 ][ "data" ]
local result = fromJSON ( result )
for k , v in pairs ( result ) do
local veh = createVehicle ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ])
setVehicleColor ( veh , v [ 8 ], v [ 9 ], v [ 10 ], v [ 11 ], v [ 12 ], v [ 13 ])
if not exportVehicles [ plr ] then exportVehicles [ plr ] = {} end
table . insert ( exportVehicles [ plr ], veh )
attachElements ( veh , packers [ plr ], unpack ( attachPositions [ k ]))
triggerClientEvent ( root , "disableCools" , root , packers [ plr ], veh , false )
for k , v in pairs ( exportVehicles [ plr ]) do
triggerClientEvent ( root , "disableCools" , root , v , veh , false )
end
end
end )
addEventHandler ( "onPlayerQuit" , root , function()
if importVehicles [ source ] then
destroyElement ( importVehicles [ source ])
importVehicles [ source ] = false
end
endExport ( source )
end )
function endExport ( plr )
if packers [ plr ] then
destroyElement ( packers [ plr ])
packers [ plr ] = false
end
if exportVehicles [ plr ] then
for k , v in pairs ( exportVehicles [ plr ]) do
destroyElement ( v )
v = false
end
exportVehicles [ plr ] = false
end
end
addEvent ( "endExport" , true )
addEventHandler ( "endExport" , resourceRoot , endExport )
addEvent ( "deleteVehiclesFromGarage" , true )
addEventHandler ( "deleteVehiclesFromGarage" , resourceRoot , function( plr )
local sid = getElementData ( plr , "player:sid" )
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_importexport WHERE sid=?" , sid )[ 1 ][ "data" ]
local result = fromJSON ( result )
local money = 0
for k , v in pairs ( result ) do
money = money + 10000
end
result = {}
exports [ "pystories-db" ]: dbSet ( "UPDATE `pystories_importexport` SET `data`=? WHERE `sid`=?" , toJSON ( result ), sid )
outputChatBox ( "?’? #FFFFFFZa export otrzymujesz $" .. money , plr , 255 , 255 , 0 , true )
triggerEvent ( "givePlayerMoney" , plr , money )
setTimer ( setElementPosition , 1000 , 1 , plr , - 2722.26 , 74.34 , 4.34 )
end )
addEventHandler ( "onPlayerVehicleExit" , root , function( veh )
local sid = getElementData ( source , "player:sid" )
if getElementData ( veh , "vehicle:theft" ) and getElementDimension ( veh ) == sid then
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_importexport WHERE sid=?" , sid )[ 1 ][ "data" ]
local result = fromJSON ( result )
model = getElementModel ( veh )
x , y , z = getElementPosition ( veh )
rx , ry , rz = getElementRotation ( veh )
r1 , g1 , b1 , r2 , g2 , b2 = getVehicleColor ( veh )
table . insert ( result , { model , x , y , z , rx , ry , rz , r1 , g1 , b1 , r2 , g2 , b2 })
exports [ "pystories-db" ]: dbSet ( "UPDATE `pystories_importexport` SET `data`=? WHERE `sid`=?" , toJSON ( result ), sid )
destroyElement ( veh )
exitGarage ( source )
outputChatBox ( "??” #FFFFFFDostarczy?‚e?› pojazdu z import pomy?›lnie!" , source , 0 , 255 , 0 , true )
setElementData ( source , "player:import" , false )
end
endExport ( source )
triggerClientEvent ( source , "endExport" , source )
end )
Wysłany: 2021-02-12, 08:04
!ryzee
rebornMTA
Wiek: 19 Na forum: 2254 dni Posty: 111
Nick w MP: drakovskyy
Piwa : 55
Gdzie jest event, odpowiadaj?cy za otwarcie GUI? Bo nic takiego tutaj nie widz?.
Wysłany: 2021-02-13, 10:25
Patryk545
Wiek: 25 Na forum: 2224 dni Posty: 36
Nick w MP: Patryk545
Piwa : 1
Wystawi?by? mi to? Bo nie bardzo wiem gdzie.
Wysłany: 2021-02-14, 18:55
xyzzz^
A nic
Wiek: 18 Na forum: 1993 dni Posty: 319
Nick w MP: Aspyk21
Piwa : 308
Wysłany: 2021-02-15, 01:12
Patryk545
Wiek: 25 Na forum: 2224 dni Posty: 36
Nick w MP: Patryk545
Piwa : 1
local garage = createMarker(-2724.47,74.45,4.34-1.05, "cylinder", 1, 255, 200, 0, 150)
Znajduje si? to w SF
Wysłany: 2021-02-15, 13:00
OczuS
Wiek: 20 Na forum: 2442 dni Posty: 66
Nick w MP: Boro
Piwa : 984
w kodzie brakuje linijki odpowiadaj?ca za "gdy wejdziesz w marker to otwiera si? gui wraz z kursorem" musisz dopisa? triggera po stronie servera gdy wchodzisz do markera to ?eby przesy?a?o informacj? do clienta i gdy wejdziesz w marker to b?dzie dzia?a?, gui kursor oraz buttony...
a tak pozatym jakie? b??dy? db3
Wysłany: 2021-02-15, 14:08
PatryKK.
Emeryt LUA
Wiek: 26 Na forum: 3061 dni Posty: 1060
Nick w MP: PatryKK.
Piwa : 2322
local markerstart = createMarker ( 1941.18 , 2168.42 , 9.82 , "cylinder" , 1 , 255 , 255 , 255 )
GUIEditor = {
button = {},
window = {},
label = {}
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function ()
GUIEditor . window [ 1 ] = guiCreateWindow ( 1069 , 408 , 297 , 360 , "Kurier" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . label [ 1 ] = guiCreateLabel ( 13 , 46 , 274 , 102 , "Praca kuriera polega na rozworzeniu paczek do klient?w, aby dosta? wyp?ate musisz rozwie?? minimum 5 paczek. Prace ko?czysz w tym miejscu naciskaj?c zwolnij sie." , false , GUIEditor . window [ 1 ])
guiLabelSetHorizontalAlign ( GUIEditor . label [ 1 ], "left" , true )
GUIEditor . button [ 1 ] = guiCreateButton ( 9 , 175 , 278 , 48 , "Zatrudnij si?" , false , GUIEditor . window [ 1 ])
GUIEditor . button [ 2 ] = guiCreateButton ( 9 , 233 , 278 , 48 , "Zwolnij si?" , false , GUIEditor . window [ 1 ])
GUIEditor . button [ 3 ] = guiCreateButton ( 11 , 291 , 276 , 59 , "Wyjd?" , false , GUIEditor . window [ 1 ])
end
)
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
guiSetVisible ( GUIEditor . window [ 1 ], false )
end
)
function wlaczoknopraca ()
guiSetVisible ( GUIEditor . window [ 1 ], true )
showCursor ( true )
end
addEventHandler ( "onClientMarkerHit" , markerstart , wlaczoknopraca )
Przyk?ad wy?ej, wyci?gnij wnioski
Tagi: gui :: pracy :: import-export.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: