Hesham_Alking Posted October 3, 2013 Share Posted October 3, 2013 السلام عليكم اخواني الكرام انا لاقيت مود حلو لتغيير انوار السيارة وركبته viewtopic.php?f=108&t=47773 بس عشان تطلع لك نافذة المود لازم تكتب كلمة بالشات /lights انا ابي اغير هذه الكلمة لزر يعني مثلا لما اضغط f3 تضهر لك النافذة وهذا كود المود كيف اعدل عليه ؟ local lights = { "High Quality", "Blue Doom", "Blue Estrellas", "Blue Flecha", "Blue Neon HQ", "Blue Oblique", "Blue X", "Colored", "Green FFS", "Green Mustang", "Green Onda", "Green Paradise", "Grey Audi I", "MEME Derp HQ", "MEME Me Gusta HQ", "MEME Troll HQ", "Orange Cupido", "Orange Led", "Orange Lines", "Pink Dots", "Purple I", "Purple II", "Red Alfa Romeo", "Red Alien", "Red Angry Mouth", "Red Angry Shape", "Red Audi I", "Red Audi II", "Red Audi III", "Red BMW I", "Red BMW II", "Red BMW M5", "Red Canibus", "Red Chevrolet Malibu", "Red Citroen Survolt", "Red Cupido", "Red Curve", "Red Curves HQ", "Red Dino", "Red Double Oval", "Red Double Ring", "Red Double Ring Led", "Red Double Rounded Restangles HQ", "Red Double Stripes", "Red Fast Line", "Red FFS", "Red Infiniti Electric", "Red KIA", "Red Lamborghini", "Red Lexus", "Red Lines", "Red Metropolis", "Red Mustang", "Red Passat", "Red Peugeot", "Red Rhombus", "Red Ring", "Red Sexy", "Red Slanted Stripes", "Red Spray", "Red Subaru", "Red The N", "Red The X", "Red The Y", "Red Triangles", "Red Triple Stripes", "Red Volkswagen", "Violet Lilac", "White Slanted Stripes", "White Snake" } local shaders = {} local currentLight = "high quality" local drawLights = true addEventHandler("onClientResourceStart",resourceRoot, function () currentLight = getCookieOption("lights") or "high quality" setElementData(localPlayer,"vehiclelight",currentLight,true) if getCookieOption("draw") ~= "false" then for i,vehicle in ipairs (getElementsByType("vehicle")) do loadVehicleLights(vehicle) end end end ) addEventHandler("onClientElementStreamIn",root, function () if getElementType(source) == "vehicle" then loadVehicleLights(source) end end ) addEventHandler("onClientVehicleEnter",root, function () loadVehicleLights(source) end ) function loadVehicleLights (vehicle) local controller = getVehicleController(vehicle) if not controller then return end local image = getElementData(controller,"vehiclelight") if not image then return end if not shaders[image] then local texture = dxCreateTexture("images/"..image..".jpg","dxt3") local shader = dxCreateShader("lights.fx") dxSetShaderValue(shader,"gTexture",texture) shaders[image] = shader end engineApplyShaderToWorldTexture(shaders[image],"vehiclelights128",vehicle) engineApplyShaderToWorldTexture(shaders[image],"vehiclelightson128",vehicle) -- needs messing with alpha end function unloadVehicleLights (vehicle) local controller = getVehicleController(vehicle) if not controller then return end local image = getElementData(controller,"vehiclelight") if not image then return end engineRemoveShaderFromWorldTexture(shaders[image],"vehiclelights128",vehicle) engineRemoveShaderFromWorldTexture(shaders[image],"vehiclelightson128",vehicle) end function saveChanges (btn) if btn ~= "left" then return end if guiCheckBoxGetSelected(drawlightsCheckBox) ~= drawLights then local drawlights = guiCheckBoxGetSelected(drawlightsCheckBox) if drawlights then for i,vehicle in ipairs (getElementsByType("vehicle")) do loadVehicleLights(vehicle) end else for i,vehicle in ipairs (getElementsByType("vehicle")) do unloadVehicleLights(vehicle) end for name,shader in pairs (shaders) do destroyElement(shader) shaders[name] = nil end end setCookieOption("draw",tostring(drawlights)) end local image = guiComboBoxGetItemText(lightsComboBox,guiComboBoxGetSelected(lightsComboBox)) if image ~= currentLight then currentLight = image setElementData(localPlayer,"vehiclelight",image) setCookieOption("lights",image) end guiSetVisible(lightsWindow,false) showCursor(false) end function closeWindow (btn) if btn ~= "left" then return end guiStaticImageLoadImage(previewStaticImage,"images/"..currentLight..".jpg") guiSetVisible(lightsWindow,false) showCursor(false) end function changeLights () local image = guiComboBoxGetItemText(lightsComboBox,guiComboBoxGetSelected(lightsComboBox)) guiStaticImageLoadImage(previewStaticImage,"images/"..image..".jpg") end addEventHandler("onClientElementDataChange",root, function (key,oldvalue) if key == "vehiclelight" then local vehicle = getPedOccupiedVehicle(source) if vehicle then loadVehicleLights(vehicle) end end end ) --GUI: function startGui () lightsWindow = guiCreateWindow (200, 70, 400, 450, "Vehicle Lights", false) guiSetAlpha (lightsWindow, 1) guiWindowSetSizable (lightsWindow, false) guiCreateLabel (15, 40, 380, 20, "Lights:", false, lightsWindow) guiCreateLabel (15, 140, 380, 20, "Preview:", false, lightsWindow) lightsComboBox = guiCreateComboBox (25, 60, 350, 160, "Default", false, lightsWindow) for i,light in ipairs (lights) do local id = guiComboBoxAddItem (lightsComboBox,light) if light == currentLight then guiComboBoxSetSelected(lightsComboBox,id) end end addEventHandler("onClientGUIComboBoxAccepted",lightsComboBox,changeLights) drawlightsCheckBox = guiCreateCheckBox (15, 90, 380, 20, "Draw lights", true, false, lightsWindow) previewStaticImage = guiCreateStaticImage (25, 160, 350, 220, "images/"..currentLight..".jpg", false, lightsWindow) local saveChangesButton = guiCreateButton (25, 400, 150, 30, "Save", false, lightsWindow) local closeWindowButton = guiCreateButton (225, 400, 150, 30, "Close", false, lightsWindow) addEventHandler("onClientGUIClick",saveChangesButton,saveChanges,false) addEventHandler("onClientGUIClick",closeWindowButton,closeWindow,false) end addCommandHandler ("lights", function () if lightsWindow then guiSetVisible(lightsWindow,not guiGetVisible(lightsWindow)) showCursor(guiGetVisible(lightsWindow)) else showCursor (true) startGui() end end, false) Link to comment
кιηg-αвα∂у Posted October 3, 2013 Share Posted October 3, 2013 local lights = { "High Quality", "Blue Doom", "Blue Estrellas", "Blue Flecha", "Blue Neon HQ", "Blue Oblique", "Blue X", "Colored", "Green FFS", "Green Mustang", "Green Onda", "Green Paradise", "Grey Audi I", "MEME Derp HQ", "MEME Me Gusta HQ", "MEME Troll HQ", "Orange Cupido", "Orange Led", "Orange Lines", "Pink Dots", "Purple I", "Purple II", "Red Alfa Romeo", "Red Alien", "Red Angry Mouth", "Red Angry Shape", "Red Audi I", "Red Audi II", "Red Audi III", "Red BMW I", "Red BMW II", "Red BMW M5", "Red Canibus", "Red Chevrolet Malibu", "Red Citroen Survolt", "Red Cupido", "Red Curve", "Red Curves HQ", "Red Dino", "Red Double Oval", "Red Double Ring", "Red Double Ring Led", "Red Double Rounded Restangles HQ", "Red Double Stripes", "Red Fast Line", "Red FFS", "Red Infiniti Electric", "Red KIA", "Red Lamborghini", "Red Lexus", "Red Lines", "Red Metropolis", "Red Mustang", "Red Passat", "Red Peugeot", "Red Rhombus", "Red Ring", "Red Sexy", "Red Slanted Stripes", "Red Spray", "Red Subaru", "Red The N", "Red The X", "Red The Y", "Red Triangles", "Red Triple Stripes", "Red Volkswagen", "Violet Lilac", "White Slanted Stripes", "White Snake" } local shaders = {} local currentLight = "high quality" local drawLights = true addEventHandler("onClientResourceStart",resourceRoot, function () currentLight = getCookieOption("lights") or "high quality" setElementData(localPlayer,"vehiclelight",currentLight,true) if getCookieOption("draw") ~= "false" then for i,vehicle in ipairs (getElementsByType("vehicle")) do loadVehicleLights(vehicle) end end end ) addEventHandler("onClientElementStreamIn",root, function () if getElementType(source) == "vehicle" then loadVehicleLights(source) end end ) addEventHandler("onClientVehicleEnter",root, function () loadVehicleLights(source) end ) function loadVehicleLights (vehicle) local controller = getVehicleController(vehicle) if not controller then return end local image = getElementData(controller,"vehiclelight") if not image then return end if not shaders[image] then local texture = dxCreateTexture("images/"..image..".jpg","dxt3") local shader = dxCreateShader("lights.fx") dxSetShaderValue(shader,"gTexture",texture) shaders[image] = shader end engineApplyShaderToWorldTexture(shaders[image],"vehiclelights128",vehicle) engineApplyShaderToWorldTexture(shaders[image],"vehiclelightson128",vehicle) -- needs messing with alpha end function unloadVehicleLights (vehicle) local controller = getVehicleController(vehicle) if not controller then return end local image = getElementData(controller,"vehiclelight") if not image then return end engineRemoveShaderFromWorldTexture(shaders[image],"vehiclelights128",vehicle) engineRemoveShaderFromWorldTexture(shaders[image],"vehiclelightson128",vehicle) end function saveChanges (btn) if btn ~= "left" then return end if guiCheckBoxGetSelected(drawlightsCheckBox) ~= drawLights then local drawlights = guiCheckBoxGetSelected(drawlightsCheckBox) if drawlights then for i,vehicle in ipairs (getElementsByType("vehicle")) do loadVehicleLights(vehicle) end else for i,vehicle in ipairs (getElementsByType("vehicle")) do unloadVehicleLights(vehicle) end for name,shader in pairs (shaders) do destroyElement(shader) shaders[name] = nil end end setCookieOption("draw",tostring(drawlights)) end local image = guiComboBoxGetItemText(lightsComboBox,guiComboBoxGetSelected(lightsComboBox)) if image ~= currentLight then currentLight = image setElementData(localPlayer,"vehiclelight",image) setCookieOption("lights",image) end guiSetVisible(lightsWindow,false) showCursor(false) end function closeWindow (btn) if btn ~= "left" then return end guiStaticImageLoadImage(previewStaticImage,"images/"..currentLight..".jpg") guiSetVisible(lightsWindow,false) showCursor(false) end function changeLights () local image = guiComboBoxGetItemText(lightsComboBox,guiComboBoxGetSelected(lightsComboBox)) guiStaticImageLoadImage(previewStaticImage,"images/"..image..".jpg") end addEventHandler("onClientElementDataChange",root, function (key,oldvalue) if key == "vehiclelight" then local vehicle = getPedOccupiedVehicle(source) if vehicle then loadVehicleLights(vehicle) end end end ) --GUI: function startGui () lightsWindow = guiCreateWindow (200, 70, 400, 450, "Vehicle Lights", false) guiSetAlpha (lightsWindow, 1) guiWindowSetSizable (lightsWindow, false) guiCreateLabel (15, 40, 380, 20, "Lights:", false, lightsWindow) guiCreateLabel (15, 140, 380, 20, "Preview:", false, lightsWindow) lightsComboBox = guiCreateComboBox (25, 60, 350, 160, "Default", false, lightsWindow) for i,light in ipairs (lights) do local id = guiComboBoxAddItem (lightsComboBox,light) if light == currentLight then guiComboBoxSetSelected(lightsComboBox,id) end end addEventHandler("onClientGUIComboBoxAccepted",lightsComboBox,changeLights) drawlightsCheckBox = guiCreateCheckBox (15, 90, 380, 20, "Draw lights", true, false, lightsWindow) previewStaticImage = guiCreateStaticImage (25, 160, 350, 220, "images/"..currentLight..".jpg", false, lightsWindow) local saveChangesButton = guiCreateButton (25, 400, 150, 30, "Save", false, lightsWindow) local closeWindowButton = guiCreateButton (225, 400, 150, 30, "Close", false, lightsWindow) addEventHandler("onClientGUIClick",saveChangesButton,saveChanges,false) addEventHandler("onClientGUIClick",closeWindowButton,closeWindow,false) end bindKey('F3','down', function () if lightsWindow then guiSetVisible(lightsWindow,not guiGetVisible(lightsWindow)) showCursor(guiGetVisible(lightsWindow)) else showCursor (true) startGui() end end) Link to comment
Hesham_Alking Posted October 3, 2013 Author Share Posted October 3, 2013 لبي قلبك يالغلا Link to comment
فاّرس Posted October 4, 2013 Share Posted October 4, 2013 هذا القسم مخصص لطلب المودات الجاهزه مو نعدل لك اكواد , قسم البرمجه حق طلبات الوظائف وتعديل الاكواد Link to comment
Hesham_Alking Posted October 5, 2013 Author Share Posted October 5, 2013 هذا القسم مخصص لطلب المودات الجاهزه مو نعدل لك اكواد ,قسم البرمجه حق طلبات الوظائف وتعديل الاكواد طيب اخوي بالراحة وش فيك معصب 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