JanKy Posted July 20, 2017 Share Posted July 20, 2017 Hi guys. Recently i discovered that my server crashes some people, not everyone, but some gets crashed. After some research and tests i found out that is because my models resource and because of that i tried to split it in 6 minor scripts, but the same result. If all 6 resources are stopped everyone can enter, but everything looks awful, and if i turn on one resource they get crashed. I tried to delete the cache and restart the server, same result. What may be the problem? The technique i use to replace the models or what? Here is an example of one of the scripts : local replace = { {"HA1.txd","HA1.dff",2180}, {"HA2.txd","HA2.dff",2181}, {"HA22.txd","HA2.dff",2182}, {"HA23.txd","HA2.dff",2183}, {"HA3.txd","HA3.dff",2184}, {"HA4.txd","HA4.dff",2185}, {"HA5.txd","HA5.dff",2186}, {"HA6.txd","HA6.dff",2187}, {"HA7.txd","HA7.dff",2188}, {"HA8.txd","HA8.dff",2380}, {"HA9.txd","HA9.dff",2190}, {"HA10.txd","HA10.dff",2191}, {"HA11.txd","HA11.dff",2192}, {"HA12.txd","HA12.dff",2193}, {"HA13.txd","HA13.dff",2194}, {"HA14.txd","HA14.dff",2195}, {"HA15.txd","HA15.dff",2381}, {"HA16.txd","HA16.dff",2197}, {"HA17.txd","HA17.dff",2198}, {"HA18.txd","HA18.dff",2199}, {"HA182.txd","HA18.dff",2200} {"HA183.txd","HA18.dff",2201}, {"HA184.txd","HA18.dff",2202}, {"HA184.txd","HA18.dff",2203}, {"HA20.txd","HA20.dff",2204}, {"HA21.txd","HA21.dff",2205}, {"HA24.txd","HA24.dff",2206}, {"HA25.txd","HA25.dff",2207}, {"HA26.txd","HA26.dff",2208}, {"HA27.txd","HA27.dff",2209}, {"HA28.txd","HA28.dff",2210}, {"HA29.txd","HA29.dff",2211}, {"IT1.txd","IT1.dff",2212}, {"IT2.txd","IT2.dff",2213}, {"IT3.txd","IT3.dff",2214}, {"IT4.txd","IT4.dff",2215}, {"IT5.txd","IT5.dff",2219}, {"IT6.txd","IT6.dff",2218}, {"IT7.txd","IT7.dff",2217}, {"IT8.txd","IT8.dff",2220}, {"IT10.txd","IT10.dff",2221}, {"IT9.txd","IT9.dff",2222}, {"IT11.txd","IT11.dff",2223}, {"IT12.txd","IT12.dff",2224}, {"LU1.txd","LU1.dff",2225}, {"LU1.txd","LU2.dff",2226}, {"LU3.txd","LU3.dff",2227}, {"LU4.txd","LU4.dff",2228}, {"LU5.txd","LU5.dff",2229}, {"LU6.txd","LU6.dff",2230}, {"LU7.txd","LU7.dff",2231}, {"LU8.txd","LU8.dff",2232}, {"LU9.txd","LU9.dff",2233}, {"LU10.txd","LU10.dff",2234}, {"LU11.txd","LU11.dff",2235}, {"MON.txd","MON.dff",2245}, {"AM1.txd","AM1.dff",2470}, {"AM1.txd","AM1.dff",2471}, {"WE9.txd","AM3.dff",2472}, {"AM4.txd","AM4.dff",2473}, {"AM5.txd","AM5.dff",2474}, {"AM6.txd","AM6.dff",2475}, {"AM7.txd","AM7.dff",2291}, {"AM8.txd","AM8.dff",2292}, {"AM9.txd","AM9.dff",2293}, {"AM10.txd","AM10.dff",2468}, } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),function() for _, data in ipairs(replace) do engineImportTXD(engineLoadTXD("skins/"..data[1]),data[3]) engineReplaceModel(engineLoadDFF("skins/"..data[2],0),data[3]) end end) addEventHandler("onClientResourceStart",resourceRoot,function() for _, data in pairs(models) do tex = engineLoadTXD ( ""..data.fileName.. ".txd", data.model ) engineImportTXD ( tex, data.model ) mod = engineLoadDFF ( ""..data.fileName.. ".dff", data.model ) engineReplaceModel ( mod, data.model ) end end) Link to comment
pa3ck Posted July 20, 2017 Share Posted July 20, 2017 Why do you have 2 onClientResourceStart events and have both of them replace the models at the same time? Did you try to put them all in just one single onClientResourceStart and loop through the tables (if you have multiple) after each other? Link to comment
itHyperoX Posted July 20, 2017 Share Posted July 20, 2017 If you want you can use mine. function loadMod (filename,id) if id and filename then if fileExists(filename..".txd") then txd = engineLoadTXD( filename..".txd" ) engineImportTXD( txd, id ) end if fileExists(filename..".dff") then dff = engineLoadDFF( filename..".dff", 0 ) engineReplaceModel( dff, id ) end if fileExists(filename..".col") then col = engineLoadCOL( filename..".col" ) engineReplaceCOL( col, id ) end end end addEventHandler("onClientResourceStart", resourceRoot, function() loadMod("files/vehicles/HotringRacer",494) loadMod("YourFolder/FilesWhereisYourTXD/DFF",the ID) end) Link to comment
JanKy Posted July 20, 2017 Author Share Posted July 20, 2017 So, for example one of the 6 scripts was in this format function replaceModel() txd = engineLoadTXD("skin name 1.txd", 100 ) engineImportTXD(txd, 100) dff = engineLoadDFF("skin name 1.dff", 100 ) engineReplaceModel(dff, 100) txd = engineLoadTXD("skin name 2.txd", 101 ) engineImportTXD(txd, 101) dff = engineLoadDFF("skin name 2", 101 ) engineReplaceModel(dff, 101) txd = engineLoadTXD("skin name 3.txd", 102 ) engineImportTXD(txd, 102) dff = engineLoadDFF("skin name 3", 102 ) engineReplaceModel(dff, 102) -- and so on end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) and my tester couldn't even join the server and then i re-made it like this local replace = { {"skin name 1.txd","skin name 1.dff",100}, {"skin name 2.txd","skin name 2.dff",101}, {"skin name 3.txd","skin name 3.dff",102}, -- and so on } addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),function() for _, data in ipairs(replace) do engineImportTXD(engineLoadTXD("skins/"..data[1]),data[3]) engineReplaceModel(engineLoadDFF("skins/"..data[2],0),data[3]) end end) And after that, the tester could join the game but after a few seconds in game his game got crashed. Any other ideas? Also, @TheMOG do i need to do that for every single texture? Link to comment
itHyperoX Posted July 20, 2017 Share Posted July 20, 2017 (edited) you just need add the *texture name* and the *ID* you dont need to wrtite .txd and .dff. Just: function loadMod (filename,id) if id and filename then if fileExists(filename..".txd") then txd = engineLoadTXD( filename..".txd" ) engineImportTXD( txd, id ) end if fileExists(filename..".dff") then dff = engineLoadDFF( filename..".dff", 0 ) engineReplaceModel( dff, id ) end if fileExists(filename..".col") then col = engineLoadCOL( filename..".col" ) engineReplaceCOL( col, id ) end end end addEventHandler("onClientResourceStart", resourceRoot, function() loadMod("files/vehicles/HotringRacer",494) loadMod("files/vehicles/infernus",411) loadMod("files/vehicles/jester",559) end) Edited July 20, 2017 by TheMOG Link to comment
JanKy Posted July 20, 2017 Author Share Posted July 20, 2017 Doesnt work with this, @TheMOG. I dont need vehicles, i need replacement for buildings and objects, and for weapons. As an example, for a single weapon i need 4 different textures. --АК-101 {"WE1.txd","WE1.dff",2246}, {"WE2.txd","WE1.dff",2246}, {"WE3.txd","WE1.dff",2246}, {"WE4.txd","WE1.dff",2246}, --АК-101 suppressed {"WE1.txd","WE2.dff",2247}, {"WE2.txd","WE2.dff",2247}, {"WE3.txd","WE2.dff",2247}, {"WE4.txd","WE2.dff",2247}, {"WE5.txd","WE2.dff",2247}, --АК-101 ghillie camo {"WE1.txd","WE3.dff",2248}, {"WE2.txd","WE3.dff",2248}, {"WE3.txd","WE3.dff",2248}, {"WE4.txd","WE3.dff",2248}, {"WE6.txd","WE3.dff",2248}, --АК-101 ghillie camo suppressed {"WE1.txd","WE4.dff",2249}, {"WE2.txd","WE4.dff",2249}, {"WE3.txd","WE4.dff",2249}, {"WE4.txd","WE4.dff",2249}, {"WE5.txd","WE4.dff",2249}, {"WE6.txd","WE4.dff",2249}, and there are a lot of weapons like this. Any other replacement techniques or ideas to prevent the crash? Please. Link to comment
Simple0x47 Posted July 20, 2017 Share Posted July 20, 2017 I can help you with it in some hours, add me on skype: killer.68x If you cant I'll send you a solution by PM. Link to comment
f8upd8 Posted July 20, 2017 Share Posted July 20, 2017 (edited) charecterModelsToReplace = {--ARMY Skins- "army/16.txd", "army/16.dff", 16, "army/20.txd", "army/20.dff", 20, "army/23.txd", "army/23.dff", 23, "army/30.txd", "army/30.dff", 30, "army/46.txd", "army/46.dff", 46, "army/48.txd", "army/48.dff", 48, "army/60.txd", "army/60.dff", 60, "army/66.txd", "army/66.dff", 66, "army/67.txd", "army/67.dff", 67, "army/71.txd", "army/71.dff", 71, "army/73.txd", "army/73.dff", 73, "army/95.txd", "army/95.dff", 95, "army/97.txd", "army/97.dff", 97, "army/98.txd", "army/98.dff", 98, "army/144.txd", "army/144.dff", 144, "army/152.txd", "army/152.dff", 152, "army/250.txd", "army/250.dff", 250, --ANIME Skins-- "anime/yagami.txd", "anime/yagami.dff", 202, "anime/nierautomata.txd", "anime/nierautomata.dff", 9, "anime/PENIA.txd", "anime/PENIA.dff", 10, "anime/Yuko Hello Kitty.txd", "anime/Yuko Hello Kitty.dff", 11, "anime/Kimono.txd", "anime/Kimono.dff", 12, "anime/Girl with pink sharp things.txd", "anime/Girl with pink sharp things.dff", 13, "anime/Cayote.txd", "anime/Cayote.dff", 31, "anime/Miku.txd", "anime/Miku.dff", 38, "anime/Kurisu.txd", "anime/Kurisu.dff", 39, "anime/Miku2.txd", "anime/Miku2.dff", 40, "anime/PinkHair unknown braslette.txd", "anime/PinkHair unknown braslette.dff", 53, "anime/berret.txd", "anime/berret.dff", 54, "anime/Miku3.txd", "anime/Miku3.dff", 55, "anime/Ghost Shell.txd", "anime/Ghost Shell.dff", 56, "anime/Yellow Hair girl.txd", "anime/Yellow Hair girl.dff", 63, "anime/Beret 2.txd", "anime/Beret 2.dff", 64, "anime/Pacan.txd", "anime/Pacan.dff", 14, "anime/chibi with electrotail.txd", "anime/chibi with electrotail.dff", 75, "anime/hatsune-miku-vocal-star-remade.txd", "anime/hatsune-miku-vocal-star-remade.dff", 76, "anime/yowane-haku.txd", "anime/yowane-haku.dff", 77, "anime/moxi-purple.txd", "anime/moxi-purple.dff", 85, "anime/owari-no-seraph.txd", "anime/owari-no-seraph.dff", 87, "anime/hoodie-haku-yowane.txd", "anime/hoodie-haku-yowane.dff", 89, "anime/yuezheng-ling.txd", "anime/yuezheng-ling.dff", 90, "anime/mikusweetdevil.txd", "anime/mikusweetdevil.dff", 91, --ZOMBIE Skins- "misc/zombie1.txd", "misc/zombie1.dff", 181, --NPC-- "misc/sidorovich.txd", "misc/sidorovich.dff", 259} techModelsToReplace = {"vehicles/barracks.txd", "vehicles/barracks.dff", 433, "vehicles/swatvan.txd", "vehicles/swatvan.dff", 601, "vehicles/androm.txd", "vehicles/androm.dff", 592, "vehicles/raindanc.txd", "vehicles/raindanc.dff", 563, "vehicles/cargobob.txd", "vehicles/cargobob.dff", 548, "vehicles/hunter.txd", "vehicles/hunter.dff", 425, "vehicles/hydra.txd", "vehicles/hydra.dff", 520, "vehicles/patriot.txd", "vehicles/patriot.dff", 470, "vehicles/seasparrow.txd", "vehicles/seasparrow.dff", 447, "vehicles/maverick.txd", "vehicles/maverick.dff", 487, "vehicles/huntley.txd", "vehicles/huntley.dff", 579, "vehicles/enforcer.txd", "vehicles/enforcer.dff", 427, "vehicles/FBITruck.txd", "vehicles/FBITruck.dff", 528, "vehicles/rhino.txd", "vehicles/rhino.dff", 432} worldObjectsToReplace = {"world/tent.txd", "world/tent.dff", "world/tent.col", 11453, "world/Plane.txd", "world/Plane.dff", "world/Plane.col", 11611, "world/des_ghotfenc06.txd", "world/des_ghotfenc06.dff", "world/des_ghotfenc06.col", 16632, "world/a2_t72.txd", "world/a2_t72.dff", "world/a2_t72.col", 11455} addEvent("readyToLoad", true) addEventHandler("readyToLoad", getLocalPlayer(), function () local skinCount = 1 local techCount = 1 local objCount = 1 repeat skinTXD = engineLoadTXD (charecterModelsToReplace[skinCount]) engineImportTXD (skinTXD, charecterModelsToReplace[skinCount+2]) skinDFF = engineLoadDFF (charecterModelsToReplace[skinCount+1]) engineReplaceModel (skinDFF, charecterModelsToReplace[skinCount+2]) skinCount = skinCount + 3 until (skinCount >= #charecterModelsToReplace) repeat techTXD = engineLoadTXD (techModelsToReplace[techCount]) engineImportTXD (techTXD, techModelsToReplace[techCount+2]) techDFF = engineLoadDFF (techModelsToReplace[techCount+1]) engineReplaceModel (techDFF, techModelsToReplace[techCount+2]) techCount = techCount + 3 until (techCount >= #techModelsToReplace) repeat objTXD = engineLoadTXD (worldObjectsToReplace[objCount]) engineImportTXD (objTXD, worldObjectsToReplace[objCount+3]) objDFF = engineLoadDFF (worldObjectsToReplace[objCount+1]) engineReplaceModel (objDFF, worldObjectsToReplace[objCount+3]) objCOL = engineLoadCOL (worldObjectsToReplace[objCount+2]) engineReplaceCOL (objCOL, worldObjectsToReplace[objCount+3]) objCount = objCount + 4 until (objCount >= #worldObjectsToReplace) end) Looks very weird, but loads fast and good. I guess.. I could just use for if.. If I knew about for. My second script, heh. About the problem, check your script file coding. Once i encoded my script to UTF-8-BOM by accident. And that was.. A big perfomance problem. And check models. It is high chance that one of models has a bug. Edited July 20, 2017 by f8upd8 Link to comment
Simple0x47 Posted July 21, 2017 Share Posted July 21, 2017 (edited) Could you make a table with the Objects ID's you would not mind to replace? If you would do it I could do this replacement on the most optimized way, I just need to have a table like this one with the Objects ID's you don't mind to replace. local replace_ids = { 16105, 12801, 7580, 9123 } Edited July 21, 2017 by Uknown. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now