getColorsByRandom
وظيفة تقوم بالحصول على الوان عشوائيه بشكل مميز
لشتغيل الوظيفة بشكل مستمر onClientRender تحتاج الوظيفة الى حدث
Syntax:
int, int, int getColorsByRandom ( )
Code:
started = true
addEventHandler("onClientResourceStart",root,
function()
if started == true then
start = getTickCount()
addEventHandler("onClientRender",root,red)
end
started = nil
end
)
function getColorsByRandom()
return r,g,b
end
function red()
now = getTickCount()
endTime = start + 2000
elapsedTime = now - start
duration = endTime - start
progress = elapsedTime / duration
r,g,b = interpolateBetween(255,0,0,0,255,0,progress,"Linear")
r,g,b = r,g,b
if now > endTime then
removeEventHandler("onClientRender",root,red)
start = getTickCount()
endTime = start + 2000
addEventHandler("onClientRender",root,green)
end
end
function green()
now = getTickCount()
endTime = start + 2000
elapsedTime = now - start
duration = endTime - start
progress = elapsedTime / duration
r,g,b = interpolateBetween(0,255,0,0,0,255,progress,"Linear")
r,g,b = r,g,b
if now > endTime then
removeEventHandler("onClientRender",root,green)
start = getTickCount()
endTime = start + 2000
addEventHandler("onClientRender",root,blue)
end
end
function blue()
now = getTickCount()
endTime = start + 2000
elapsedTime = now - start
duration = endTime - start
progress = elapsedTime / duration
r,g,b = interpolateBetween(0,0,255,255,0,0,progress,"Linear")
r,g,b = r,g,b
if now > endTime then
removeEventHandler("onClientRender",root,blue)
start = getTickCount()
endTime = start + 2000
addEventHandler("onClientRender",root,red)
end
end
Example:
addEventHandler("onClientRender",root,
function()
r,g,b = getColorsByRandom()
dxDrawText("Hello Word!",500,500,0,0,tocolor(r,g,b,255),1,"default-bold","center","center")
end
)
Author: EXTRA