06.06.2010, 07:00
Oh wow, nice plugin!
Originally Posted by Romanius
Can I load with this plugin MTA maps?
|
static ObjectCount, VehicleCount; new ObjAttr[][] = { "model", "posX", "posY", "posZ", "rotX", "rotY", "rotZ", "dimension", "interior" }; stock LoadMapFile(const path[], Float:DrawDistance = 200.0, VehRespawn = 20) { new Str[9][40], XML:Map = xml_open(path); if(Map) { new Objects = xml_get_int(Map, "count(map/object)"), Vehicle = xml_get_int(Map, "count(map/vehicle)"), Max = max(Vehicle,Objects); for(new a=1,b=Max+1; a<b; a++) { if(Objects != 0 && Objects >= a) { for(new c=0; c<sizeof(ObjAttr); c++) { format(Str[c], sizeof(Str[]), "map/object[%d]/@%s",a,ObjAttr[c]); } CreateDynamicObject(xml_get_int(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]),xml_get_float(Map,Str[3]),xml_get_float(Map,Str[4]),xml_get_float(Map,Str[5]),xml_get_float(Map,Str[6]),xml_get_int(Map,Str[7]),xml_get_int(Map,Str[8]),-1,DrawDistance); ObjectCount++; } if(Vehicle != 0 && Vehicle >= a) { for(new c=0; c<sizeof(ObjAttr); c++) //Same attributes for vehicles.. { if(c == 4 || c == 5) continue; format(Str[c], sizeof(Str[]), "map/vehicle[%d]/@%s",a,ObjAttr[c]); } CreateVehicleEx(xml_get_int(Map,Str[0]),xml_get_float(Map,Str[1]),xml_get_float(Map,Str[2]),xml_get_float(Map,Str[3]),xml_get_float(Map,Str[6]),xml_get_int(Map,Str[7]),xml_get_int(Map,Str[8]),-1,-1,VehRespawn); VehicleCount++; } } xml_close(Map); return 1; } printf(" ** Map was not found at path \"%s\".", path); return 1; }
Originally Posted by Zeex
No, with this plugin you can only read them, writing features aren't supported yet but I'm planning to add them in future versions.
|
Originally Posted by [TLV
ReVo_ ]
File position? i created 'account.xml' on 'scriptfiles' and not work. |
.../scriptfiles/players
#define LANGUAGE_FILE_XML "Languages.xml" new XML:LangXML; forward XMLConnect(); forward XMLExit(); public OnFilterScriptInit() { XMLConnect(); } public OnFilterScriptExit() { XMLExit(); } public XMLConnect() { LangXML=xml_open(LANGUAGE_FILE_XML); if(!LangXML) { SetConsoleTextColors(CONSOLE_RED); printf("XML Bağlantısı Başarısız..."); SetConsoleTextColors(CONSOLE_DEFAULT); return 1; } else { SetConsoleTextColors(CONSOLE_GREEN); printf("XML Bağlantısı Başarılı..."); SetConsoleTextColors(CONSOLE_DEFAULT); return 1; } } public XMLExit() { xml_close(LangXML); }
XML is better than the files, if yes, why? Is faster, or what? I ask because i do not know XML.
|