Jump to content

تحميل صورة


Recommended Posts

--- Client.lua
addEvent( "Downloadwait", true )
addEventHandler( "Downloadwait", resourceRoot,
    function( pic )
        if myTexture then
            destroyElement( myTexture )
        end
        myTexture = dxCreateTexture( pic )
    end
)
rot = 0
addEventHandler("onClientRender", root,
    function()
        if myTexture then
		rot = rot + 0.20
            local w,h = dxGetMaterialSize( myTexture )
            dxDrawImage( 200, 100, w, h, myTexture,tocolor(255,255,255),rot )
        end
    end
)
---------

---- server.lua

function picClient ( pic, error, player )
 if error == 0 then
    triggerLatentClientEvent ("Downloadwait", 5000, false, player, pic )
  end
end
  
function urlPic( player )
	outputChatBox ( "Download startet ...")
	fetchRemote ( "https://cdn1.iconfinder.com/data/icons/loading-icon/100/loading_icon-02-256.png", picClient, "", false, player )
end 

[2016-10-23 14:33:07] WARNING: Access denied @ 'fetchRemote' [string "..."]
[2016-10-23 14:33:13] WARNING: cpng\server.lua:10: Access denied @ 'fetchRemote'

Edited by medo7
Link to comment
  On 23/10/2016 at 14:48, FaHaD said:

triggerLatentClientEvent 

هذي لية مستعملها؟ وماستعملت ترايقر كلاينت عادي؟ وش السبب؟

والخطا انك ماحطيت المود لة صلاحيات حطة في قروب ادمن

Expand  

صح صلحت الخطا شكرا لك
بالنسبة triggerLatentClientEvent بيصغر مساحة صور

Link to comment
  On 23/10/2016 at 16:05, Mr.CoR said:
Expand  

يا كور ابي اعرف شي
ليش لازم تكون بالطريقة هاذي
+ ليش ما كنت تسويها بطريقة افضل
مثلاً
طلب : طريقة انشاء ماركر
استفسار : كيفية اخضار اسم اللاعب
مساعدة : اصلاح اكواد

 

انا ما اقصد ان الشكل سئ لكن هاذي وجهة نظر فقط

Link to comment
rot = 0
function aRender (              )
        if myTexture then
        rot = rot + 0.20
            local w,h = dxGetMaterialSize( myTexture )
            dxDrawImage( 200, 100, w, h, myTexture,rot )
        end
    end
addEventHandler ( 'onClientRender',root,aRender )

setTimer ( removeEventHandler,10000,1,'onClientRender',root,aRender )

 

جرب هذا بعد عشر ثواني يشيلة 

Edited by FaHaD
Link to comment
  On 23/10/2016 at 18:10, medo7 said:

up
 

setTimer (	removeEventHandler("onClientRender",root,function()	getEventHandlers ("onClientRender",root)
		cancelEvent ()  
	end), 1000, 1)

O.o! nil ^

Expand  

الكود تمام ..بس طيب كيف اشيل الصورة نهائيا؟

setTimer ( removeEventHandler,10000,1,'onClientRender',root,aRender )

زي ^ مره 

:/

 

Edited by medo7
Link to comment
--- كلنت
rot = 0
function aRender (              )
        if myTexture then
        rot = rot + 0.20
            local w,h = dxGetMaterialSize( myTexture )
            dxDrawImage( 200, 100, w, h, myTexture,rot )
			destroyElement( myTexture )  -- FaHaD ^_^
        end
    end
addEventHandler ( 'onClientRender',root,aRender )

setTimer ( removeEventHandler,10000,1,'onClientRender',root,aRender ) -- X !

---

function isCursorOverRectangle(x,y,w,h)
	if isCursorShowing() then
	local mx,my = getCursorPosition ()
	local ScreenX,ScreenY = guiGetScreenSize()
	cursorx,cursory = mx*ScreenX,my*ScreenY
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
	end
end


local qual = 50
local dim = y/qual
local rgb = {}

local colors = {
	[1] = tocolor(255,0,0),
	[2] = tocolor(0,255,0),
	[3] = tocolor(0,0,255),
}

function render()
	for i = 0, qual*qual do
		local cA = math.floor(i/qual)
		local ws = i%qual
		local colorsA = colors[rgb[i+1]]
		dxDrawRectangle(ws*dim, cA*dim, dim, dim, colorsA ,false)
		if isCursorOverRectangle(ws*dim, cA*dim, dim, dim) then
			for color,_ in ipairs(colors) do
				if getKeyState(tostring(color)) then
					rgb[i+1] = color
				end
			end
		end
	end
end
addEventHandler("onClientRender", root, render)

ابي حفظ صور
كيف ^

Link to comment
  On 23/10/2016 at 20:08, </Mr.Tn6eL> said:

في حاجة غريبة عندك

dxDrawImage( 200, 100, w, h, myTexture,rot )destroyElement( myTexture ) -- FaHaD ^_^

كيف ترسم بعدين تحذف وكمان جوا الرندر

الصورة راح تنرسم بعدين تنحذف مايتحقق الشرط if myTexture then

Expand  

الثاني ترسم بس
كيف حفظ
!

 

	fetchRemote ( "https://cdn1.iconfinder.com/data/icons/loading-icon/100/loading_icon-02-256.png", picClient, "", false, player )

loading_icon-02-256.png

 

Edited by medo7
Link to comment

شوف فوق ؟؟
مهم ابي حفظ
 

-- im.lua
function isCursorOverRectangle(x,y,w,h)
	if isCursorShowing() then
	local mx,my = getCursorPosition ()
	local ScreenX,ScreenY = guiGetScreenSize()
	cursorx,cursory = mx*ScreenX,my*ScreenY
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
	end
end


local qual = 50
local dim = y/qual
local rgb = {}

local colors = {
	[1] = tocolor(255,0,0),
	[2] = tocolor(0,255,0),
	[3] = tocolor(0,0,255),
}

function render()
	for i = 0, qual*qual do
		local cA = math.floor(i/qual)
		local ws = i%qual
		local colorsA = colors[rgb[i+1]]
		dxDrawRectangle(ws*dim, cA*dim, dim, dim, colorsA ,false)
		if isCursorOverRectangle(ws*dim, cA*dim, dim, dim) then
			for color,_ in ipairs(colors) do
				if getKeyState(tostring(color)) then
					rgb[i+1] = color
				end
			end
		end
	end
end
addEventHandler("onClientRender", root, render)

كيف حفظ

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...