HassoN Posted February 2, 2016 Share Posted February 2, 2016 كود جميل جدا ومفيد بنفس الوقتاهنيك والله تسلم حبيبي Link to comment
MoDeR2014 Posted February 3, 2016 Share Posted February 3, 2016 وظائف مفيده ورائعه جداً استمر Link to comment
</Mr.Tn6eL> Posted February 6, 2016 Share Posted February 6, 2016 removeColorFromTexture texture الوظيفة تقوم بحذف لون محدد من الصورة طبعا لازم تكون فائدتها لو بغيت مثلا تحذف الخلفية السوداء او اي لون في صورة سوف تقوم هذه الوظيفة بعملها على أكمل وجه removeColorFromTexture(element texture, int r, int g, int b [, int a]) Required Arguments ---texture: the texture element ---r: The red channel for the color (0-255) ---g: The green channel for the color (0-255) ---b: The blue channel for the color (0-255) Optional Arguments ---a: The alpha channel for the color (0-255) Code : function removeColorFromTexture(texture, r, g, b, a) assert(isElement(texture), "Bad argument @ 'removeColorFromTexture' [expected element at argument 1, got "..type(texture).."]") assert(getElementType(texture) == "texture", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 1, got "..getElementType(texture).."]") assert(type(r) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 2, got "..type(r).."]") assert(type(g) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 3, got "..type(g).."]") assert(type(b) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 4, got "..type(b).."]") local a = type(a) == "number" and a or 255 local pixels = dxGetTexturePixels(texture) local w, h = dxGetMaterialSize(texture) for x=0, w-1 do for y=0, h-1 do local r2, g2, b2, a2 = dxGetPixelColor(pixels, x, y) dxSetPixelColor(pixels, x, y, r2, g2, b2, (r2 == r and g2 == g and b2 == b and a == a2) and 0 or a2) end end dxSetTexturePixels(texture, pixels) end Example : 1.png function removeColorFromTexture(texture, r, g, b, a) assert(isElement(texture), "Bad argument @ 'removeColorFromTexture' [expected element at argument 1, got "..type(texture).."]") assert(getElementType(texture) == "texture", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 1, got "..getElementType(texture).."]") assert(type(r) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 2, got "..type(r).."]") assert(type(g) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 3, got "..type(g).."]") assert(type(b) == "number", "Bad argument @ 'removeColorFromTexture' [expected texture element at argument 4, got "..type(b).."]") local a = type(a) == "number" and a or 255 local pixels = dxGetTexturePixels(texture) local w, h = dxGetMaterialSize(texture) for x=0, w-1 do for y=0, h-1 do local r2, g2, b2, a2 = dxGetPixelColor(pixels, x, y) dxSetPixelColor(pixels, x, y, r2, g2, b2, (r2 == r and g2 == g and b2 == b and a == a2) and 0 or a2) end end dxSetTexturePixels(texture, pixels) end local texture = dxCreateTexture("1.png") -- Import "1.png" as a texture local w, h = dxGetMaterialSize(texture) -- get a "1.png" width and height(No need him) removeColorFromTexture(texture, 0, 0, 0) -- remove a black color from the texture || textureحذف اللون الأسود من ال addEventHandler("onClientRender", root, function( ) dxDrawImage(250, 250, w, h, texture) -- draw a texture(1.png) end) Result: ملاحظة و تحذير : لا ينصح باستخدامها كثيراً فإنها تقوم باستهلاك موارد السيرفر وقد يؤدي الى تايم اوت او لاق ولاتنسوني من صالح دعائكم والسلام عليكم ورحمة الله وبركاته Link to comment
</Mr.Tn6eL> Posted February 6, 2016 Share Posted February 6, 2016 بطل , وظيفة رائعه منور ياقدع Link to comment
#Mr.Rajo~,< Posted February 6, 2016 Share Posted February 6, 2016 ماشاء الله تبارك الله جدا حلوه الوظيفه ومفيده Link to comment
#StrOnG_,) Posted February 6, 2016 Share Posted February 6, 2016 وظيفة جداً رائعة ومفيدة مشكور على الطرح <3 Link to comment
Me[Z]oO Posted February 10, 2016 Share Posted February 10, 2016 واصل تنطيل وظيفة مفيدة Link to comment
</Mr.Tn6eL> Posted February 17, 2016 Share Posted February 17, 2016 مبدع# تنطيل Thank you, Link to comment
</Mr.Tn6eL> Posted March 10, 2016 Share Posted March 10, 2016 (edited) createAnimation client only لكنها تستخدم بدون رندر وبسهولة وببساطة interpolateBetween الوظيفة مثل ويعني لو بغيت تسوي حركات على اللوحة او على اي شي ثاني مو بس حركات يمديك تستخدمها في اشياء ثانية interpolateBetween تختصر استخدام [color=#FF0000]createAnimation[/color]([color=#008000]int[/color] from, [color=#008000]int[/color] to, [color=#008000]int/string[/color] easing, [color=#008000]int[/color] duration, [color=#008000]function[/color] onChange) Required Arguments ---from: the start value ---to: the end value ---easing: the easing function to use for the animation or can be used the easing number, e.g. "Linear" = 1, "InQuad" = 2, "OutQuad" = 3, ... ---duration: the duration of animation ---onChange: the function to call when the animation value is changed Code : anims = { } builtins={ "Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce" } function table.find(t, v) for k,a in ipairs(t) do if a == v then return true end end return false end function createAnimation(f, t, easing, duration, onChange, onEnd) assert(type(f) == "number", "Bad argument @ 'createAnimation' [expected number at argument 1, got "..type(f).."]") assert(type(t) == "number", "Bad argument @ 'createAnimation' [expected number at argument 2, got "..type(t).."]") assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'createAnimation' [invalid easing at argument 3]") assert(type(duration) == "number", "Bad argument @ 'createAnimation' [expected number at argument 4, got "..type(duration).."]") assert(type(onChange) == "function", "Bad argument @ 'createAnimation' [expected function at argument 5, got "..type(onChange).."]") return table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd}) end addEventHandler("onClientRender", root, function( ) local now = getTickCount( ) for k,v in ipairs(anims) do v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing)) if now >= v.start+v.duration then table.remove(anims, k) if type(v.onEnd) == "function" then v.onEnd( ) end end end end) Example : --Slide Animation local sx, sy = guiGetScreenSize( ) local window = guiCreateWindow((sx-300)/2, (sy-400)/2, 300, 400, "Test", false) guiSetVisible(window, false) bindKey("f2", "down", function( ) if anim then return end local v = guiGetVisible(window) if not v then guiSetVisible(window, true) end anim = true createAnimation(v and 400 or 0, v and 0 or 400, 2, 1250, function(height) if v and height == 0 then guiSetVisible(window, false) anim = false elseif not v and height == 400 then anim = false end local w, h = guiGetSize(window, false) guiSetSize(window, w, height, false) end) end) ولاتنسوني من صالح دعائكم والسلام عليكم ورحمة الله وبركاته Edited August 10, 2016 by Guest Link to comment
Jupi Posted March 10, 2016 Share Posted March 10, 2016 بصراحة يا تنطيل بهذي الوظيفة افدتني انا شخصياً اهنيك علي عملك الابداعي =D> Link to comment
</Mr.Tn6eL> Posted March 10, 2016 Share Posted March 10, 2016 بصراحة يا تنطيلبهذي الوظيفة افدتني انا شخصياً اهنيك علي عملك الابداعي =D> شكرا على المجاملة Link to comment
Jupi Posted March 10, 2016 Share Posted March 10, 2016 (edited) بصراحة يا تنطيلبهذي الوظيفة افدتني انا شخصياً اهنيك علي عملك الابداعي =D> شكرا على المجاملة مو مجاملة : | ترا جد افدتني اواجه صعوبة في استعمال interpolateBetween كل ما اجي افهمها ما تدخل -.- واضطر استعمل متغيرات و اسوي كود طويل Edited March 10, 2016 by Guest Link to comment
Me[Z]oO Posted March 10, 2016 Share Posted March 10, 2016 ابداع × ابداع =D> م في شي جديد انت اصل الابداع Link to comment
</Mr.Tn6eL> Posted March 10, 2016 Share Posted March 10, 2016 ابداع × ابداع =D>م في شي جديد انت اصل الابداع شكرا Link to comment
MrSAUD1 Posted March 15, 2016 Share Posted March 15, 2016 الله يعطيك العافية كل وضايفك مفيدة , ابداع الوضيفة Link to comment
</Mr.Tn6eL> Posted March 16, 2016 Share Posted March 16, 2016 الله يعطيك العافية كل وضايفك مفيدة , ابداع الوضيفة منور صديقي Link to comment
!#NssoR_) Posted March 16, 2016 Share Posted March 16, 2016 بصراحة يا تنطيلبهذي الوظيفة افدتني انا شخصياً اهنيك علي عملك الابداعي =D> شكرا على المجاملة مايجاملك هو مبتدي فالبرمجة Link to comment
Jupi Posted March 16, 2016 Share Posted March 16, 2016 بصراحة يا تنطيلبهذي الوظيفة افدتني انا شخصياً اهنيك علي عملك الابداعي =D> شكرا على المجاملة مايجاملك هو مبتدي فالبرمجة لول مبتدأ اجل مريت من مرحلة الابتداء !! بس تدري وش الفرق بيني و بينك؟ اني ما اعدل و اقول انه حقي !!!! Link to comment
</Mr.Tn6eL> Posted March 16, 2016 Share Posted March 16, 2016 حرام واحد يقلك مبتدأ، وترا ما قال انا سويت المود قال أنا عدلته عندك مشكلة كلم مشرف القسم مو شغل تزويد مشاركات 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