Debugscript 3-t érdemes használni, lehet valamit nem tud letölteni vagy pedig olyan jót sikerült megírniuk, hogy renderbe került valami olyan aminek nem kellett volna. Lehetséges egy rakat dolog amitől laggolhat, ezt így azért random senki nem fogja neked kiszülni, mert nem mágus senki. Vagy nézd meg milyen hibakódot/kódokat kapsz és ha van akkor is, illetve ha nincs akkor is a scriptet érdemes társítani ide. Köszönöm, hogy te legalább segítettél valamit nem úgy mint Incama!
Almásiék maximum dossolgatni fogják a szervereket és kész :-)
if fileExists(\"client.lua\") thenfileDelete(\"client.lua\")end local monitorSize = {guiGetScreenSize()}local panelSize = {350, 30}local vehicleComponents = {}local damageComponents = {}local damageParts = {}local loadingVehicleDamage = falselocal isPedinVehicle = falselocal mechanic = falselocal sound = falselocal font = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",9) --<[ Font ]>--local font2 = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",11) --<[ Font ]>--local font3 = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",10) --<[ Font ]>--local mechanic_progress_tick = 0local mechanic_progress_max = panelSize[1]local mechanic_progress_text = \"\"local mechanic_progress_arguments = {}local ColhapePos = {{1632.9809570313, -2138.9689941406, 13.63906288147, 10, 10,4},{1646.7819824219, -2139.0419921875, 13.63906288147, 10, 10,4},{1619.1810302734, -2139.0419921875, 13.63906288147, 10, 10,4},{1631.8903808594, -2175.7092285156, 13.631258010864, 10, 12,4},{1618.0882568359, -2175.7080078125, 13.631258010864, 10, 12,4},{1604.2884521484, -2175.7080078125, 13.631258010864, 10, 12,4},{1590.4876708984, -2175.7082519531, 13.631258010864, 10, 12,4},}local createdMechanicCols = {}local object1 = {}local objectCol = {}local vehiceLiftPanel = falselocal currentLiftID = 0 addEventHandler(\"onClientResourceStart\", getResourceRootElement(getThisResource()), function()for index, value in ipairs (ColhapePos) do createdMechanicCols[index] = createColCuboid(value[1], value[2], value[3]-1, value[4], value[5], value[6]) setElementData(createdMechanicCols[index], \"mechanic:boxID\", index)end setElementData(localPlayer, \"current\", false)end)local vehicleElement = nil addEventHandler(\"onClientColShapeHit\", getRootElement(),function(player) if player ~= getLocalPlayer() then return end if (source and exports[\"exg_dashboard\"]:isPlayerInFaction(11)) then if (source == createdMechanicCols[getElementData(source, \"mechanic:boxID\")]) then mechanic = true elseif source:getData(\"mechanic:liftID\") and isPedInVehicle(localPlayer) then triggerServerEvent(\"attachFunction\", localPlayer, getPedOccupiedVehicle(localPlayer), source:getData(\"mechanic:liftID\"), 0) currentLiftID = source:getData(\"mechanic:liftID\") vehicleElement = getPedOccupiedVehicle(localPlayer) end endend)addEventHandler(\"onClientColShapeLeave\", getRootElement(),function(player) if player ~= getLocalPlayer() then return end if (source) then if (source == createdMechanicCols[getElementData(source, \"mechanic:boxID\")]) then mechanic = false end endend) function vehicleLiftClick(button, state, x, y, elementx, elementy, elementZ, element)if element and (element:getData(\"mechanic:Object\") or 0) > 0 and not isPedInVehicle(localPlayer) then if state == \"down\" and button == \"right\" and exports[\"exg_dashboard\"]:isPlayerInFaction(11) then local x, y, z = getElementPosition(getLocalPlayer()) if getElementData(element, \"moving\") then outputChatBox(\"#F7CA18[ExternalGaming - Emelő] #ffffffEz az emelő már használatba van próbáld újra.\",255,255,255,true) return end if getElementData(localPlayer, \"current\") then outputChatBox(\"#F7CA18[ExternalGaming - Emelő] #ffffffTe már használsz egy emelőt próbáld később.\",255,255,255,true) return end if getDistanceBetweenPoints3D(x, y, z, elementx, elementy, elementZ) <= 5 then if not vehiceLiftPanel then local liftID = tonumber(element:getData(\"mechanic:Object\") or 0) triggerServerEvent(\"moveObjectFunction\", localPlayer, localPlayer, element, objectTable[liftID][2], objectTable[liftID][3], objectTable[liftID][4]+2) if vehicleElement then setElementData(vehicleElement, \"forklift\", true) end vehiceLiftPanel = true local sound = playSound(\"files/lift.mp3\", true) setTimer(function() if isElement(sound) then stopSound(sound) end end,10000, 1) else local liftID = tonumber(element:getData(\"mechanic:Object\") or 0) if vehicleElement then triggerServerEvent(\"detachFunction\", localPlayer, vehicleElement) setElementData(vehicleElement, \"forklift\", false) end triggerServerEvent(\"moveObjectFunction\", localPlayer, localPlayer, element, objectTable[liftID][2], objectTable[liftID][3], objectTable[liftID][4]) vehiceLiftPanel = false local sound = playSound(\"files/lift.mp3\", true) setTimer(function() if isElement(sound) then stopSound(sound) end end,10000, 1) end end endendendaddEventHandler(\"onClientClick\", root, vehicleLiftClick)function drawMechanicPanel ()if not isPedInVehicle(localPlayer) and mechanic and exports[\"exg_dashboard\"]:isPlayerInFaction(11) then if #damageParts > 0 then dxDrawRectangle(monitorSize[1] - 200, monitorSize[2]/2 - (#damageParts*22 + 10)/2, 200, (#damageParts*22 + 10),tocolor(0,0,0,160)) -- Player Cuccok kirajzolasa ami nemfer componentbe for partIndex, partValue in pairs(damageParts) do dxDrawRectangle(monitorSize[1] - 200, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex / 22 - 16, 200, 20,tocolor(0, 0, 0,240)) dxDrawText(\"ExternalGaming - #7cc576Mechanic\",monitorSize[1] - 200+5, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex / 22 - 16+2, 200, 20, tocolor(255, 255, 255, 255), 1, font, \"left\", \"top\", false, false, false, true) if isInSlot(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20) then dxDrawRectangle(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20,tocolor(124, 197, 118,180)) dxDrawText(partValue[1],monitorSize[1] - 190 +180/2, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, monitorSize[1] - 190+180/2, 20 + monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, tocolor(0, 0, 0, 255), 1, font, \"center\", \"center\", false, false, false, true) else dxDrawRectangle(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20,tocolor(0,0,0,180)) dxDrawText(partValue[1],monitorSize[1] - 190+180/2, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16,monitorSize[1] - 190+180/2, 20 + monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, tocolor(255, 255, 255, 255), 1, font, \"center\", \"center\", false, false, false, true) end end end local state = getVehicleTarget()[1] local veh = getVehicleTarget()[2] isPedinVehicle = veh if mechanic_progress_state then mechanic_progress_tick = mechanic_progress_tick + 0.5 if mechanic_progress_tick >= mechanic_progress_max then mechanic_progress_state = false mechanic_progress_tick = 0 callRightFunction(mechanic_progress_text, mechanic_progress_arguments) mechanic_progress_text = \"\" end dxDrawRectangle(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, panelSize[1], panelSize[2],tocolor(0, 0, 0,180)) dxDrawRectangle(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, mechanic_progress_tick, panelSize[2],tocolor(124, 197, 118,180)) dxCreateBorder(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, panelSize[1], panelSize[2],tocolor(0,0,0,255)) dxDrawText(mechanic_progress_text, monitorSize[1]/2 - panelSize[1]/2 + panelSize[1]/2, monitorSize[2] - panelSize[2]-60 +panelSize[2]/2 , monitorSize[1]/2 - panelSize[1]/2 + panelSize[1]/2, monitorSize[2] - panelSize[2]-60 +panelSize[2]/2, tocolor(0, 0, 0, 255), 1, font3, \"center\", \"center\", false, false, false, true) end if not state or getElementData(veh, \"player->repairing\") then return end for k,v in pairs (damageComponents) do if vehicleComponents[v[4]] then local text = v[1] local text_kieg = \"\" local x = vehicleComponents[v[4]][2] local y = vehicleComponents[v[4]][3] if getVehicleComponentVisible(veh, v[4]) then text_kieg = \"leszerelése\" end if not getVehicleComponentVisible(veh, v[4]) then text_kieg = \"felszerelése\" end local width = dxGetTextWidth(text .. \" \" .. text_kieg,1)*1.2 if isInSlot(x-5 - (width+25)/2, y, width+25, 25) then dxDrawRectangle(x-5 - (width+25)/2, y, width+25, 25,tocolor(124, 197, 118,220)) dxDrawText(text .. \" \" .. text_kieg, x - (width+25)/2, y, width+15 + x - (width+25)/2, 25 + y, tocolor(0, 0, 0, 255), 1, font2, \"center\", \"center\", false, false, false, true) else dxDrawRectangle(x-5 - (width+25)/2, y, width+25, 25,tocolor(0, 0, 0,200)) dxDrawText(text .. \" \" .. text_kieg, x - (width+25)/2, y, width+15 + x - (width+25)/2, 25 + y, tocolor(255, 255, 255, 255), 1, font2, \"center\", \"center\", false, false, false, true) end dxCreateBorder(x-5 - (width+25)/2, y, width+25, 25,tocolor(0,0,0,255)) end endendendaddEventHandler(\"onClientRender\", root, drawMechanicPanel)function functionClick(Button, state, playerx, playery)if Button == \"left\" and state == \"down\" and loadingVehicleDamage then if mechanic_progress_state then outputChatBox(\"#19B5FE[ExternalGaming - Mechanic] #ffffffEgyszerre csak egy folyamatot végezhetsz\", 255, 255, 255, true) return end for k,v in pairs (damageComponents) do if vehicleComponents[v[4]] then local text = v[1] local x = vehicleComponents[v[4]][2] local y = vehicleComponents[v[4]][3] local width = dxGetTextWidth(text,1)*1.4 if dobozbaVan(x-5 - (width+25)/2, y, width+25, 25, playerx, playery) then if getVehicleComponentVisible(v[5], v[4]) then mechanic_progress_state = true mechanic_progress_text = v[1]..\" leszerelése folyamatban\" mechanic_progress_tick = 0 mechanic_progress_arguments = {v[1], v[5], v[4]} sound = playSound(\"files/mechanic.mp3\", true) setSoundVolume(sound, 1) setElementData(v[5], \"player->repairing\", true) setElementData(localPlayer, \"player->repairing\", true) triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, \"BOMBER\", \"BOM_Plant\") exports.mta_chat:sendLocalMeMessage(localPlayer,\"elkezdte leszerelni a(z) \".. v[1] .. \"-t\") else if exports[\'mta_item\']:hasItem(localPlayer, v[6], 1) then triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, \"BOMBER\", \"BOM_Plant\", v[6]) mechanic_progress_state = true mechanic_progress_text = v[1]..\" felszerelése folyamatban\" mechanic_progress_tick = 0 mechanic_progress_arguments = {v[1], v[5], v[4]} sound = playSound(\"files/mechanic.mp3\", true) setSoundVolume(sound, 1) exports.mta_chat:sendLocalMeMessage(localPlayer,\"elkezdte felszerelni a(z) \".. v[1] .. \"-t\") setElementData(v[5], \"player->repairing\", true) setElementData(localPlayer, \"player->repairing\", true) updateVehicleComponent(v[5], v[4], \"create\") else outputChatBox(\"#19B5FE[ExternalGaming - Mechanic] #ffffff Nincs meg a megfelelő alkatrész a szereléshez. #7cc576(\" .. exports[\'mta_item\']:getItemName(v[6])..\")\", 255, 255, 255, true) end end end end end for partIndex, partValue in pairs(damageParts) do if dobozbaVan(monitorSize[1]- 110, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 100, 20, playerx, playery) then if partValue[1] == \"Motor javítása\" then triggerServerEvent(\"player->repairEngine\", localPlayer, localPlayer, isPedinVehicle) end end endendendaddEventHandler(\"onClientClick\", getRootElement(), functionClick) function callRightFunction(text, v)if text == v[1]..\" leszerelése folyamatban\" then updateVehicleComponent(v[2], v[3], \"remove\") if isElement(sound) then destroyElement(sound) end triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, nil, nil) setElementData(localPlayer, \"player->repairing\", false)elseif text == v[1]..\" felszerelése folyamatban\" then updateVehicleComponent(v[2], v[3], \"create\") if isElement(sound) then destroyElement(sound) end setElementData(localPlayer, \"player->repairing\", false) triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, nil, nil)elseendsetElementData(v[2], \"player->repairing\", false)endfunction getVehicleTarget()if not isPedInVehicle(localPlayer) and mechanic then vehicleComponents = {} damageParts = {} loadingVehicleDamage = false isPedinVehicle = false local playerX, playerY, playerZ = getElementPosition(localPlayer) for index, value in ipairs (getElementsByType(\"vehicle\")) do local vehicleX, vehicleY, VehicleZ = getElementPosition(value) if getDistanceBetweenPoints3D(playerX, playerY, playerZ, vehicleX, vehicleY, VehicleZ) < 5 then if not loadingVehicleDamage then loadingVehicleDamage = true getVehicleDamagedComponent(value) for componentName in pairs (getVehicleComponents(value)) do local x,y,z = getVehicleComponentPosition (value,componentName,\"world\") local wx,wy,wz = getScreenFromWorldPosition (x,y,z) if wx and wy then vehicleComponents[componentName] = {componentName,wx,wy} end setElementData(value, \"player->repairing\", false) end if (getElementHealth(value) < 999) then damageParts[#damageParts + 1] = {\"Motor javítása\"} end loadingVehicleDamage = true end return {true,value} end end return {false,false}endendfunction getVehicleDamagedComponent(vehicle)if exports[\"exg_dashboard\"]:isPlayerInFaction(11) then if not isElement(vehicle) then return end damageComponents = {} local panelNames = {{\"Bal első panel\",\"\", 67}, {\"Jobb első panel\",\"\", 68}, {\"Bal hátsó panel\",\"\", 69}, {\"Jobb hátsó panel\",\"\", 70}, {\"Szélvédő\",\"windscreen_dummy\", 71}, {\"Első lökhárító\",\"bump_front_dummy\", 72}, {\"Hátsó lökhárító\",\"bump_rear_dummy\", 83}} for i = 0, 6 do local panelState = getVehiclePanelState(vehicle, i) if (panelState ~= 0) then damageComponents[#damageComponents + 1] = {panelNames[i + 1][1], 1, i, panelNames[i + 1][2], vehicle, panelNames[i + 1][3]} --setElementData(vehicle, \"player->panel\", true) -- Beállítás Leszerelésre. end end local doorNames = {{\"Motorháztető\",\"bonnet_dummy\", 73}, {\"Csomagtartó\",\"boot_dummy\", 74}, {\"Bal első ajtó\",\"door_lf_dummy\", 75}, {\"Jobb első ajtó\",\"door_rf_dummy\", 76}, {\"Bal hátsó ajtó\",\"door_lr_dummy\", 77}, {\"Jobb hátsó ajtó\",\"door_rr_dummy\", 78}} for i = 0, 5 do local doorState = getVehicleDoorState(vehicle, i) if (doorState ~= 0) then damageComponents[#damageComponents + 1] = {doorNames[i + 1][1], 2, i, doorNames[i + 1][2], vehicle, doorNames[i + 1][3]} setElementData(vehicle, \"player->door\", 1) -- Beállítás Leszerelésre. end end-- if getElementData(vehicle, \"forklift\") then local wheelNames = {{\"Bal első kerék\",\"wheel_lf_dummy\", 79}, {\"Bal hátsó kerék\",\"wheel_lb_dummy\", 80}, {\"Jobb első kerék\",\"wheel_rf_dummy\", 81}, {\"Jobb hátsó kerék\",\"wheel_rb_dummy\", 82}} local fLeftWheel, rLeftWheel, fRightWheel, rRightWheel = getVehicleWheelStates(vehicle) if (fLeftWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[1][1], 3, 1, wheelNames[1][2], vehicle, wheelNames[1][3]} setElementData(vehicle, \"player->fLeftWheel\", 1) -- Beállítás Leszerelésre. end if (rLeftWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[2][1], 3, 2, wheelNames[2][2], vehicle, wheelNames[2][3]} setElementData(vehicle, \"player->rLeftWheel\", 1) -- Beállítás Leszerelésre. end if (fRightWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[3][1], 3, 3, wheelNames[3][2], vehicle, wheelNames[3][3]} setElementData(vehicle, \"player->fRightWheel\", 1) -- Beállítás Leszerelésre. end if (rRightWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[4][1], 3, 4, wheelNames[4][2], vehicle, wheelNames[4][3]} setElementData(vehicle, \"player->rRightWheel\", 1) -- Beállítás Leszerelésre. end --end return damageComponentsendend-- Component törlésfunction updateVehicleComponent(element, componentName, type)if element and componentName then if type == \"remove\" then triggerServerEvent(\"player->removeComponentFromVehicle\", localPlayer, localPlayer, element, componentName) else triggerServerEvent(\"player->updateComponentVehicle\", localPlayer, localPlayer, element, componentName) if string.find(componentName, \"wheel\") then triggerServerEvent(\"player->repairWheel\", localPlayer, localPlayer, element, componentName) end if componentName == \"windscreen_dummy\" or componentName == \"bump_front_dummy\" or componentName == \"bump_rear_dummy\" then triggerServerEvent(\"player->repairPanel\", localPlayer, localPlayer, element, getDamagedPanelID(componentName)) end if componentName == \"bonnet_dummy\" or componentName == \"boot_dummy\" or componentName == \"door_lf_dummy\" or componentName == \"door_rf_dummy\" or componentName == \"door_lr_dummy\" or componentName == \"door_rr_dummy\" then triggerServerEvent(\"player->repairDoors\", localPlayer, localPlayer, element, getDamagedDoorID(componentName)) end endendendfunction receiveRemove(element, componentName)if element and componentName then setVehicleComponentVisible(element, componentName, false)endendaddEvent(\"player->removeComponentFromVehicleG\", true)addEventHandler(\"player->removeComponentFromVehicleG\", root, receiveRemove)function receiveCreate(element, componentName)if element and componentName then setVehicleComponentVisible(element, componentName, true)endendaddEvent(\"player->updateComponentVehicleG\", true)addEventHandler(\"player->updateComponentVehicleG\", root, receiveCreate)-- Component törlés végelocal panelID = {{\"Front-left panel\", 0}, -- Nem Hasznalt cucc{\"Front-right panel\", 1}, -- Nem Hasznalt cucc{\"Rear-left panel\", 2}, -- Nem Hasznalt cucc{\"Rear-right panel\", 3}, -- Nem Hasznalt cucc{\"windscreen_dummy\", 4},{\"bump_front_dummy\", 5},{\"bump_rear_dummy\", 6},}local doorID = {{\"bonnet_dummy\", 0},{\"boot_dummy\", 1},{\"door_lf_dummy\", 2},{\"door_rf_dummy\", 3},{\"door_lr_dummy\", 4},{\"door_rr_dummy\", 5},}function getDamagedPanelID(componentName)for k, v in ipairs(panelID) do if tostring(componentName) == tostring(v[1]) then return v[2] endendreturn falseendfunction getDamagedDoorID(componentName)for k, v in ipairs(doorID) do if tostring(componentName) == tostring(v[1]) then return v[2] endendreturn falseendfunction isInSlot(xS,yS,wS,hS)if(isCursorShowing()) then XY = {guiGetScreenSize()} local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*XY[1], cursorY*XY[2] if(dobozbaVan(xS,yS,wS,hS, cursorX, cursorY)) then return true else return false endend end function dobozbaVan(dX, dY, dSZ, dM, eX, eY)if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then return trueelse return falseendendfunction dxCreateBorder(x,y,w,h,color)dxDrawRectangle(x,y,w+1,1,color) -- FentdxDrawRectangle(x,y+1,1,h,color) -- Bal OldaldxDrawRectangle(x+1,y+h,w,1,color) -- Lent OldaldxDrawRectangle(x+w,y+1,1,h,color) -- Jobb Oldalend
Itt az egész client oldali script esetleg ha valaki rátudna jönni mi lehet megköszönném if fileExists(\"client.lua\") thenfileDelete(\"client.lua\")end local monitorSize = {guiGetScreenSize()}local panelSize = {350, 30}local vehicleComponents = {}local damageComponents = {}local damageParts = {}local loadingVehicleDamage = falselocal isPedinVehicle = falselocal mechanic = falselocal sound = falselocal font = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",9) --<[ Font ]>--local font2 = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",11) --<[ Font ]>--local font3 = dxCreateFont(\":mta_score/files/myriadproregular.ttf\",10) --<[ Font ]>--local mechanic_progress_tick = 0local mechanic_progress_max = panelSize[1]local mechanic_progress_text = \"\"local mechanic_progress_arguments = {}local ColhapePos = {{1632.9809570313, -2138.9689941406, 13.63906288147, 10, 10,4},{1646.7819824219, -2139.0419921875, 13.63906288147, 10, 10,4},{1619.1810302734, -2139.0419921875, 13.63906288147, 10, 10,4},{1631.8903808594, -2175.7092285156, 13.631258010864, 10, 12,4},{1618.0882568359, -2175.7080078125, 13.631258010864, 10, 12,4},{1604.2884521484, -2175.7080078125, 13.631258010864, 10, 12,4},{1590.4876708984, -2175.7082519531, 13.631258010864, 10, 12,4},}local createdMechanicCols = {}local object1 = {}local objectCol = {}local vehiceLiftPanel = falselocal currentLiftID = 0 addEventHandler(\"onClientResourceStart\", getResourceRootElement(getThisResource()), function()for index, value in ipairs (ColhapePos) do createdMechanicCols[index] = createColCuboid(value[1], value[2], value[3]-1, value[4], value[5], value[6]) setElementData(createdMechanicCols[index], \"mechanic:boxID\", index)end setElementData(localPlayer, \"current\", false)end)local vehicleElement = nil addEventHandler(\"onClientColShapeHit\", getRootElement(),function(player) if player ~= getLocalPlayer() then return end if (source and exports[\"exg_dashboard\"]:isPlayerInFaction(11)) then if (source == createdMechanicCols[getElementData(source, \"mechanic:boxID\")]) then mechanic = true elseif source:getData(\"mechanic:liftID\") and isPedInVehicle(localPlayer) then triggerServerEvent(\"attachFunction\", localPlayer, getPedOccupiedVehicle(localPlayer), source:getData(\"mechanic:liftID\"), 0) currentLiftID = source:getData(\"mechanic:liftID\") vehicleElement = getPedOccupiedVehicle(localPlayer) end endend)addEventHandler(\"onClientColShapeLeave\", getRootElement(),function(player) if player ~= getLocalPlayer() then return end if (source) then if (source == createdMechanicCols[getElementData(source, \"mechanic:boxID\")]) then mechanic = false end endend) function vehicleLiftClick(button, state, x, y, elementx, elementy, elementZ, element)if element and (element:getData(\"mechanic:Object\") or 0) > 0 and not isPedInVehicle(localPlayer) then if state == \"down\" and button == \"right\" and exports[\"exg_dashboard\"]:isPlayerInFaction(11) then local x, y, z = getElementPosition(getLocalPlayer()) if getElementData(element, \"moving\") then outputChatBox(\"#F7CA18[ExternalGaming - Emelő] #ffffffEz az emelő már használatba van próbáld újra.\",255,255,255,true) return end if getElementData(localPlayer, \"current\") then outputChatBox(\"#F7CA18[ExternalGaming - Emelő] #ffffffTe már használsz egy emelőt próbáld később.\",255,255,255,true) return end if getDistanceBetweenPoints3D(x, y, z, elementx, elementy, elementZ) <= 5 then if not vehiceLiftPanel then local liftID = tonumber(element:getData(\"mechanic:Object\") or 0) triggerServerEvent(\"moveObjectFunction\", localPlayer, localPlayer, element, objectTable[liftID][2], objectTable[liftID][3], objectTable[liftID][4]+2) if vehicleElement then setElementData(vehicleElement, \"forklift\", true) end vehiceLiftPanel = true local sound = playSound(\"files/lift.mp3\", true) setTimer(function() if isElement(sound) then stopSound(sound) end end,10000, 1) else local liftID = tonumber(element:getData(\"mechanic:Object\") or 0) if vehicleElement then triggerServerEvent(\"detachFunction\", localPlayer, vehicleElement) setElementData(vehicleElement, \"forklift\", false) end triggerServerEvent(\"moveObjectFunction\", localPlayer, localPlayer, element, objectTable[liftID][2], objectTable[liftID][3], objectTable[liftID][4]) vehiceLiftPanel = false local sound = playSound(\"files/lift.mp3\", true) setTimer(function() if isElement(sound) then stopSound(sound) end end,10000, 1) end end endendendaddEventHandler(\"onClientClick\", root, vehicleLiftClick)function drawMechanicPanel ()if not isPedInVehicle(localPlayer) and mechanic and exports[\"exg_dashboard\"]:isPlayerInFaction(11) then if #damageParts > 0 then dxDrawRectangle(monitorSize[1] - 200, monitorSize[2]/2 - (#damageParts*22 + 10)/2, 200, (#damageParts*22 + 10),tocolor(0,0,0,160)) -- Player Cuccok kirajzolasa ami nemfer componentbe for partIndex, partValue in pairs(damageParts) do dxDrawRectangle(monitorSize[1] - 200, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex / 22 - 16, 200, 20,tocolor(0, 0, 0,240)) dxDrawText(\"ExternalGaming - #7cc576Mechanic\",monitorSize[1] - 200+5, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex / 22 - 16+2, 200, 20, tocolor(255, 255, 255, 255), 1, font, \"left\", \"top\", false, false, false, true) if isInSlot(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20) then dxDrawRectangle(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20,tocolor(124, 197, 118,180)) dxDrawText(partValue[1],monitorSize[1] - 190 +180/2, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, monitorSize[1] - 190+180/2, 20 + monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, tocolor(0, 0, 0, 255), 1, font, \"center\", \"center\", false, false, false, true) else dxDrawRectangle(monitorSize[1] - 190, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 180, 20,tocolor(0,0,0,180)) dxDrawText(partValue[1],monitorSize[1] - 190+180/2, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16,monitorSize[1] - 190+180/2, 20 + monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, tocolor(255, 255, 255, 255), 1, font, \"center\", \"center\", false, false, false, true) end end end local state = getVehicleTarget()[1] local veh = getVehicleTarget()[2] isPedinVehicle = veh if mechanic_progress_state then mechanic_progress_tick = mechanic_progress_tick + 0.5 if mechanic_progress_tick >= mechanic_progress_max then mechanic_progress_state = false mechanic_progress_tick = 0 callRightFunction(mechanic_progress_text, mechanic_progress_arguments) mechanic_progress_text = \"\" end dxDrawRectangle(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, panelSize[1], panelSize[2],tocolor(0, 0, 0,180)) dxDrawRectangle(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, mechanic_progress_tick, panelSize[2],tocolor(124, 197, 118,180)) dxCreateBorder(monitorSize[1]/2 - panelSize[1]/2, monitorSize[2] - panelSize[2]-60, panelSize[1], panelSize[2],tocolor(0,0,0,255)) dxDrawText(mechanic_progress_text, monitorSize[1]/2 - panelSize[1]/2 + panelSize[1]/2, monitorSize[2] - panelSize[2]-60 +panelSize[2]/2 , monitorSize[1]/2 - panelSize[1]/2 + panelSize[1]/2, monitorSize[2] - panelSize[2]-60 +panelSize[2]/2, tocolor(0, 0, 0, 255), 1, font3, \"center\", \"center\", false, false, false, true) end if not state or getElementData(veh, \"player->repairing\") then return end for k,v in pairs (damageComponents) do if vehicleComponents[v[4]] then local text = v[1] local text_kieg = \"\" local x = vehicleComponents[v[4]][2] local y = vehicleComponents[v[4]][3] if getVehicleComponentVisible(veh, v[4]) then text_kieg = \"leszerelése\" end if not getVehicleComponentVisible(veh, v[4]) then text_kieg = \"felszerelése\" end local width = dxGetTextWidth(text .. \" \" .. text_kieg,1)*1.2 if isInSlot(x-5 - (width+25)/2, y, width+25, 25) then dxDrawRectangle(x-5 - (width+25)/2, y, width+25, 25,tocolor(124, 197, 118,220)) dxDrawText(text .. \" \" .. text_kieg, x - (width+25)/2, y, width+15 + x - (width+25)/2, 25 + y, tocolor(0, 0, 0, 255), 1, font2, \"center\", \"center\", false, false, false, true) else dxDrawRectangle(x-5 - (width+25)/2, y, width+25, 25,tocolor(0, 0, 0,200)) dxDrawText(text .. \" \" .. text_kieg, x - (width+25)/2, y, width+15 + x - (width+25)/2, 25 + y, tocolor(255, 255, 255, 255), 1, font2, \"center\", \"center\", false, false, false, true) end dxCreateBorder(x-5 - (width+25)/2, y, width+25, 25,tocolor(0,0,0,255)) end endendendaddEventHandler(\"onClientRender\", root, drawMechanicPanel)function functionClick(Button, state, playerx, playery)if Button == \"left\" and state == \"down\" and loadingVehicleDamage then if mechanic_progress_state then outputChatBox(\"#19B5FE[ExternalGaming - Mechanic] #ffffffEgyszerre csak egy folyamatot végezhetsz\", 255, 255, 255, true) return end for k,v in pairs (damageComponents) do if vehicleComponents[v[4]] then local text = v[1] local x = vehicleComponents[v[4]][2] local y = vehicleComponents[v[4]][3] local width = dxGetTextWidth(text,1)*1.4 if dobozbaVan(x-5 - (width+25)/2, y, width+25, 25, playerx, playery) then if getVehicleComponentVisible(v[5], v[4]) then mechanic_progress_state = true mechanic_progress_text = v[1]..\" leszerelése folyamatban\" mechanic_progress_tick = 0 mechanic_progress_arguments = {v[1], v[5], v[4]} sound = playSound(\"files/mechanic.mp3\", true) setSoundVolume(sound, 1) setElementData(v[5], \"player->repairing\", true) setElementData(localPlayer, \"player->repairing\", true) triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, \"BOMBER\", \"BOM_Plant\") exports.mta_chat:sendLocalMeMessage(localPlayer,\"elkezdte leszerelni a(z) \".. v[1] .. \"-t\") else if exports[\'mta_item\']:hasItem(localPlayer, v[6], 1) then triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, \"BOMBER\", \"BOM_Plant\", v[6]) mechanic_progress_state = true mechanic_progress_text = v[1]..\" felszerelése folyamatban\" mechanic_progress_tick = 0 mechanic_progress_arguments = {v[1], v[5], v[4]} sound = playSound(\"files/mechanic.mp3\", true) setSoundVolume(sound, 1) exports.mta_chat:sendLocalMeMessage(localPlayer,\"elkezdte felszerelni a(z) \".. v[1] .. \"-t\") setElementData(v[5], \"player->repairing\", true) setElementData(localPlayer, \"player->repairing\", true) updateVehicleComponent(v[5], v[4], \"create\") else outputChatBox(\"#19B5FE[ExternalGaming - Mechanic] #ffffff Nincs meg a megfelelő alkatrész a szereléshez. #7cc576(\" .. exports[\'mta_item\']:getItemName(v[6])..\")\", 255, 255, 255, true) end end end end end for partIndex, partValue in pairs(damageParts) do if dobozbaVan(monitorSize[1]- 110, monitorSize[2]/2 - (#damageParts*22 + 10)/2 + partIndex * 22 - 16, 100, 20, playerx, playery) then if partValue[1] == \"Motor javítása\" then triggerServerEvent(\"player->repairEngine\", localPlayer, localPlayer, isPedinVehicle) end end endendendaddEventHandler(\"onClientClick\", getRootElement(), functionClick) function callRightFunction(text, v)if text == v[1]..\" leszerelése folyamatban\" then updateVehicleComponent(v[2], v[3], \"remove\") if isElement(sound) then destroyElement(sound) end triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, nil, nil) setElementData(localPlayer, \"player->repairing\", false)elseif text == v[1]..\" felszerelése folyamatban\" then updateVehicleComponent(v[2], v[3], \"create\") if isElement(sound) then destroyElement(sound) end setElementData(localPlayer, \"player->repairing\", false) triggerServerEvent(\"playerAnimationToServer\", localPlayer, localPlayer, nil, nil)elseendsetElementData(v[2], \"player->repairing\", false)endfunction getVehicleTarget()if not isPedInVehicle(localPlayer) and mechanic then vehicleComponents = {} damageParts = {} loadingVehicleDamage = false isPedinVehicle = false local playerX, playerY, playerZ = getElementPosition(localPlayer) for index, value in ipairs (getElementsByType(\"vehicle\")) do local vehicleX, vehicleY, VehicleZ = getElementPosition(value) if getDistanceBetweenPoints3D(playerX, playerY, playerZ, vehicleX, vehicleY, VehicleZ) < 5 then if not loadingVehicleDamage then loadingVehicleDamage = true getVehicleDamagedComponent(value) for componentName in pairs (getVehicleComponents(value)) do local x,y,z = getVehicleComponentPosition (value,componentName,\"world\") local wx,wy,wz = getScreenFromWorldPosition (x,y,z) if wx and wy then vehicleComponents[componentName] = {componentName,wx,wy} end setElementData(value, \"player->repairing\", false) end if (getElementHealth(value) < 999) then damageParts[#damageParts + 1] = {\"Motor javítása\"} end loadingVehicleDamage = true end return {true,value} end end return {false,false}endendfunction getVehicleDamagedComponent(vehicle)if exports[\"exg_dashboard\"]:isPlayerInFaction(11) then if not isElement(vehicle) then return end damageComponents = {} local panelNames = {{\"Bal első panel\",\"\", 67}, {\"Jobb első panel\",\"\", 68}, {\"Bal hátsó panel\",\"\", 69}, {\"Jobb hátsó panel\",\"\", 70}, {\"Szélvédő\",\"windscreen_dummy\", 71}, {\"Első lökhárító\",\"bump_front_dummy\", 72}, {\"Hátsó lökhárító\",\"bump_rear_dummy\", 83}} for i = 0, 6 do local panelState = getVehiclePanelState(vehicle, i) if (panelState ~= 0) then damageComponents[#damageComponents + 1] = {panelNames[i + 1][1], 1, i, panelNames[i + 1][2], vehicle, panelNames[i + 1][3]} --setElementData(vehicle, \"player->panel\", true) -- Beállítás Leszerelésre. end end local doorNames = {{\"Motorháztető\",\"bonnet_dummy\", 73}, {\"Csomagtartó\",\"boot_dummy\", 74}, {\"Bal első ajtó\",\"door_lf_dummy\", 75}, {\"Jobb első ajtó\",\"door_rf_dummy\", 76}, {\"Bal hátsó ajtó\",\"door_lr_dummy\", 77}, {\"Jobb hátsó ajtó\",\"door_rr_dummy\", 78}} for i = 0, 5 do local doorState = getVehicleDoorState(vehicle, i) if (doorState ~= 0) then damageComponents[#damageComponents + 1] = {doorNames[i + 1][1], 2, i, doorNames[i + 1][2], vehicle, doorNames[i + 1][3]} setElementData(vehicle, \"player->door\", 1) -- Beállítás Leszerelésre. end end-- if getElementData(vehicle, \"forklift\") then local wheelNames = {{\"Bal első kerék\",\"wheel_lf_dummy\", 79}, {\"Bal hátsó kerék\",\"wheel_lb_dummy\", 80}, {\"Jobb első kerék\",\"wheel_rf_dummy\", 81}, {\"Jobb hátsó kerék\",\"wheel_rb_dummy\", 82}} local fLeftWheel, rLeftWheel, fRightWheel, rRightWheel = getVehicleWheelStates(vehicle) if (fLeftWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[1][1], 3, 1, wheelNames[1][2], vehicle, wheelNames[1][3]} setElementData(vehicle, \"player->fLeftWheel\", 1) -- Beállítás Leszerelésre. end if (rLeftWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[2][1], 3, 2, wheelNames[2][2], vehicle, wheelNames[2][3]} setElementData(vehicle, \"player->rLeftWheel\", 1) -- Beállítás Leszerelésre. end if (fRightWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[3][1], 3, 3, wheelNames[3][2], vehicle, wheelNames[3][3]} setElementData(vehicle, \"player->fRightWheel\", 1) -- Beállítás Leszerelésre. end if (rRightWheel ~= 0) then damageComponents[#damageComponents + 1] = {wheelNames[4][1], 3, 4, wheelNames[4][2], vehicle, wheelNames[4][3]} setElementData(vehicle, \"player->rRightWheel\", 1) -- Beállítás Leszerelésre. end --end return damageComponentsendend-- Component törlésfunction updateVehicleComponent(element, componentName, type)if element and componentName then if type == \"remove\" then triggerServerEvent(\"player->removeComponentFromVehicle\", localPlayer, localPlayer, element, componentName) else triggerServerEvent(\"player->updateComponentVehicle\", localPlayer, localPlayer, element, componentName) if string.find(componentName, \"wheel\") then triggerServerEvent(\"player->repairWheel\", localPlayer, localPlayer, element, componentName) end if componentName == \"windscreen_dummy\" or componentName == \"bump_front_dummy\" or componentName == \"bump_rear_dummy\" then triggerServerEvent(\"player->repairPanel\", localPlayer, localPlayer, element, getDamagedPanelID(componentName)) end if componentName == \"bonnet_dummy\" or componentName == \"boot_dummy\" or componentName == \"door_lf_dummy\" or componentName == \"door_rf_dummy\" or componentName == \"door_lr_dummy\" or componentName == \"door_rr_dummy\" then triggerServerEvent(\"player->repairDoors\", localPlayer, localPlayer, element, getDamagedDoorID(componentName)) end endendendfunction receiveRemove(element, componentName)if element and componentName then setVehicleComponentVisible(element, componentName, false)endendaddEvent(\"player->removeComponentFromVehicleG\", true)addEventHandler(\"player->removeComponentFromVehicleG\", root, receiveRemove)function receiveCreate(element, componentName)if element and componentName then setVehicleComponentVisible(element, componentName, true)endendaddEvent(\"player->updateComponentVehicleG\", true)addEventHandler(\"player->updateComponentVehicleG\", root, receiveCreate)-- Component törlés végelocal panelID = {{\"Front-left panel\", 0}, -- Nem Hasznalt cucc{\"Front-right panel\", 1}, -- Nem Hasznalt cucc{\"Rear-left panel\", 2}, -- Nem Hasznalt cucc{\"Rear-right panel\", 3}, -- Nem Hasznalt cucc{\"windscreen_dummy\", 4},{\"bump_front_dummy\", 5},{\"bump_rear_dummy\", 6},}local doorID = {{\"bonnet_dummy\", 0},{\"boot_dummy\", 1},{\"door_lf_dummy\", 2},{\"door_rf_dummy\", 3},{\"door_lr_dummy\", 4},{\"door_rr_dummy\", 5},}function getDamagedPanelID(componentName)for k, v in ipairs(panelID) do if tostring(componentName) == tostring(v[1]) then return v[2] endendreturn falseendfunction getDamagedDoorID(componentName)for k, v in ipairs(doorID) do if tostring(componentName) == tostring(v[1]) then return v[2] endendreturn falseendfunction isInSlot(xS,yS,wS,hS)if(isCursorShowing()) then XY = {guiGetScreenSize()} local cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*XY[1], cursorY*XY[2] if(dobozbaVan(xS,yS,wS,hS, cursorX, cursorY)) then return true else return false endend end function dobozbaVan(dX, dY, dSZ, dM, eX, eY)if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then return trueelse return falseendendfunction dxCreateBorder(x,y,w,h,color)dxDrawRectangle(x,y,w+1,1,color) -- FentdxDrawRectangle(x,y+1,1,h,color) -- Bal OldaldxDrawRectangle(x+1,y+h,w,1,color) -- Lent OldaldxDrawRectangle(x+w,y+1,1,h,color) -- Jobb Oldalend
if fileExists(\"client.lua\") thenfileDelete(\"client.lua\")end