SA-MP Forums Archive
XML - How to get the name? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: XML - How to get the name? (/showthread.php?tid=431896)



XML - How to get the name? - Narushi - 20.04.2013

Hey,

how can i get the name of an XML-File. (info / name)
Код:
<info gamemodes="race" type="map" name="[DM]Paris Hunter qsh tings By Gustavo" version="1.0.0" />
I want to get the "[DM]Paris Hunter qsh tings By Gustavo".

I tried so, but it dont works. It will output: "Map: "

Код:
		format(MetaXML,sizeof(MetaXML),"%s/meta.xml",pathmeta);
		new XML:Meta = xml_open(MetaXML), data[64];
		if(Meta)
		{
		    xml_get_string(Meta, "info/@name",data);
			format(MapName,sizeof(MapName),"Map: %s",data);
			printf("%s",MapName);
			xml_close(Map);
		} else {
		    printf(" ** Die Meta-XML \"%s\" wurde nicht gefunden.", pathmeta);
		    xml_close(Meta);
		}