So pretty much what I'm trying to do, is make an in-game command, that would edit part of the configuration .xml for the zDay script. I think this can be pretty useful, and am wondering if I could get some help with it? I looked through the wiki, and found several XML commands, can someone point out where I went wrong?
config = xmlLoadFile("C:\Users\MTAServer\Desktop\server\mods\deathmatch\resources\zombies\meta.xml")
function changeMaxZombies(thePlayer, commandName, zombiemax)
if not (zombiemax) then
outputChatBox("SYNTAX: /" .. commandName .. " [max numbers of zombies to spawn]", thePlayer, 255, 194, 14)
else
local markernode = xmlFindChild(config, "setting", 0)
xmlNodeSetAttribute(markernode, "name="*MaxZombies" value="[" .. zombiemax .. "]"")
xmlSaveFile(config)
outputChatBox("Done.", thePlayer, 255, 194, 14)
end
end
end
addCommandHandler("setzombienumber", changeMaxZombies)
And this is the line of XML I am trying to replace:
"*MaxZombies" value="[20]" />
I'm trying to replace the integer where 20 is, with the integer of my choice, or zombiemax.
So pretty much where it's stuck is, when I type the command with an incorrect syntax, it will give me the syntax to type it in, but when I give it the correct syntax, "Done." does not get outputted, so my problem lies within the XML parts.
I'd appreciate any help on this.