RandomRambo Posted April 29, 2022 Share Posted April 29, 2022 (edited) Hello guys. How I can remove function(?) or idk what when player is close to loot and another one player is close too, the menu just going to disable and inventory just closing. How is it possible to fix if 2 players close to loot spawn the menu and inventory won't be closed (I think the creator did it to avoid dupe,but I need to remove it). I know that it is somewhere in menu_client.lua,I tried to find what is responsible for it in this file but I didn't find. If anyone knows,help please. menu_clent.lua: local theTableMenuScroll = {} function startRollMessageMenu(text, r, g, b, data) table.insert(theTableMenuScroll,{text,r,g,b,data}) end vehicleAddonsInfo = { -- {Model ID, Tires, Engine, Tank Parts} {500,4,1,1}, --Mesa {568,4,1,1}, --Bandito {512,0,1,1}, --Cropduster {476,0,1,1}, --rust {483,4,1,1}, --camper {422,4,1,1}, --Bobcat {470,4,1,1}, --Patriot {471,4,1,1}, --Quad {404,4,1,1}, --Perenniel {531,4,1,1}, --Tractor {468,2,1,1}, --Sanchez {433,6,1,1}, --Barracks {437,6,1,1}, --Coach {509,0,0,0}, --Bike {487,0,1,1}, --Maverick {497,0,1,1}, --Police Maverik {453,0,1,1} -- Reffer } function getVehicleAddonInfos (id) for i,veh in ipairs(vehicleAddonsInfo) do if veh[1] == id then return veh[2],veh[3], veh[4] end end end function dxDrawingColorTextMenuScroll(str, ax, ay, bx, by, color, alpha, scale, font, alignX, alignY) if alignX then if alignX == "center" then elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), alpha) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), alpha) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end local boxSpace = dxGetFontHeight(1,"default-bold")+dxGetFontHeight(1,"default-bold")*0.1 local optionsTable = { ["player"] = { {"Give Painkillers"}, {"Give Bandage"}, {"Give Morphine"}, }, } ------------------------------------------------------------------------------ --MENU function showClientMenuItem(arg1,arg2,arg3,arg4) theTableMenuScroll = {} setElementData(localPlayer,"usedItemTrue", false) numberMenuScroll = 1 if arg1 == "Take" then startRollMessageMenu("Подобрать "..arg2,50,255,50,arg2) setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "stop" then disableMenu() refreshLoot(false) end if arg1 == "Helicrashsite" then startRollMessageMenu("Обыскать",255,255,255,"helicrashsite") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Hospitalbox" then startRollMessageMenu("Содержимое",255,255,255,"hospitalbox") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Vehicle" then startRollMessageMenu("Содержимое ("..arg2.."): "..getLootCurrentSlots(arg4).."/"..(getElementData(arg4,"MAX_Slots") or 0).." слотов",0,255,0,"vehicle") setElementData(localPlayer,"usedItemTrue", true) if getElementData(getElementData(arg3,"parent"),"tent") then startRollMessageMenu("Убрать палатку",0,255,0,"tent") return end --2 if getElementHealth(arg3) < 1000 and getElementHealth(arg3) >= 50 then startRollMessageMenu("Починить ("..arg2.."): " ..tostring(math.floor(getElementHealth(arg3)/10)).."%",0,255,0,"repairvehicle") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"fuel") or 0) < getVehicleMaxFuel(arg4) then startRollMessageMenu("Заправить ("..tostring(math.floor(getElementData(arg4,"fuel") or 0)).."/"..getVehicleMaxFuel(arg4)..")",255,0,0,"FuelOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"fuel") or 0) >= 20 then startRollMessageMenu("Слить бензин ("..tostring(math.floor(getElementData(arg4,"fuel") or 0)).."/"..getVehicleMaxFuel(arg4)..")",255,255,0,"FuelTwo") setElementData(localPlayer,"usedItemTrue", true) end local tires,engine,parts = getVehicleAddonInfos (getElementModel(arg3)) if (getElementData(arg4,"Колесо_inVehicle") or 0) < tires then startRollMessageMenu("Поставить колесо ("..(getElementData(arg4,"Колесо_inVehicle") or 0).."/"..tires..")",255,0,0,"TireOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Двигатель_inVehicle") or 0) < engine then startRollMessageMenu("Поставить двигатель ("..(getElementData(arg4,"Двигатель_inVehicle") or 0).."/"..engine..")",255,0,0,"EngineOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Parts_inVehicle") or 0) < parts then startRollMessageMenu("Поставить Бензобак ("..(getElementData(arg4,"Parts_inVehicle") or 0).."/"..parts..")",255,0,0,"PartsOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Колесо_inVehicle") or 0) > 0 then startRollMessageMenu("Снять колесо ("..(getElementData(arg4,"Колесо_inVehicle") or 0).."/"..tires..")",255,255,0,"TireTwo") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Двигатель_inVehicle") or 0) > 0 then startRollMessageMenu("Снять двигатель ("..(getElementData(arg4,"Двигатель_inVehicle") or 0).."/"..engine..")",255,255,0,"EngineTwo") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Parts_inVehicle") or 0) > 0 then startRollMessageMenu("Снять Бензобак ("..(getElementData(arg4,"Parts_inVehicle") or 0).."/"..parts..")",255,255,0,"PartsTwo") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Player" then --1 if getElementData(arg2,"bleeding") > 0 and getElementData(getLocalPlayer(),"Бинт") >= 1 then startRollMessageMenu("Перевязать",255,255,255,"bandage") setElementData(localPlayer,"usedItemTrue", true) end if getElementData(arg2,"blood") < 11900 and getElementData(getLocalPlayer(),"Пакет крови") >= 1 then startRollMessageMenu("Пополнить кровь",255,255,255,"giveblood") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Dead" then startRollMessageMenu("Содержимое ("..arg2..")",0,255,0,"dead") startRollMessageMenu("Осмотреть тело",0,255,0,"deadreason") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Fireplace" then if getElementData(getLocalPlayer(),"Сырое мясо") >= 1 then startRollMessageMenu("Приготовить мясо",255,255,255,"fireplace") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "patrol" then if getElementData(getLocalPlayer(),"Пустая канистра") >= 1 then startRollMessageMenu("Наполнить канистру",255,255,255,"patrolstation") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Wirefence" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then startRollMessageMenu("Убрать проволоку",255,255,255,"wirefence") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "SandBags" then if getElementData(getLocalPlayer(),"Лопата") >= 1 then startRollMessageMenu("Убрать мешки с песком",255,255,255,"sandbags") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Mine" then if getElementData(getLocalPlayer(),"Лопата") >= 1 then startRollMessageMenu("Убрать мину",255,255,255,"wirefence") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Содержимое" then startRollMessageMenu("Содержимое",255,255,255,"itemloot") setElementData(localPlayer,"usedItemTrue", true) end numberMenuScroll = 1 end addEvent("showClientMenuItem",true) addEventHandler("showClientMenuItem",getLocalPlayer(),showClientMenuItem) function PlayerScrollMenuLalitka (key,keyState,arg) if getElementData(localPlayer,"usedItemTrue") then if ( keyState == "down" ) then if arg == "up" then numberMenuScroll = numberMenuScroll-1 if numberMenuScroll < 1 then numberMenuScroll = #theTableMenuScroll end elseif arg == "down" then numberMenuScroll = numberMenuScroll+1 if numberMenuScroll > #theTableMenuScroll then numberMenuScroll = 1 end end end end end bindKey ( "mouse_wheel_up", "down", PlayerScrollMenuLalitka, "up" ) bindKey ( "mouse_wheel_down", "down", PlayerScrollMenuLalitka, "down" ) function disableMenu() theTableMenuScroll = {} setElementData(localPlayer,"usedItemTrue", false) setNewbieInfo (false,"","") end addEvent("disableMenu",true) addEventHandler("disableMenu",getLocalPlayer(),disableMenu) function getPlayerInCol(tab) for theKey,thePlayer in ipairs(tab) do if thePlayer ~= getLocalPlayer() then return true end end return false end isInFirePlace = false function onPlayerTargetPickup (theElement) if theElement == getLocalPlayer() then if getElementData(source,"parent") == getLocalPlayer() then return end local player = getPlayerInCol(getElementsWithinColShape ( source, "player" )) if getPedOccupiedVehicle(getLocalPlayer()) then return end isInFirePlace = false setElementData(getLocalPlayer(),"isInFirePlace",false) if getElementData(source,"player") then showClientMenuItem("Player",getElementData(source,"parent")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) return end if player then return end if getElementData(source,"patrolstation") then showClientMenuItem("patrol") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"АЗС","Нажмите среднюю кнопку мыши для того чтобы нполнить канистру!\n Необходима: Пустая канистра",source) return end if getElementData(source,"wirefence") then showClientMenuItem("Wirefence") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Wirefence","Нажмите среднюю кнопку мыши для того чтобы убрать проволоку!\n Необходимы: Инструменты",source) return end if getElementData(source,"sandbags") then showClientMenuItem("SandBags") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Мешки с песком","Нажмите среднюю кнопку мыши чтобы убрать мешки с песком!\n Требуется:Лопата",source) return end if getElementData(source,"mine") then showClientMenuItem("Mine") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Мина","Нажмите среднюю кнопку мыши чтобы убрать Мину!\n Требуется:Лопата",source) return end if getElementData(source,"fireplace") then showClientMenuItem("Fireplace") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Fireplace","Нажмите среднюю кнопку мыши для того чтобы приготовить мясо!\n Необходимо: Сырое мясо",source) isInFirePlace = true setElementData(getLocalPlayer(),"isInFirePlace",true) return end if getElementData(source,"deadman") then showClientMenuItem("Dead",getElementData(source,"playername")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Осмотреть ("..getElementData(source,"playername")..")") setNewbieInfo (true,"Содержимое","Нажмите J чтобы открыть инвентарь!",source) return end if getElementData(source,"item") then showClientMenuItem("Take",getElementData(source,"item")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Содержимое","Нажмите среднюю кнопку мыши чтобы подобрать предмет!",source) return end if getElementData(source,"helicrash") then showClientMenuItem("Helicrashsite","helicrash") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Обыскать") --(Helicrash) setNewbieInfo (true,"Содержимое","Нажмите J чтобы открыть инвентарь!",source) return end if getElementData(source,"hospitalbox") then showClientMenuItem("Hospitalbox","hospitalbox") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Обыскать (Hospitalbox)") setNewbieInfo (true,"Содержимое","Нажмите J чтобы открыть инвентарь!",source) return end if getElementData(source,"vehicle") then if not getElementData(source,"deadVehicle") then showClientMenuItem("Vehicle",(getVehicleName(getElementData(source,"parent")) or "Палатка"),getElementData(source,"parent"),source) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Обыскать ("..(getVehicleName(getElementData(source,"parent")) or "Палатка")..")") setNewbieInfo (true,"Содержимое","Нажмите J чтобы открыть инвентарь!",source) return end end if getElementData(source,"itemloot") then showClientMenuItem("Содержимое") setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Содержимое") setElementData(getLocalPlayer(),"currentCol",source) setNewbieInfo (true,"Содержимое","Нажмите J чтобы открыть инвентарь!",source) return end showClientMenuItem("stop") end end addEventHandler("onClientColShapeHit",getRootElement(),onPlayerTargetPickup) function onPlayerTargetPickup (theElement) if theElement == getLocalPlayer() then local players = getElementsWithinColShape ( source, "player" ) if players == getLocalPlayer() then --[[return ]]end showClientMenuItem("stop") setElementData(getLocalPlayer(),"loot",false) setElementData(getLocalPlayer(),"currentCol",false) setNewbieInfo (false,"","") isInFirePlace = false setElementData(getLocalPlayer(),"isInFirePlace",false) end end addEventHandler("onClientColShapeLeave",getRootElement(),onPlayerTargetPickup) --Newbie Infos local screenWidth, screenHeight = guiGetScreenSize() local newbieShow = false local newbieHead = "-" local newbieText = "-" local newbiePosition = 0,0,0 function setNewbieInfo (show,head,text,element) newbieShow = show newbieHead = head newbieText = text newbiePosition = element end addEventHandler("onClientRender", getRootElement(), function() local veh = getPedOccupiedVehicle (getLocalPlayer()) if veh then disableMenu() else for id, value in pairs(theTableMenuScroll) do if id == numberMenuScroll then r1menu,g1menu,b1menu = 25,153,25 else r1menu,g1menu,b1menu = 19,19,19 end dxDrawRectangle ( 0, 250+id*boxSpace, screenWidth*0.2, boxSpace, tocolor (r1menu,g1menu,b1menu,180) ) dxDrawingColorTextMenuScroll(value[1],6, 250+id*boxSpace, 6, 250+(id+1)*boxSpace, tocolor(value[2],value[3],value[4],170),170, 1, "default-bold", "center", "center") end end if newbieShow == false then return end local x,y,z = getElementPosition(newbiePosition) local x,y = getScreenFromWorldPosition (x,y,z) local length = dxGetTextWidth(newbieText,1,"default-bold") if x then dxDrawingColorText(newbieHead,x-length/2-screenWidth*0.01,y, x+length/2+screenWidth*0.01, y+screenHeight*0.03, tocolor(22,255,22,120),0.5, 1.1, "default-bold", "center", "center") dxDrawingColorText(newbieText,x-length/2-screenWidth*0.01,y+screenHeight*0.03, x+length/2+screenWidth*0.01, y+screenHeight*0.07, tocolor(22,255,22,120),0.5, 1, "default-bold", "center", "center") end end ) function fireRaiseTemperature () if isInFirePlace then if getElementData(getLocalPlayer(),"temperature") <= 38 then setElementData(getLocalPlayer(),"temperature",getElementData(getLocalPlayer(),"temperature")+0.25) end end end setTimer(fireRaiseTemperature,10000,0) ------------------------------------------------------------------------------ unbindKey("mouse3","both") function onPlayerPressMiddleMouse (key,keyState) if ( keyState == "down" ) then if not getElementData(localPlayer,"usedItemTrue") then return end local itemName = getMenuMarkedItem() if itemName == "helicrashsite" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Обыскать (Helicrash)" -- Helicrash refreshLoot(col,gearName) showInventoryManual() return end if itemName == "itemloot" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Содержимое" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "wirefence" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Remove Wirefence" triggerServerEvent("removeWirefence",getLocalPlayer(),getElementData(col,"parent")) disableMenu() return end if itemName == "sandbags" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Убрать мешки с песком" triggerServerEvent("removeSandBags",getLocalPlayer(),getElementData(col,"parent")) disableMenu() return end if itemName == "mine" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Убрать мину" triggerServerEvent("removeSandBags",getLocalPlayer(),getElementData(col,"parent")) disableMenu() return end if itemName == "hospitalbox" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Обыскать (Hospitalbox)" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "vehicle" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Обыскать ("..(getVehicleName(getElementData(col,"parent")) or "Палатка")..")" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "repairvehicle" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("repairVehicle",getLocalPlayer(),getElementData(col,"parent")) else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "FuelOne" then if (getElementData(getLocalPlayer(),"Наполненная канистра") or 0) >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if getElementData(col,"fuel")+20 < getVehicleMaxFuel(col) then addingfuel = 20 elseif getElementData(col,"fuel")+20 > getVehicleMaxFuel(col)+15 then triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Бак полный!",255,22,0) disableMenu() return else addingfuel = getVehicleMaxFuel(col)-getElementData(col,"fuel") end if (getElementData(col,"Parts_inVehicle") or 0) < 1 then addingfuel = addingfuel/3 triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Из транспорта вылилась часть бензина!",22,255,0) end setElementData(getLocalPlayer(),"Наполненная канистра",getElementData(getLocalPlayer(),"Наполненная канистра")-1) setElementData(getLocalPlayer(),"Пустая канистра",(getElementData(getLocalPlayer(),"Пустая канистра") or 0)+1) setElementData(col,"fuel",getElementData(col,"fuel")+addingfuel) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Транспорт заправлен на "..addingfuel.." л.!",22,255,0) else startRollMessage2("Inventory", "У Вас нет пустой канистры!", 255, 22, 0 ) end disableMenu() return end if itemName == "FuelTwo" then if (getElementData(getLocalPlayer(),"Пустая канистра") or 0) >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(getLocalPlayer(),"Наполненная канистра",getElementData(getLocalPlayer(),"Наполненная канистра")+1) setElementData(getLocalPlayer(),"Пустая канистра",(getElementData(getLocalPlayer(),"Пустая канистра") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) setElementData(col,"fuel",getElementData(col,"fuel")-20) triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Вы слили 20л. бензина!",22,255,0) else startRollMessage2("Inventory", "У Вас нет пустой канистры!", 255, 22, 0 ) end disableMenu() return end if itemName == "TireOne" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then if (getElementData(getLocalPlayer(),"Колесо") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Колесо_inVehicle",(getElementData(col,"Колесо_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Колесо",(getElementData(getLocalPlayer(),"Колесо") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы поставили одно колесо!", 22, 255, 0 ) else startRollMessage2("Inventory", "У Вас нет колес!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "TireTwo" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Колесо_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Колесо_inVehicle",(getElementData(col,"Колесо_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Колесо",(getElementData(getLocalPlayer(),"Колесо") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы сняли одно колесо!", 22, 255, 0 ) else startRollMessage2("Inventory", "В транспорте нет колес!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "EngineOne" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then if (getElementData(getLocalPlayer(),"Двигатель") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Двигатель_inVehicle",(getElementData(col,"Двигатель_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Двигатель",(getElementData(getLocalPlayer(),"Двигатель") or 0)-1) ---triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы поставили один двигатель!", 22, 255, 0 ) else startRollMessage2("Inventory", "У Вас нет двигателя!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "EngineTwo" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Двигатель_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Двигатель_inVehicle",(getElementData(col,"Двигатель_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Двигатель",(getElementData(getLocalPlayer(),"Двигатель") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы сняли один двигатель!", 22, 255, 0 ) else startRollMessage2("Inventory", "В транспорте нет двигателя!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "PartsOne" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then if (getElementData(getLocalPlayer(),"Бензобак") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Parts_inVehicle",(getElementData(col,"Parts_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Бензобак",(getElementData(getLocalPlayer(),"Бензобак") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы поставили Бензобак!", 22, 255, 0 ) else startRollMessage2("Inventory", "У Вас нет Бензобака!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "PartsTwo" then if getElementData(getLocalPlayer(),"Инструменты") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Parts_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Parts_inVehicle",(getElementData(col,"Parts_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Бензобак",(getElementData(getLocalPlayer(),"Бензобак") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Вы сняли Бензобак!", 22, 255, 0 ) else startRollMessage2("Inventory", "В транспорте нет Бензобака!", 255, 22, 0 ) end else startRollMessage2("Inventory", "У Вас нет Инструментов!", 255, 22, 0 ) end disableMenu() return end if itemName == "tent" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("removeTent",getLocalPlayer(),getElementData(col,"parent")) disableMenu() return end if itemName == "fireplace" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("addPlayerCookMeat",getLocalPlayer()) disableMenu() return end if itemName == "бинт" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerGiveMedicObject",getLocalPlayer(),itemName,getElementData(col,"parent")) disableMenu() return end if itemName == "giveblood" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerGiveMedicObject",getLocalPlayer(),itemName,getElementData(col,"parent")) disableMenu() return end if itemName == "dead" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Содержимое ("..getElementData(col,"playername")..")" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "deadreason" then local col = getElementData(getLocalPlayer(),"currentCol") outputChatBox(getElementData(col,"deadreason"),255,255,255,true) return end if itemName == "patrolstation" then local col = getElementData(getLocalPlayer(),"currentCol") setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant",nil,false,false,nil,false) setElementData(getLocalPlayer(),"Пустая канистра",getElementData(getLocalPlayer(),"Пустая канистра")-1) setElementData(getLocalPlayer(),"Наполненная канистра",(getElementData(getLocalPlayer(),"Наполненная канистра") or 0)+1) triggerEvent ("displayClientInfo",getLocalPlayer(),"patrolstation","Канистра заполнена!",22,255,0) disableMenu() return end if isToolbeltItem(itemName) then local col = getElementData(getLocalPlayer(), "currentCol") if #getElementsWithinColShape(col, "player") > 1 or getNetworkStats().packetlossLastSecond > 1 then return end x, y, z = getElementPosition(getLocalPlayer()) if pcount ~= nil and pcount < getTickCount() then pcount = getTickCount() + math.random(1800,2200) x, y, z = getElementPosition(getLocalPlayer()) return false elseif pcount == nil then pcount = getTickCount() + math.random(1800,2200) x, y, z = getElementPosition(getLocalPlayer()) return false end local x1, y1, z1 = getElementPosition(getLocalPlayer()) if x1 ~= x or y1 ~= y or z1 ~= z then pcount = nil return false end pcount = nil triggerServerEvent("onPlayerTakeItemFromGround", getLocalPlayer(), itemName, col) disableMenu() return end if itemName == "Assault Pack (ACU)" or itemName == "Alice Pack" or itemName == "Czech Backpack" or itemName == "Рюкзак Military" or itemName =="Serial Backpack" or itemName == "Coyote Backpack" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerTakeItemFromGround",getLocalPlayer(),itemName,col) disableMenu() return end if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then local col = getElementData(getLocalPlayer(), "currentCol") if #getElementsWithinColShape(col, "player") > 1 or getNetworkStats().packetlossLastSecond > 1 then return end x, y, z = getElementPosition(getLocalPlayer()) if pcount ~= nil and pcount < getTickCount() then pcount = getTickCount() + math.random(1800,2200) x, y, z = getElementPosition(getLocalPlayer()) return false elseif pcount == nil then pcount = getTickCount() + math.random(1800,2200) x, y, z = getElementPosition(getLocalPlayer()) return false end local x1, y1, z1 = getElementPosition(getLocalPlayer()) if x1 ~= x or y1 ~= y or z1 ~= z then pcount = nil return false end pcount = nil triggerServerEvent("onPlayerTakeItemFromGround", getLocalPlayer(), itemName, col) disableMenu() else startRollMessage2("Inventory", "Инвентарь заполнен!", 255, 22, 0) end end end bindKey ( "mouse3", "down", onPlayerPressMiddleMouse ) bindKey ( "-", "down", onPlayerPressMiddleMouse ) function getMenuMarkedItem() for i,guiItem in ipairs(spalteGuiText) do if getElementData(guiItem,"markedMenuItem") then return getElementData(guiItem,"usedItem") end end end function playerPressedKey(button, press) if (press) then if button == "w" or button == "a" or button == "s" or button == "d" then local anim,anim2 = getPedAnimation (getLocalPlayer()) if anim and anim == "SCRATCHING" and anim2 == "sclng_r" then triggerServerEvent("onClientMovesWhileAnimation",getLocalPlayer()) end end end end function getMenuMarkedItem() for id, value in pairs(theTableMenuScroll) do if id == numberMenuScroll then return value[5] end end end Edited April 29, 2022 by RandomRambo Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now