Jump to content

Pirulax

Discord Moderators
  • Posts

    403
  • Joined

  • Last visited

Everything posted by Pirulax

  1. Jesus Christ, why do you even guys help him?
  2. The table constructor is '{}' not '[]". But, back on topic, I'm sure you can pass a table thru without a problem. If for some reason you really can't, then use toJSON and fromJSON.
  3. You can't change the css/js/html files because their hash is checked before load(.html are checked by MTA, but you can also add check for other's(js, and css with the 'hash' attribute).
  4. You should be able to send thru a table without a problem.
  5. Making that much colshapes can cause lag. Especially when created server-side.
  6. Is the script you're trying to call the export from on server-side? Is the script where 'getRandomLoot' is on server-side?
  7. The way I did it was I injected everything from LUA with executeBrowserJavaScript. Nice and easy solution.(You can inject everything with JS actually, css, JS, HTML)
  8. Actually, I found a better solution after I wrote that one. function getVehicleKey(key) local fName = "model.dff" local modelID = 409 local hFile = fileOpen(fName) if hFile then engineImportTXD(engineLoadTXD('tex.txd',true) , modelID) engineReplaceModel(engineLoadDFF(decodeString("tea", fileRead(hFile, fileGetSize(hFile)) , {key = key})), modelID) fileClose(hFile) else outputConsole("DFF couldn't be loaded!") end end And yeah, you'll need to re-encode every model you have, with encodeString. I suppose you used waay to much variables, which caused memory allocations in the LuaVM(niling out really does nothing here) But instead, you can use 'collectgarbage("collect")'
  9. But for sure, your is more general purpose. you got a like from me for that
  10. @MIKI785's solution is the best I think.
  11. @MrTasty Thanks! I'll add a note then to teaEncode/Decode, didn't knew that.
  12. @#,xiRocKyz Thanks! I good to know that little life hack
  13. function formatTime(ms) local totalseconds = math.floor(ms / 1000) return string.format("%.2i:%.2i", math.floor(totalseconds / 60) % 60, totalseconds % 60) end
  14. local isMenuVisible = false function menu() -- dx drawing stuff end bindKey("f1","down",function() isMenuVisible = not isMenuVisible -- Flip the state(if it's was true now it's false, and vice versa) ((isMenuVisible and addEventHandler) or (removeEventHandler))("onClientRender", root, menu) if menuVisible then --// Do some stuff here if you want else --// or here end end)
  15. Or actually not.. local positions = { {1941, 197.7, 2352,2 5.9, 0, 0, 0}, {1943, 412.20001, 2455.1001, 15.5, 0, 0, 90}, {1941, 268.5, 2396.7, 25.5, 0, 0, 0}, } Now it should be fine.
  16. Jesus Christ.. I don't know what kind of :~ habbit is to put a variable for a value that you only use ONCE. Please god, not, just no.
  17. No, it still ads +33% to the size of it with encodeString, doesn't it? You just encoded it and put that in the meta.xml, didn't you?
  18. addEventHandler("onClientGUIClick", guiCreateStaticImage(100, 100, 100, 100, "skin1.png", false), function() engineImportTXD(engineLoadTXD ("skin1.txd"), 411) engineReplaceModel(engineLoadDFF("skin1.dff"), 411) end, false) btw, what's the problem? Edit: Indentation is wrong.. again..
  19. @!#NssoR_) Even simpler: assignLOD(createObject(unpack(v)))
  20. @MrTasty @JeViCo What I thought was to actually store decoded files and such server-side, then at resource start: Read Store raw data sha256(Encode(T.E.A.)) (store the hash of the encoded data, bc only the encoded data'll be stored client-side) Now, when the resource starts client-side: Check if the files exist(The server should send a table(k = file path, v = hash) with all the files that the specified resource should have) Collect every file that is missing(or has a bad hash) and send a table with the missing files to the server The server sends the requested files(non-encoded) Now, just encoded the files you got from the server and store it on the client's computer. you need to do this this way bc of how T.E.A works(it returns a base64 string which adds +33% to the size)
  21. So you download the file and then encode it? What if it downloads the file and then I close my MTA? The file'll stay there. So really isn't a good solution, maybe send thru the file's content instead with triggerLatentClientEvent And then just simply encode and save it(you should store a hash on client side to check whenever the file is valid or not)
  22. How can you replace cloth models btw? Every time I tried to do so it just gave me a warning saying that it's a wrong modelid.
×
×
  • Create New...