![](https://forum.multitheftauto.com/uploads/monthly_2018_02/bgimg..png.2e935deab1b1b4c3240520a864d18cfc.png)
Pirulax
Discord Moderators-
Posts
403 -
Joined
-
Last visited
Everything posted by Pirulax
-
Jesus Christ, why do you even guys help him?
-
[HELP] Remove Player From ElementData "faction" Police
Pirulax replied to Mσнαмα∂ Hєℓιѕн's topic in Scripting
But it'll remain synced -
[HELP] Remove Player From ElementData "faction" Police
Pirulax replied to Mσнαмα∂ Hєℓιѕн's topic in Scripting
lmao, 'nil' doesn't remove the elementdata... -
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.
-
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).
-
You should be able to send thru a table without a problem.
-
Making that much colshapes can cause lag. Especially when created server-side.
-
Is the script you're trying to call the export from on server-side? Is the script where 'getRandomLoot' is on server-side?
-
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)
-
DFF-encryption causes client's breakdowns. Efficient suggestions?
Pirulax replied to maximumdrive's topic in Scripting
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")' -
But for sure, your is more general purpose. you got a like from me for that
-
@MIKI785's solution is the best I think.
-
@MrTasty Thanks! I'll add a note then to teaEncode/Decode, didn't knew that.
-
@#,xiRocKyz Thanks! I good to know that little life hack
-
function formatTime(ms) local totalseconds = math.floor(ms / 1000) return string.format("%.2i:%.2i", math.floor(totalseconds / 60) % 60, totalseconds % 60) end
-
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)
-
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.
-
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.
-
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?
-
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..
-
@!#NssoR_) Even simpler: assignLOD(createObject(unpack(v)))
-
@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)
-
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)
-
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.