Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2022-03-28, 19:09


Toasty2000







Wiek: 25
Na forum: 1558 dni
Posty: 18
Nick w MP: Toasty2000

Piwa: 1

Respekt: 50

Witam, dzi? pobra?em pobieranie zasob?w, jednak gdy w??czam je i si? co? zaczyna pobiera? t?o ca?e miga, a w konsoli wyskakuj? b??dy m?g?by kto? pom?c za pomoc daje zimne :piwo:

Link do skryptu: https://gtao.pl/<font-colorff00ff>gm<-font>-ala-megarpg-vt142101.htm

b??dy:

Ca?y kod client:
Kod:

if getElementData(localPlayer, "player:uid") then return end
---
--Autor xKejson,Keves
---

local sx,sy = guiGetScreenSize()
local w,h = (sx/1680),(sy/1050)

local SW, SH = guiGetScreenSize()
local font = exports.mg_gui:getFont("normal-16")
local bold2 = exports.mg_gui:getFont("bold-30")
local light2 = exports.mg_gui:getFont("bold-24")
local regular2 = exports.mg_gui:getFont("normal-20")
local rotation = 0
local alpha = 255
local image = 1
local sound = false
local checkTimer = false
local cache = {}
local settings = {}

local dxfont0_bold = dxCreateFont(":mg_gui/assets/fonts/bold.ttf", 10)

local loading = {
alpha = 255,
stage = 1,
prev = {},
speed = 0,
current = 0,
total = 1,
lastUpdate = 0,
lastDownloaded = 0,
lastTriangle = 0,
triangles = {},
}


function scale_x(x)
return (x/1920)*SW
end

function scale_y(y)
return (y/1080)*SH
end

addEventHandler ("onClientTransferBoxProgressChange", root, function (downloadedSize, totalSize)
if loading.downloading then
loading.current = ("%.1f"):format(downloadedSize/1000000)
loading.total = ("%.1f"):format(totalSize/1000000)

local diff = (tonumber(loading.current)-tonumber(loading.lastDownloaded))/((getTickCount()-loading.lastUpdate)/1000)
loading.speed = ("%.1f"):format(diff)
end
end)

function render()
rotation = rotation < 360 and rotation + 2 or 0
settings.isInterface = false

for k,v in pairs(loading.triangles) do

v.x = v.x + v.velocity[1]/delta
v.y = v.y + v.velocity[2]/delta
v.rot = v.rot + v.velocity[1]/delta
v.velocity[2] = v.velocity[2] + 5/delta
if v.y > sy + 50/zoom then
table.remove(loading.triangles, k)
end
end
--render
dxDrawRectangle(0, 0, SW, SH, tocolor(0, 0, 0))
dxDrawImage(0, 0, SW, SH, "img/"..image..".png", 0, 0, 0, tocolor(255, 255, 255, alpha))
dxDrawText("Witaj na MegaRPG", SW - scale_x(1130), SH - scale_y(1750), SW, SH - scale_y(20), white, 1, bold2, "left", "center")
dxDrawText("Witaj", SW - scale_x(1050), SH - scale_y(1210), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Jest nam bardzo mi?o ?e do nas wpad?e?.", SW - scale_x(1180), SH - scale_y(1140), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("W?a?nie trwa pobieranie zasob?w naszego serwera.", SW - scale_x(1250), SH - scale_y(1077), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Wa?ne linki:", SW - scale_x(1040), SH - scale_y(940), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("discord.gg/", 743*w, 601*h, 833*w, 620*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 863*w, 601*h, 890*w, 620*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 783*w, 624*h, 860*w, 645*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText(".pl", 850*w, 624*h, 890*w, 645*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawImage(719*w, 437*h, 33*w, 33*h, "img/icon1.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(737*w, 568*h, 33*w, 33*h, "img/icon2.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("" ..getPlayerName(localPlayer).."", 809*w, 440*h, 886*w, 465*h, tocolor(255, 196, 0), 1*w, regular2, "left", "center", false, false, true, true, false)
----- piosenka
dxDrawText("Jedi Mind Trick - 'Design in Malice'", SW - scale_x(1910), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(5*w, 980*h, 33*w, 33*h, "img/icon3.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Piosenka", SW - scale_x(1873), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Ciekawostka
dxDrawText("Serwer zosta? otwarty 3 kwietnia 2020 roku o godzinie 15:00", SW - scale_x(390), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(1640*w, 979*h, 33*w, 33*h, "img/icon6.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Ciekawostka", SW - scale_x(158), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Proces pobierania
local prg = tonumber(loading.current)/tonumber(loading.total)
dxDrawImage(652*w, 938*h, 356*w, 23*h, ":mg-pobieranie/img/loading.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
dxDrawText("Pobieranie zasob?w", 672*w, 920*h, 781*w, 935*h, tocolor(255, 255, 255, alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
dxDrawImage(652*w, 938*h, 356*w*prg, 23*h, ":mg-pobieranie/img/loading_complete.png", 0, 0, 0, tocolor(255, 255, 255*prg, loading.current), true)
dxDrawText(loading.current, 915*w, 920*h, 948*w, 934*h, tocolor(255, 255, 255, loading.alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
----Ikony procesu ladowania
dxDrawImage(645*w, 910*h, 33*w, 33*h, "img/icon4.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(980*w, 910*h, 33*w, 33*h, "img/icon5.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)

loading.alpha = math.max(loading.alpha - 50*w, 0)
if loading.alpha <= 0 then
removeLoading()
end
end

function removeLoading()
setElementData(localPlayer, "player:hudoff", loading.prev.hud)
removeEventHandler("onClientRender", root, render)
loading.downloading = false
end

addEventHandler("onClientResourceStart", resourceRoot, function()
fadeCamera(true, 0)
setElementData(localPlayer, "player:hide_minimap", true)
addEventHandler("onClientRender", root, render)
showChat(false)
showCursor(false)

sound = playSound("snd/music"..math.random(1,1)..".mp3", true)
checkTimer = setTimer(function()
if not isTransferBoxActive() then
killTimer(checkTimer)
killTimer(alphaTimer)
stopSound(sound)
showChat(true)
showCursor(false)
removeEventHandler("onClientRender", root, render)
end
end, 1000, 0)

alphaTimer = setTimer(function()
animate(alpha, 0, "Linear", 1500,
function(x) alpha = x end,
function()
image = image < 5 and image + 1 or 1
animate(0, 255, "Linear", 1500, function(x) alpha = x end)
end)
end, 1000, 0)
end)

function showLoading(text, downloading, time, forcealpha)
loading.prev = {hud=getElementData(localPlayer, "player:hudoff"), chat=isChatVisible()}
setElementData(localPlayer, "player:hudoff", true)
loading.sound = playSound("data/music1.mp3", true, true)
setSoundVolume(loading.sound, 0)
setSoundPosition(loading.sound, 25)
showCursor(false)
showChat(false)
addEventHandler("onClientRender", root, render, true, "low-101")
if time then setTimer(hideLoading, time, 1) end

loading.alpha = ((time and not forcealpha) and 0 or 255)
loading.stage = 1
loading.text = text
loading.downloading = downloading
loading.lastUpdate = getTickCount()
loading.lastDownloaded = 0
setTransferBoxVisible(false)
end

addEventHandler("onClientRender", root, function()
if isTransferBoxActive() and not loading.downloading then
showLoading("Trwa pobieranie zasob?w...", true)
elseif loading.downloading and not isTransferBoxActive() then
loading.stage = 2
loading.downloading = false
end
end)


Ca?y kod animate:
Kod:

local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}

function table.find(t, v)
for k, a in ipairs(t) do
if a == v then
return k
end
end
return false
end

function animate(f, t, easing, duration, onChange, onEnd)
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
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})
return #anims
end

function destroyAnimation(a)
if anims[a] then
table.remove(anims, a)
end
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
if type(v.onEnd) == "function" then
v.onEnd( )
end
table.remove(anims, k)
end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-03-28, 20:39


fiXlly.

lua, js, ts, php, react






Wiek: 22
Na forum: 1761 dni
Posty: 23

Piwa: 1251

Respekt: 130
Respekt: 130

Ostrzeżeń: 100%
"Toasty2000" napisał/a:

Witam, dzi? pobra?em pobieranie zasob?w, jednak gdy w??czam je i si? co? zaczyna pobiera? t?o ca?e miga, a w konsoli wyskakuj? b??dy m?g?by kto? pom?c za pomoc daje zimne :piwo:

Link do skryptu: https://gtao.pl/<font-colorff00ff>gm<-font>-ala-megarpg-vt142101.htm

b??dy: Obrazek

Ca?y kod client:
Kod:

if getElementData(localPlayer, "player:uid") then return end
---
--Autor xKejson,Keves
---

local sx,sy = guiGetScreenSize()
local w,h = (sx/1680),(sy/1050)

local SW, SH = guiGetScreenSize()
local font = exports.mg_gui:getFont("normal-16")
local bold2 = exports.mg_gui:getFont("bold-30")
local light2 = exports.mg_gui:getFont("bold-24")
local regular2 = exports.mg_gui:getFont("normal-20")
local rotation = 0
local alpha = 255
local image = 1
local sound = false
local checkTimer = false
local cache = {}
local settings = {}

local dxfont0_bold = dxCreateFont(":mg_gui/assets/fonts/bold.ttf", 10)

local loading = {
alpha = 255,
stage = 1,
prev = {},
speed = 0,
current = 0,
total = 1,
lastUpdate = 0,
lastDownloaded = 0,
lastTriangle = 0,
triangles = {},
}


function scale_x(x)
return (x/1920)*SW
end

function scale_y(y)
return (y/1080)*SH
end

addEventHandler ("onClientTransferBoxProgressChange", root, function (downloadedSize, totalSize)
if loading.downloading then
loading.current = ("%.1f"):format(downloadedSize/1000000)
loading.total = ("%.1f"):format(totalSize/1000000)

local diff = (tonumber(loading.current)-tonumber(loading.lastDownloaded))/((getTickCount()-loading.lastUpdate)/1000)
loading.speed = ("%.1f"):format(diff)
end
end)

function render()
rotation = rotation < 360 and rotation + 2 or 0
settings.isInterface = false

for k,v in pairs(loading.triangles) do

v.x = v.x + v.velocity[1]/delta
v.y = v.y + v.velocity[2]/delta
v.rot = v.rot + v.velocity[1]/delta
v.velocity[2] = v.velocity[2] + 5/delta
if v.y > sy + 50/zoom then
table.remove(loading.triangles, k)
end
end
--render
dxDrawRectangle(0, 0, SW, SH, tocolor(0, 0, 0))
dxDrawImage(0, 0, SW, SH, "img/"..image..".png", 0, 0, 0, tocolor(255, 255, 255, alpha))
dxDrawText("Witaj na MegaRPG", SW - scale_x(1130), SH - scale_y(1750), SW, SH - scale_y(20), white, 1, bold2, "left", "center")
dxDrawText("Witaj", SW - scale_x(1050), SH - scale_y(1210), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Jest nam bardzo mi?o ?e do nas wpad?e?.", SW - scale_x(1180), SH - scale_y(1140), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("W?a?nie trwa pobieranie zasob?w naszego serwera.", SW - scale_x(1250), SH - scale_y(1077), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Wa?ne linki:", SW - scale_x(1040), SH - scale_y(940), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("discord.gg/", 743*w, 601*h, 833*w, 620*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 863*w, 601*h, 890*w, 620*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 783*w, 624*h, 860*w, 645*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText(".pl", 850*w, 624*h, 890*w, 645*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawImage(719*w, 437*h, 33*w, 33*h, "img/icon1.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(737*w, 568*h, 33*w, 33*h, "img/icon2.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("" ..getPlayerName(localPlayer).."", 809*w, 440*h, 886*w, 465*h, tocolor(255, 196, 0), 1*w, regular2, "left", "center", false, false, true, true, false)
----- piosenka
dxDrawText("Jedi Mind Trick - 'Design in Malice'", SW - scale_x(1910), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(5*w, 980*h, 33*w, 33*h, "img/icon3.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Piosenka", SW - scale_x(1873), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Ciekawostka
dxDrawText("Serwer zosta? otwarty 3 kwietnia 2020 roku o godzinie 15:00", SW - scale_x(390), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(1640*w, 979*h, 33*w, 33*h, "img/icon6.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Ciekawostka", SW - scale_x(158), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Proces pobierania
local prg = tonumber(loading.current)/tonumber(loading.total)
dxDrawImage(652*w, 938*h, 356*w, 23*h, ":mg-pobieranie/img/loading.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
dxDrawText("Pobieranie zasob?w", 672*w, 920*h, 781*w, 935*h, tocolor(255, 255, 255, alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
dxDrawImage(652*w, 938*h, 356*w*prg, 23*h, ":mg-pobieranie/img/loading_complete.png", 0, 0, 0, tocolor(255, 255, 255*prg, loading.current), true)
dxDrawText(loading.current, 915*w, 920*h, 948*w, 934*h, tocolor(255, 255, 255, loading.alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
----Ikony procesu ladowania
dxDrawImage(645*w, 910*h, 33*w, 33*h, "img/icon4.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(980*w, 910*h, 33*w, 33*h, "img/icon5.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)

loading.alpha = math.max(loading.alpha - 50*w, 0)
if loading.alpha <= 0 then
removeLoading()
end
end

function removeLoading()
setElementData(localPlayer, "player:hudoff", loading.prev.hud)
removeEventHandler("onClientRender", root, render)
loading.downloading = false
end

addEventHandler("onClientResourceStart", resourceRoot, function()
fadeCamera(true, 0)
setElementData(localPlayer, "player:hide_minimap", true)
addEventHandler("onClientRender", root, render)
showChat(false)
showCursor(false)

sound = playSound("snd/music"..math.random(1,1)..".mp3", true)
checkTimer = setTimer(function()
if not isTransferBoxActive() then
killTimer(checkTimer)
killTimer(alphaTimer)
stopSound(sound)
showChat(true)
showCursor(false)
removeEventHandler("onClientRender", root, render)
end
end, 1000, 0)

alphaTimer = setTimer(function()
animate(alpha, 0, "Linear", 1500,
function(x) alpha = x end,
function()
image = image < 5 and image + 1 or 1
animate(0, 255, "Linear", 1500, function(x) alpha = x end)
end)
end, 1000, 0)
end)

function showLoading(text, downloading, time, forcealpha)
loading.prev = {hud=getElementData(localPlayer, "player:hudoff"), chat=isChatVisible()}
setElementData(localPlayer, "player:hudoff", true)
loading.sound = playSound("data/music1.mp3", true, true)
setSoundVolume(loading.sound, 0)
setSoundPosition(loading.sound, 25)
showCursor(false)
showChat(false)
addEventHandler("onClientRender", root, render, true, "low-101")
if time then setTimer(hideLoading, time, 1) end

loading.alpha = ((time and not forcealpha) and 0 or 255)
loading.stage = 1
loading.text = text
loading.downloading = downloading
loading.lastUpdate = getTickCount()
loading.lastDownloaded = 0
setTransferBoxVisible(false)
end

addEventHandler("onClientRender", root, function()
if isTransferBoxActive() and not loading.downloading then
showLoading("Trwa pobieranie zasob?w...", true)
elseif loading.downloading and not isTransferBoxActive() then
loading.stage = 2
loading.downloading = false
end
end)


Ca?y kod animate:
Kod:

local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}

function table.find(t, v)
for k, a in ipairs(t) do
if a == v then
return k
end
end
return false
end

function animate(f, t, easing, duration, onChange, onEnd)
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
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})
return #anims
end

function destroyAnimation(a)
if anims[a] then
table.remove(anims, a)
end
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
if type(v.onEnd) == "function" then
v.onEnd( )
end
table.remove(anims, k)
end
end
end)


W 147 linijce jest z?a ?cie?ka do pliku, podmie?
loading.sound playSound("data/music1.mp3"truetrue)

na
loading.sound playSound("snd/music1.mp3"truetrue)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Toasty2000
Wysłany: 2022-03-28, 22:05


Toasty2000







Wiek: 25
Na forum: 1558 dni
Posty: 18
Nick w MP: Toasty2000

Piwa: 1

Respekt: 50

"fiXlly." napisał/a:

"Toasty2000" napisał/a:

Witam, dzi? pobra?em pobieranie zasob?w, jednak gdy w??czam je i si? co? zaczyna pobiera? t?o ca?e miga, a w konsoli wyskakuj? b??dy m?g?by kto? pom?c za pomoc daje zimne :piwo:

Link do skryptu: https://gtao.pl/<font-colorff00ff>gm<-font>-ala-megarpg-vt142101.htm

b??dy: Obrazek

Ca?y kod client:
Kod:

if getElementData(localPlayer, "player:uid") then return end
---
--Autor xKejson,Keves
---

local sx,sy = guiGetScreenSize()
local w,h = (sx/1680),(sy/1050)

local SW, SH = guiGetScreenSize()
local font = exports.mg_gui:getFont("normal-16")
local bold2 = exports.mg_gui:getFont("bold-30")
local light2 = exports.mg_gui:getFont("bold-24")
local regular2 = exports.mg_gui:getFont("normal-20")
local rotation = 0
local alpha = 255
local image = 1
local sound = false
local checkTimer = false
local cache = {}
local settings = {}

local dxfont0_bold = dxCreateFont(":mg_gui/assets/fonts/bold.ttf", 10)

local loading = {
alpha = 255,
stage = 1,
prev = {},
speed = 0,
current = 0,
total = 1,
lastUpdate = 0,
lastDownloaded = 0,
lastTriangle = 0,
triangles = {},
}


function scale_x(x)
return (x/1920)*SW
end

function scale_y(y)
return (y/1080)*SH
end

addEventHandler ("onClientTransferBoxProgressChange", root, function (downloadedSize, totalSize)
if loading.downloading then
loading.current = ("%.1f"):format(downloadedSize/1000000)
loading.total = ("%.1f"):format(totalSize/1000000)

local diff = (tonumber(loading.current)-tonumber(loading.lastDownloaded))/((getTickCount()-loading.lastUpdate)/1000)
loading.speed = ("%.1f"):format(diff)
end
end)

function render()
rotation = rotation < 360 and rotation + 2 or 0
settings.isInterface = false

for k,v in pairs(loading.triangles) do

v.x = v.x + v.velocity[1]/delta
v.y = v.y + v.velocity[2]/delta
v.rot = v.rot + v.velocity[1]/delta
v.velocity[2] = v.velocity[2] + 5/delta
if v.y > sy + 50/zoom then
table.remove(loading.triangles, k)
end
end
--render
dxDrawRectangle(0, 0, SW, SH, tocolor(0, 0, 0))
dxDrawImage(0, 0, SW, SH, "img/"..image..".png", 0, 0, 0, tocolor(255, 255, 255, alpha))
dxDrawText("Witaj na MegaRPG", SW - scale_x(1130), SH - scale_y(1750), SW, SH - scale_y(20), white, 1, bold2, "left", "center")
dxDrawText("Witaj", SW - scale_x(1050), SH - scale_y(1210), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Jest nam bardzo mi?o ?e do nas wpad?e?.", SW - scale_x(1180), SH - scale_y(1140), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("W?a?nie trwa pobieranie zasob?w naszego serwera.", SW - scale_x(1250), SH - scale_y(1077), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("Wa?ne linki:", SW - scale_x(1040), SH - scale_y(940), SW, SH - scale_y(20), white, 1, regular2, "left", "center")
dxDrawText("discord.gg/", 743*w, 601*h, 833*w, 620*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 863*w, 601*h, 890*w, 620*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText("megarpg", 783*w, 624*h, 860*w, 645*h, tocolor(252, 190, 2, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawText(".pl", 850*w, 624*h, 890*w, 645*h, tocolor(255, 255, 255, 255), 1*w, regular2, "center", "center", false, false, true, false, false)
dxDrawImage(719*w, 437*h, 33*w, 33*h, "img/icon1.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(737*w, 568*h, 33*w, 33*h, "img/icon2.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("" ..getPlayerName(localPlayer).."", 809*w, 440*h, 886*w, 465*h, tocolor(255, 196, 0), 1*w, regular2, "left", "center", false, false, true, true, false)
----- piosenka
dxDrawText("Jedi Mind Trick - 'Design in Malice'", SW - scale_x(1910), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(5*w, 980*h, 33*w, 33*h, "img/icon3.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Piosenka", SW - scale_x(1873), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Ciekawostka
dxDrawText("Serwer zosta? otwarty 3 kwietnia 2020 roku o godzinie 15:00", SW - scale_x(390), SH - scale_y(45), SW, SH - scale_y(20), white, 0.50 , light2, "left", "center")
dxDrawImage(1640*w, 979*h, 33*w, 33*h, "img/icon6.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawText("Ciekawostka", SW - scale_x(158), SH - scale_y(68), SW, SH - scale_y(45), white, 0.56 , bold2, "left", "center")
-----Proces pobierania
local prg = tonumber(loading.current)/tonumber(loading.total)
dxDrawImage(652*w, 938*h, 356*w, 23*h, ":mg-pobieranie/img/loading.png", 0, 0, 0, tocolor(255, 255, 255, alpha), true)
dxDrawText("Pobieranie zasob?w", 672*w, 920*h, 781*w, 935*h, tocolor(255, 255, 255, alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
dxDrawImage(652*w, 938*h, 356*w*prg, 23*h, ":mg-pobieranie/img/loading_complete.png", 0, 0, 0, tocolor(255, 255, 255*prg, loading.current), true)
dxDrawText(loading.current, 915*w, 920*h, 948*w, 934*h, tocolor(255, 255, 255, loading.alpha), 1*w, dxfont0_bold, "left", "top", false, false, true, false, false)
----Ikony procesu ladowania
dxDrawImage(645*w, 910*h, 33*w, 33*h, "img/icon4.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
dxDrawImage(980*w, 910*h, 33*w, 33*h, "img/icon5.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)

loading.alpha = math.max(loading.alpha - 50*w, 0)
if loading.alpha <= 0 then
removeLoading()
end
end

function removeLoading()
setElementData(localPlayer, "player:hudoff", loading.prev.hud)
removeEventHandler("onClientRender", root, render)
loading.downloading = false
end

addEventHandler("onClientResourceStart", resourceRoot, function()
fadeCamera(true, 0)
setElementData(localPlayer, "player:hide_minimap", true)
addEventHandler("onClientRender", root, render)
showChat(false)
showCursor(false)

sound = playSound("snd/music"..math.random(1,1)..".mp3", true)
checkTimer = setTimer(function()
if not isTransferBoxActive() then
killTimer(checkTimer)
killTimer(alphaTimer)
stopSound(sound)
showChat(true)
showCursor(false)
removeEventHandler("onClientRender", root, render)
end
end, 1000, 0)

alphaTimer = setTimer(function()
animate(alpha, 0, "Linear", 1500,
function(x) alpha = x end,
function()
image = image < 5 and image + 1 or 1
animate(0, 255, "Linear", 1500, function(x) alpha = x end)
end)
end, 1000, 0)
end)

function showLoading(text, downloading, time, forcealpha)
loading.prev = {hud=getElementData(localPlayer, "player:hudoff"), chat=isChatVisible()}
setElementData(localPlayer, "player:hudoff", true)
loading.sound = playSound("data/music1.mp3", true, true)
setSoundVolume(loading.sound, 0)
setSoundPosition(loading.sound, 25)
showCursor(false)
showChat(false)
addEventHandler("onClientRender", root, render, true, "low-101")
if time then setTimer(hideLoading, time, 1) end

loading.alpha = ((time and not forcealpha) and 0 or 255)
loading.stage = 1
loading.text = text
loading.downloading = downloading
loading.lastUpdate = getTickCount()
loading.lastDownloaded = 0
setTransferBoxVisible(false)
end

addEventHandler("onClientRender", root, function()
if isTransferBoxActive() and not loading.downloading then
showLoading("Trwa pobieranie zasob?w...", true)
elseif loading.downloading and not isTransferBoxActive() then
loading.stage = 2
loading.downloading = false
end
end)


Ca?y kod animate:
Kod:

local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}

function table.find(t, v)
for k, a in ipairs(t) do
if a == v then
return k
end
end
return false
end

function animate(f, t, easing, duration, onChange, onEnd)
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
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})
return #anims
end

function destroyAnimation(a)
if anims[a] then
table.remove(anims, a)
end
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
if type(v.onEnd) == "function" then
v.onEnd( )
end
table.remove(anims, k)
end
end
end)


W 147 linijce jest z?a ?cie?ka do pliku, podmie?
loading.sound playSound("data/music1.mp3"truetrue)

na
loading.sound playSound("snd/music1.mp3"truetrue)
Piwko polecia?o

Postaw piwo autorowi tego posta
 

 
Tagi: pobieranie :: zasobów :: nie :: działa :: poprawnie.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku