Hallo,
hab ein Problem sobald ich Ingame gehe ladet nur eine Map -.- aber alles ist in einer Datei.. Er lädt nur alles was In LS ist aber den rest nicht
stock LoadMap(mapname[]){ if (!fexist(mapname)) { printf("Fehler: Die Map konnte nicht geladen werden. Datei %s konnte nicht gefunden werden.", mapname); return 0; }
printf("Loading Map... File %s.", mapname);
new File:mapfile, line[256];
mapfile = fopen(mapname, io_read); while (fread(mapfile, line)) { if (strfind(line, "object id", true) != -1) { new strDest[32], modelid, Float:PosX, Float:PosY, Float:PosZ, Float:RotX, Float:RotY, Float:RotZ;
strmid(strDest, line, strfind(line, "model=", true)+7, strfind(line, "scale=", true)-2); modelid = strval(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posX=", true)+6, strfind(line, "posY=", true)-2); PosX = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posY=", true)+6, strfind(line, "posZ=", true)-2); PosY = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posZ=", true)+6, strfind(line, "RotX=", true)-2); PosZ = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posZ=", true)+6, strfind(line, "RotX=", true)-2); PosZ = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "RotX=", true)+6, strfind(line, "RotY=", true)-2); RotX = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "RotY=", true)+6, strfind(line, "RotZ=", true)-2); RotY = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "RotZ=", true)+6, strfind(line, "></object>", true)-1); RotZ = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
CreateObject(modelid, PosX, PosY, PosZ, RotX, RotY, RotZ);
//<object id="AMT 8558 (2276)" interior="0" collisions="true" alpha="255" doublesided="false" model="8558" scale="1" dimension="0" posX="886" posY="-2513.5" posZ="117.5" rotX="359.484" rotY="359.995" rotZ="235.481"></object> } else if (strfind(line, "type="repair"", true) != -1) { new strDest[32];
strmid(strDest, line, strfind(line, "posX=", true)+6, strfind(line, "posY=", true)-2); gMapRepairData[repairs][E_PICKUP_REPAIR_X] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posY=", true)+6, strfind(line, "posZ=", true)-2); gMapRepairData[repairs][E_PICKUP_REPAIR_Y] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posZ=", true)+6, strfind(line, "rotX=", true)-2); gMapRepairData[repairs][E_PICKUP_REPAIR_Z] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
gMapRepairData[repairs][E_PICKUP_REPAIR_ID] = CreatePickup(1239, 1, gMapRepairData[repairs][E_PICKUP_REPAIR_X], gMapRepairData[repairs][E_PICKUP_REPAIR_Y], gMapRepairData[repairs][E_PICKUP_REPAIR_Z], -1); Create3DTextLabel("REPAIR", 0xFFFFFFFF, gMapRepairData[repairs][E_PICKUP_REPAIR_X], gMapRepairData[repairs][E_PICKUP_REPAIR_Y], gMapRepairData[repairs][E_PICKUP_REPAIR_Z], 60.0, 0, 0);
repairs++; //<racepickup id="racepickup (NRG-500) (33)" type="repair" vehicle="522" respawn="0" posX="739.29999" posY="-3026.6001" posZ="20" rotX="0" rotY="0" rotZ="278.1"></racepickup> } else if (strfind(line, "type="vehiclechange"", true) != -1) { new strDest[32];
strmid(strDest, line, strfind(line, "posX=", true)+6, strfind(line, "posY=", true)-2); gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_X] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posY=", true)+6, strfind(line, "posZ=", true)-2); gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Y] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posZ=", true)+6, strfind(line, "rotX=", true)-2); gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Z] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "vehicle=", true)+9, strfind(line, "respawn=", true)-2); gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_MODEL] = strval(strDest); strdel(strDest, 0, strlen(strDest));
gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_ID] = CreatePickup(1239, 1, gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_X], gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Y], gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Z], -1); Create3DTextLabel(GetVehicleName(gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_MODEL]), 0xFFFFFFFF, gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_X], gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Y], gMapVehicleData[vehiclechanges][E_PICKUP_VEHICLE_Z], 60.0, 0, 0);
vehiclechanges++; //<racepickup id="racepickup (NRG-500) (3)" type="vehiclechange" vehicle="522" respawn="0" alpha="255" interior="0" posX="1185.59961" posY="-3075" posZ="50.3" rotX="0" rotY="0" rotZ="55.797"></racepickup> } else if (strfind(line, "type="nitro"", true) != -1) { new strDest[32];
strmid(strDest, line, strfind(line, "posX=", true)+6, strfind(line, "posY=", true)-2); gMapNitroData[nitros][E_PICKUP_NITRO_X] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posY=", true)+6, strfind(line, "posZ=", true)-2); gMapNitroData[nitros][E_PICKUP_NITRO_Y] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
strmid(strDest, line, strfind(line, "posZ=", true)+6, strfind(line, "rotX=", true)-2); gMapNitroData[nitros][E_PICKUP_NITRO_Z] = floatstr(strDest); strdel(strDest, 0, strlen(strDest));
gMapNitroData[nitros][E_PICKUP_NITRO_ID] = CreatePickup(1239, 1, gMapNitroData[nitros][E_PICKUP_NITRO_X], gMapNitroData[nitros][E_PICKUP_NITRO_Y], gMapNitroData[nitros][E_PICKUP_NITRO_Z], -1); Create3DTextLabel("NITRO", 0xFFFFFFFF, gMapNitroData[nitros][E_PICKUP_NITRO_X], gMapNitroData[nitros][E_PICKUP_NITRO_Y], gMapNitroData[nitros][E_PICKUP_NITRO_Z], 60.0, 0, 0);
nitros++; //<racepickup id="racepickup (NRG-500) (51)" type="nitro" vehicle="522" respawn="0" posX="800.59998" posY="-3125.1001" posZ="46.9" rotX="0" rotY="0" rotZ="12.602"></racepickup> } } fclose(mapfile); print("Map Loaded."); return 1;}