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

Wysłany: 2023-01-03, 02:07


Vortex69







Wiek: 28
Na forum: 2424 dni
Posty: 16

Piwa: 9

Respekt: 60

Witam tak jak w temacie nie wczytuj? si? modele aut i modele exterior?w i interior?w te modele s? kodowane po serialu na serwerze a mam ustawione w kodzie ze wczytywanie modeli aut jest po wej?ciu gracza na serwer o to przyk?ad

c.Lua (model aut)
Kod:

local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1

local models = {}
models['zr350'] = 477
models['tahoma'] = 566
models['elegy'] = 562
models['huntley'] = 579
models['bobcat'] = 422
models['comet'] = 480
models['supergt'] = 506
models['sentinel'] = 405
models['landstalker'] = 400
models['voodoo'] = 412
models['dft'] = 578
models['yosemite'] = 554
models['sweeper'] = 574
models['club'] = 589
models['banshee'] = 429
models['rancher'] = 489
models['cheetah'] = 415
models['moonbeam'] = 418
models['stallion'] = 439
models['buffalo'] = 402
models['alpha'] = 602
models['walton'] = 478
models['cabbie'] = 438
models['taxi'] = 420
models['truck'] = 433
models['patriot'] = 470
models['rancher'] = 489
models['sandking'] = 495
models['mesa'] = 500
models['bfinject'] = 424
models['bullet'] = 541
models['turismo'] = 451
models['infernus'] = 411
models['greenwood'] = 492
models['sadler'] = 543
models['manana'] = 410
models['perennial'] = 404
models['sabre'] = 475
models['bandito'] = 568
models['willard'] = 529
models['elegant'] = 507
models['merit'] = 551
models['premier'] = 426
models['ambulans'] = 416
models['burrito'] = 482
models['flash'] = 565
--models['sultan'] = 560
models['gba'] = 407
models['rancherSAPD'] = 599
models['sultanSAPD'] = 596
models['copcarla'] = 597
models['victoria'] = 598

]function decode(path, key)
local f = fileOpen(path)
local rawdatac = fileRead(f, fileGetSize(f))
fileClose(f)
local rawdata = decodeString("tea", rawdatac, {key = key})
return rawdata
end

function skinAllocatedPeds(cmd, name)
local id = engineRequestModel("vehicle")
print(id)
if fileExists("files/" .. name .. ".txd") and fileExists("files/" .. name .. ".dffc") then
txd = engineLoadTXD("files/" .. name .. ".txd")
engineImportTXD(txd, id)
dff = decode("files/"..name..".dffc", getElementData(getRootElement(), "kodowanieModeli"))
engineReplaceModel(dff, id)
outputChatBox("Model ID "..id.." changed correctly.")
else
outputChatBox("Model ID "..id.." couldn't change. REASON: files/" .. id .. ".txd or files/" .. id .. ".dff does not exist.")
end
end


function loadModels()
for i, v in pairs(models) do
if fileExists("files/"..i..".txd") then
local txd = engineLoadTXD("files/"..i..".txd")
if txd and type(txd) ~= 'boolean' then
engineImportTXD(txd, v)
end
end
if fileExists("files/"..i..".dffc") then
local data = decode("files/"..i..".dffc", getElementData(getRootElement(), "kodowanieModeli"))
local dff = engineLoadDFF(data)
if dff and type(dff) ~= 'boolean' then
engineReplaceModel(dff, v, true)
end
end
if fileExists("files/"..i..".colc") then
local data = decode("files/"..i..".colc", getElementData(getRootElement(), "kodowanieModeli"))
local col = engineLoadCOL(data)
if col and type(col) ~= 'boolean' then
engineReplaceCOL(col, v)
end
end
end
end
addEventHandler( "onClientPlayerSpawn", resourceRoot, function()
if source ~= localPlayer then return end
loadModels()
end)
loadModels()


s.lua (model aut)
Kod:

setElementData(getRootElement(), "kodowanieModeli", "95FNt]fwwzo8}d@YGWV_EXG8oP5t6KmF%*dCKJ1b")

local serials = {}

addCommandHandler("koduj", function(localPlayer, cmd, name)
if not serials[getPlayerSerial(localPlayer)] then return end
local col = checkFile("files/"..name..".col")
local dff = checkFile("files/"..name..".dff")
local txd = checkFile("files/"..name..".txd")
outputChatBox("dff: "..tostring(dff), localPlayer)
outputChatBox("col: "..tostring(col), localPlayer)
outputChatBox("txd: "..tostring(txd), localPlayer)
if col then
codeFile("files/"..name..".col", localPlayer)
end
if dff then
codeFile("files/"..name..".dff", localPlayer)
end
if txd then
local xml = xmlLoadFile("meta.xml", false)
local files = xmlNodeGetChildren(xml)
for i, v in ipairs(files) do
if xmlNodeGetAttribute(v, "src") == "files/"..name..".txd" then return end
end
local child = xmlCreateChild(xml, "file")
xmlNodeSetAttribute(child, "src", "files/"..name..".txd")
xmlSaveFile(xml)
end
end)

function codeFile(path, player)
if not fileExists(path) then
outputChatBox("* Nie uda?o si? zakodowa? pliku: "..path..", gdy? nie uda?o si? go otworzy?", player)
return
end
local f = fileOpen(path)
if not f then
outputChatBox("* Nie uda?o si? zakodowa? pliku: "..path..", gdy? nie uda?o si? go otworzy?", player)
return
end
local uncoded = fileRead(f, fileGetSize(f))
if not uncoded then
outputChatBox("* Nie uda?o si? odczyta? niezakodowanego pliku: "..path, player)
return
end
local coded = encodeString("tea", uncoded, {key = getElementData(getRootElement(), "kodowanieModeli")})
fileClose(f)
if not coded then
return
outputChatBox("* Nie uda?o si? zakodowa? danych pliku: "..path, player)
end
local npath = path.."c"
local nf = fileCreate(npath)
if not nf then
outputChatBox("* Nie uda?o si? utworzy? zakodowanej wersji pliku: "..path, player)
return
end
fileWrite(nf, coded)
fileClose(nf)
outputChatBox("* Pomy?lnie zakodowano plik: "..path, player)
local xml = xmlLoadFile("meta.xml", false)
local files = xmlNodeGetChildren(xml)
for i, v in ipairs(files) do
if xmlNodeGetAttribute(v, "src") == npath then return end
end
local child = xmlCreateChild(xml, "file")
xmlNodeSetAttribute(child, "src", npath)
xmlSaveFile(xml)
end

function checkFile(path)
if not fileExists(path) then
if fileExists(path.."c") then
return false
else
return false
end
else
return true
end
end


c.lua (model exterior?w i interior?w)
Kod:

local interiot = createObject(2324,1790.128174,-657.801208,-12.450793)
setElementInterior(interiot,1)
setElementDimension(interiot, -1)
local interiot = createObject(1916,1961.260254,-584.767334,-14.966402)
setElementInterior(interiot,1)
local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1

--[[
KOD
--]]

local models = {}
--models["model_droga"] = 5503
models["parking"] = 8071
models["budynekmagazyn"] = 3707
models["parkingmagazyn"] = 5108
models["salonLS"] = 6205
models["przecho_INT"] = 2324
models["salonLuxury"] = 4016
models["parkingLS_main"] = 1867
models["parkingLS_terrain"] = 1874
models["parkingLS_road"] = 4645
models["przebieralniaLS"] = 4005
models["magazyn"] = 1916

function decode(path, key)
local f = fileOpen(path)
local rawdatac = fileRead(f, fileGetSize(f))
fileClose(f)
local rawdata = decodeString("tea", rawdatac, {key = key})
return rawdata
end

for i, v in pairs(models) do
local loaded = {}
if fileExists("files/"..i..".txd") then
local txd = engineLoadTXD("files/"..i..".txd")
local x = engineImportTXD(txd, v)
if x then loaded.txd = true end
end
if fileExists("files/"..i..".dffc") then
local data = decode("files/"..i..".dffc", getElementData(getRootElement(), "kodowanieModeli"))
local dff = engineLoadDFF(data)
local x = engineReplaceModel(dff, v, true)
if x then loaded.dff = true end
end
if fileExists("files/"..i..".colc") then
local data = decode("files/"..i..".colc", getElementData(getRootElement(), "kodowanieModeli"))
local col = engineLoadCOL(data)
local x = engineReplaceCOL(col, v)
if x then loaded.col = true end
end
outputConsole("[viral_mcompiler] Loaded model(id: "..tostring(v)..", name: "..tostring(i)..", components: txd="..tostring(loaded.txd)..", dff="..tostring(loaded.dff)..", col="..tostring(loaded.col)..")")
end


s.lua (model exterior?w i interior?w)
Kod:

setElementData(getRootElement(), "kodowanieModeli", "s7rM63ewvR&bsN'y")

local serials = {}


addCommandHandler("koduj", function(localPlayer, cmd, name)
if not serials[getPlayerSerial(localPlayer)] then return end
local col = checkFile("files/"..name..".col")
local dff = checkFile("files/"..name..".dff")
local txd = checkFile("files/"..name..".txd")
outputChatBox("dff: "..tostring(dff), localPlayer)
outputChatBox("col: "..tostring(col), localPlayer)
outputChatBox("txd: "..tostring(txd), localPlayer)
if col then
codeFile("files/"..name..".col", localPlayer)
end
if dff then
codeFile("files/"..name..".dff", localPlayer)
end
if txd then
local xml = xmlLoadFile("meta.xml", false)
local files = xmlNodeGetChildren(xml)
for i, v in ipairs(files) do
if xmlNodeGetAttribute(v, "src") == "files/"..name..".txd" then return end
end
local child = xmlCreateChild(xml, "file")
xmlNodeSetAttribute(child, "src", "files/"..name..".txd")
xmlSaveFile(xml)
end
end)

function codeFile(path, player)
if not fileExists(path) then
outputChatBox("* Nie uda?o si? zakodowa? pliku: "..path..", gdy? nie uda?o si? go otworzy?", player)
return
end
local f = fileOpen(path)
if not f then
outputChatBox("* Nie uda?o si? zakodowa? pliku: "..path..", gdy? nie uda?o si? go otworzy?", player)
return
end
local uncoded = fileRead(f, fileGetSize(f))
if not uncoded then
outputChatBox("* Nie uda?o si? odczyta? niezakodowanego pliku: "..path, player)
return
end
local coded = encodeString("tea", uncoded, {key = getElementData(getRootElement(), "kodowanieModeli")})
fileClose(f)
if not coded then
return
outputChatBox("* Nie uda?o si? zakodowa? danych pliku: "..path, player)
end
local npath = path.."c"
local nf = fileCreate(npath)
if not nf then
outputChatBox("* Nie uda?o si? utworzy? zakodowanej wersji pliku: "..path, player)
return
end
fileWrite(nf, coded)
fileClose(nf)
outputChatBox("* Pomy?lnie zakodowano plik: "..path, player)
local xml = xmlLoadFile("meta.xml", false)
local files = xmlNodeGetChildren(xml)
for i, v in ipairs(files) do
if xmlNodeGetAttribute(v, "src") == npath then return end
end
local child = xmlCreateChild(xml, "file")
xmlNodeSetAttribute(child, "src", npath)
xmlSaveFile(xml)
end

function checkFile(path)
if not fileExists(path) then
if fileExists(path.."c") then
return false
else
return false
end
else
return true
end
end


[ Dodano: 2023-01-08, 09:54 ]
Pomo?e kto?

[ Dodano: 2023-01-08, 09:55 ]
pomo?e kto?

Ostatnio zmieniony przez TheSebaPL 2023-02-01, 15:30, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-01-30, 00:56


k1nG

grove street home






Wiek: 26
Na forum: 3557 dni
Posty: 29
Nick w MP: Trust / Tiffergan

Piwa: 12

Respekt: 60

mo?e wy?lij b??dy z konsoli/db3 ?atwiej b?dzie Ci pom?c

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: nie :: wczytują :: się :: modele :: serwer
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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