TheIceman1 Posted April 9, 2013 Share Posted April 9, 2013 (edited) Why this dont upload "clans.xml"? Server side: function createclan() local clan = getElementData ( source, "clan" ) setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) local root = xmlLoadFile ("clans.xml") local clanroot = xmlFindChild (root,"clans",0) if (clanroot) then xmlNodeSetAttribute (clanroot,"clan", clan) end end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) clans.xml: Edited April 9, 2013 by Guest Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 EDITED Nothing happens. Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 Post what you do . I edit code,look at first post. Link to comment
iPrestege Posted April 9, 2013 Share Posted April 9, 2013 function createclan() local clan = getElementData ( source, "clan" ) setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) local root = xmlLoadFile ("clans.xml") local clanroot = xmlFindChild (root,"clans",0) if (clanroot) then xmlNodeSetAttribute (clanroot,"clan", clan) end xmlSaveFile( clanroot ) xmlUnloadFile ( clanroot ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 function createclan() local clan = getElementData ( source, "clan" ) setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) local root = xmlLoadFile ("clans.xml") local clanroot = xmlFindChild (root,"clans",0) if (clanroot) then xmlNodeSetAttribute (clanroot,"clan", clan) end xmlSaveFile( clanroot ) xmlUnloadFile ( clanroot ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) Nothing happens Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 No,and edit "clanroot" to "root" in function xmlSaveFile, and xmlUnloadFile. But dont work. Link to comment
PaiN^ Posted April 9, 2013 Share Posted April 9, 2013 Show how you trigger the event + where you set the data .. Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 Client side: function createclan() if ( source == GUIEditor_Button[2] ) then local clan = guiGetText ( GUIEditor_Edit[1] ) setElementData ( localPlayer, "clan", clan) triggerServerEvent ( "createclan",localPlayer) end end addEventHandler ( "onClientGUIClick", root, createclan ) Link to comment
iPrestege Posted April 9, 2013 Share Posted April 9, 2013 Sorry forget something try this now : function createclan() local clan = getElementData ( source, "clan" ) if not isGuestAccount ( getPlayerAccount(source) ) then setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) end local root = xmlLoadFile ("clans.xml") local clanroot = xmlFindChild (root,"clans",0) if (clanroot) then xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlCreateChild(root, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) end xmlSaveFile( clanroot ) xmlUnloadFile ( clanroot ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) Link to comment
TheIceman1 Posted April 9, 2013 Author Share Posted April 9, 2013 Sorry forget something try this now : function createclan() local clan = getElementData ( source, "clan" ) if not isGuestAccount ( getPlayerAccount(source) ) then setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) end local root = xmlLoadFile ("clans.xml") local clanroot = xmlFindChild (root,"clans",0) if (clanroot) then xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlCreateChild(root, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) end xmlSaveFile( clanroot ) xmlUnloadFile ( clanroot ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) Nothing happens. Link to comment
MR.S3D Posted April 9, 2013 Share Posted April 9, 2013 function createclan() local xml = xmlLoadFile ("clans.xml") local clan = getElementData ( source, "clan" ) if not isGuestAccount ( getPlayerAccount(source) ) then setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) end local clanroot if (not xml) then xmlFile = xmlCreateFile(xml, "settings") clanroot = xmlCreateChild(xml, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlFindChild (xml,"clans",0) if clanroot then xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlCreateChild(xml, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) end end xmlSaveFile( xml ) xmlUnloadFile ( xml ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan ) 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