Hallo, wollte das man Ingame ein Team erstellen kann und dieses Team auch in einer xml Datei eingetragen wird.
Script sieht derzeit so aus;
Lua
function machteam(source, teamname, r, g, b)
local acc = getPlayerAccount(source)
if acc then
---if getAccountData(acc, "owner") then
---outputChatBox("Du hast bereits ein Team erstellt!", source, 255, 0, 0)
---else
outputChatBox("Der VIP "..getPlayerName(source).." hat das Team "..teamname.." erstellt!", getRootElement(), 255, 255, 0)
setAccountData(acc, "owner", 1)
setAccountData(acc, "team", tonumber(teamname))
local root = xmlLoadFile("teams.xml")
local team2 = xmlFindChild(root, "teamlist", 0)
if team2 then
local teams = temas +1
local new = xmlCreateChild(team2, "teamname")
xmlNodeSetAttribute(new, "nummer", teams)
xmlNodeSetAttribute(new, "name", tonumber(teamname))
xmlNodeSetAttribute(new, "r", tonumber(r))
xmlNodeSetAttribute(new, "g", tonumber(g))
xmlNodeSetAttribute(new, "b", tonumber(b))
local team = createTeam(teamname, r, g, b)
end
--- end
end
end
addEvent("machteam", true)
addEventHandler("machteam", getRootElement(), machteam)
Alles anzeigen
Aber wenn ich ein Team erstelle, wird es zwar fehlerfrei erstellt aber nicht in die xml Datei abgespeichert!
(Die sieht so aus:
Lua
<team>
<teamlist>
<teamname nummer="0" name="TeamOne" r="100" g="0" b="20" />
</teamlist>
</team>
)
Errors bekomme ich keine.
Mfg KeksKing