's up guys, I saw that maps with respawn activated are quiet annoying these days because no server will use them I guess ..
So I had the idea to create a little script based on xml functions for it.
Here it is, once you start the resource which includes the script it'll automatically fix those maps. If you upload a new map during the server is running you can simply use /fixr to fix those maps.Lua Alles anzeigenfunction turnOffRespawn() local RESOURCES = getResources(); local FIXED = 0; for _, RESOURCE in pairs(RESOURCES) do if (getResourceInfo(RESOURCE, "type") == "map") then local name = getResourceName(RESOURCE) local META = xmlLoadFile((":%s/meta.xml"):format(name)); local SETTINGS = xmlFindChild(META, "settings", 0); local RESPAWN = nil; local children = xmlNodeGetChildren(SETTINGS); for i = 1, #children do local setting = xmlFindChild(SETTINGS, "setting", i-1); local nameAttr = xmlNodeGetAttribute(setting, "name"); if (nameAttr == "#respawn") then RESPAWN = setting; local value = xmlNodeGetAttribute(RESPAWN, "value"); if (value ~= '[ "none" ]') then xmlNodeSetAttribute(RESPAWN, "value", '[ "none" ]'); xmlSaveFile(META); FIXED = FIXED + 1 end end end end end outputServerLog(("Fixed %d map%s"):format(FIXED, FIXED >= 2 and "s" or "")); end addEventHandler("onResourceStart", resourceRoot, turnOffRespawn); addCommandHandler("fixr", turnOffRespawn);
For those you don't know, the script probably gunna need admin rights.
Best regards, UnLimiTeD^
Falls jemand das Englische nicht versteht soll er fragen ...
Original Post: https://www.sixth-sen.se/index.php?/for…s/#comment-3695