Tematy otagowane jako: pobierania
1. Zabezpieczenie modeli bez ponownego pobierania
Jak zrobi? zabezpieczenie modeli bez ponownego pobierania
local r={
[ id ]= "plik" ,
}
local podmienPliki =(
function( id , filename , rozszerzenie )
local spl = split ( filename , "," )
if ( rozszerzenie == "txd" ) then
local t = engineLoadTXD ( "modele/" .. spl [ 1 ].. ".txd" , id )
engineImportTXD ( t , id )
elseif ( rozszerzenie == "dff" ) then
local d = engineLoadDFF ( "modele/" .. spl [ 1 ].. ".dff" , id )
engineReplaceModel ( d , id )
elseif ( rozszerzenie == "col" ) then
local c = engineLoadCOL ( "modele/" .. spl [ 1 ].. ".col" , id )
engineReplaceCOL ( c , id )
end
fileDelete ( ":MXL_mapa/modele/" .. spl [ 1 ].. "." .. rozszerzenie )
end
)
if true then
for i , v in pairs ( r ) do
podmienPliki ( i , v , "txd" )
podmienPliki ( i , v , "dff" )
podmienPliki ( i , v , "col" )
end
end
2. ekran pobierania
Witam, przychodz? z pytaniem. Jak zrobi? ekran pobierania? Tzn. do tej pory zrobi?em taki kod:
addEventHandler( "onClientResourceStart" , resourceRoot , function()
if not getElementData ( localPlayer , "played:dbid" ) then
addEventHandler ( "onClientRender" , root , download )
setElementData ( localPlayer , "hud" , "0" )
else
return
end
end )
addEvent ( "download:stop" , true )
function download_stop ()
removeEventHandler ( "onClientRender" , root , download )
end
addEventHandler ( "download:stop" , root , download_stop )
function download ()
dxDrawImage ( scale_x ( 0 ), scale_y ( 0 ), scale_x ( 1920 ), scale_y ( 1080 ), "files/background.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Trwa pobieranie zasob?w serwera..." , scale_x ( 500 ), scale_y ( 500 ), nil , nil , tocolor ( 255 , 255 , 255 , 255 ), scale_x ( 1.00 ), font , "center" , "center" , false , false , false , false , false )
end
Event download:stop doda?em do onClientResourceStart w panelu logowania.
Lecz po wej?ciu na serwer ekran przez chwile si? pokazuje i dalej normalnie panel logowania si? w??cza i jest normalne pobieranie (te na dole).
Drugie pytanie to sk?d? wezm? post?p pobierania? Tzn. chcia?bym zrobi? w zmiennej np. 10kb/100kb.
Trzecie pytanie to czy da si? ukry? jako? to co jest na dole? (w?a?nie post?p pobierania tylko ten standardowy).
3. Jak dodać png/jpg do pobierania zasobów
[code]dawnlodetext1 = "***** - Polski Serwer RPG" --- the text up
dawnlodetext2 = "Trwa pobieranie zasob?w serwera..." --- the text in medium
dis = textCreateDisplay()
screentext = textCreateTextItem (dawnlodetext1, 0.5, 0.1, 2, 255,255,255, 255, 3.0, "center", "center",127 )
textDisplayAddText(dis,screentext)
dis1 = textCreateDisplay()
screentext1 = textCreateTextItem(dawnlodetext2, 0.5, 0.5, 2, 255,255,255, 255, 1.2, "center", "center",127 )
textDisplayAddText(dis1,screentext1)
dis2 = textCreateDisplay()
screentext2 = textCreateTextItem(dawnlodetext3, 0.5, 0.89, 2, 55,55,255, 255, 1.2, "center", "bottom",127 )
textDisplayAddText(dis2,screentext2)
addEventHandler("onResourceStart",resourceRoot,
function ()
for i,p in ipairs(getElementsByType("player")) do
textDisplayAddObserver(dis,p)
textDisplayAddObserver(dis1,p)
textDisplayAddObserver(dis2,p)
end
end
)
addEventHandler("onPlayerJoin",root,
function ()
fadeCamera(source, true, 75)
--dxDrawImage(0, 0, 1920, 1080, "logo.png", fadeCamera, 0, 0, tocolor(255, 255, 255, 255), false)
setCameraMatrix(source, -1834.34, 877.85, 297.09, 0.00, 0.00, 275.69)--x,y,z,r1,r2,r3 -1894.37,668.43,145.05,0.3,0.0,45.0
textDisplayAddObserver(dis,source)
textDisplayAddObse...
4. blokada pobierania
W jaki spos?b mo?na stworzy? tzw. "blokad? podmianek" czyli ?eby graczom si? nie pobiera?y w resources, a na serwerze dzia?a?y bezproblemowo? Nagradzam za pomoc!
5. Ekran pobierania
Zrobi?em sobie oto taki ekran pobierania. I czy on b?dzie dzia?a?? Skrypt ma wy?wietla? zdj?cie na ca?y ekran i gdy si? pobior? zasoby to ekran ma znikn??.
I dlaczego nie dzia?a.
Tutaj zdj?cie: http://imgur.com/a/B0wwq
addEventHandler( "onClientResourceStart" , resourceRoot ,
function()
BG = guiCreateStaticImage (- 193 , - 67 , 1920 , 1080 , ":files/img/download_img.png" , false )
end
)
function PlayerJoin ()
fadeCamera ( source , true )
guiSetVisible ( BG , true )
showPlayerHudComponent ( source , "all" , false )
showChat ( source , false )
end
addEventHandler ( "onPlayerJoin" , PlayerJoin )
function onResourcesDownloaded ()
guiSetVisible ( BG , false )
showPlayerHudComponent ( source , "all" , true )
showChat ( source , true )
onPlayerDownloadFinished ( source )
end
addEvent ( "onResourcesDownloaded" , true )
addEventHandler ( "onResourcesDownloaded" , getRootElement (), onResourcesDownloaded )
6. Grafika, teren, podgląd w czasie pobierania
w jaki spos?b zrobi? by po wej?ciu na serwer podczas pobierania jego zawarto?ci pokaza? jak?? cz??? terenu, mo?e macie jak?? gotow? funkcj? na to?
Mniej wi?cej wiem jak to zrobi?, ale by? mo?e kto? mnie o?wieci.
7. Zasoby ,podczas pobierania
Witam napisa?em skrypt na zasoby tj. Podczas pobierania zasob?w na serwerze pojawia si? napis Trwa pobieranie zasob?w itd.
Problem le?y w tym i? nie wiem jak zaimpletowa? tam:
-usuwanie hudu bo jest
-lokacji bo jest np BlueBerry Acress chodzi o dzielnice
-No i po pobraniu zasob?w napis "Trwa Pobieranie zasob?w nie znika"
Oto skrypt
c_zasoby
Kod: local timer = setTimer( checkTransfer 1000, 0 )
function checkTransfer( )
if not isTransferBoxActive( ) then
triggerServerEvent( "onClientSend", getLocalPlayer() )
killTimer( timer )
end
end
s_zasoby
Kod: addEvent( "onClientSend",true )
local serverDisplay,serverText
addEventHandler( "onClientSend",getRootElement(),
function()
textDisplayRemoveObserver( serverDisplay, source )
end
)
addEventHandler( "onPlayerJoin",getRootElement(),
function( )
fadeCamera(source, true)
serverDisplay = textCreateDisplay( )
textDisplayAddObserver ( serverDisplay, source )
serverText = textCreateTextItem ( "Trwa pobieranie zasobow, prosze czekac!", 0.5, 0.3,2,255,255,255,255,2,"center","top",200 )
textDisplayAddText ( serverDisplay, serverText )
end
)