Quote:
Originally Posted by NoteND
I made enum for it if thats what u meant
#define OBJECTS 30000
enum ObjectData //Object Data
{
id,
model,
Float osX,
Float osY,
Float osZ,
Float:rotX,
Float:rotY,
Float:rotZ
}
new oInfo[OBJECTS][ObjectData];
|
What he meant is you paste the coordinates in the script
so you'd fill your oInfo with a predefined values like
Код:
// Note, object is just an example
new oInfo[OBJECTS][Objects] = {
{INVALID_OBJECT_ID, 2976, 1.0, 2.0, 3.0, 0.0, 0.0, 180.0},
// ....
};
for (new i = 0; i < OBJECTS; i++)
{
oInfo[i][model] = CreateDynamicObject(oInfo[i][model], oInfo[i][posX], oInfo[i][posY], oInfo[i][posZ], oInfo[i][rotZ], oInfo[i][rotY], oInfo[i][rotZ]);
}
// or 2nd
oInfo[0][model] = 2976,
oInfo[0][posX] = 1.0,
oInfo[0][posY] = 2.0,
oInfo[0][posZ] = 3.0,
oInfo[0][rotY] = 0.0,
oInfo[0][rotZ] = 0.0,
oInfo[0][rotZ] = 180.0,
oInfo[0][id] = CreateDynamicObject(oInfo[0][model], oInfo[0][posX], oInfo[0][posY], oInfo[0][posZ], oInfo[0][rotZ], oInfo[0][rotY], oInfo[0][rotZ]); // or loop it like 1st way
// or 3rd
oInfo[0][id] = CreateDynamicObject(2976, 1.0, 2.0, 3.0, 0.0, 0.0, 180.0);
oInfo[0][model] = 2976,
oInfo[0][posX] = 1.0,
oInfo[0][posY] = 2.0,
oInfo[0][posZ] = 3.0,
oInfo[0][rotY] = 0.0,
oInfo[0][rotZ] = 0.0,
oInfo[0][rotZ] = 180.0;
// ...
1st way is preferable
Well forget the second way, even if it's possible that wont be friendly with the coder and the compiler.
Instead of having .map you'd better convert it to CreateDynamicObject ready like using
https://convertffs.com/
So you'd just paste the CreateDynamicObject line without having it stored in any variables (unless you want to do it like 3rd way which is the worst)
Код:
CreateDynamicObject(2976, 1.0, 2.0, 3.0, 0.0, 0.0, 180.0);
Well going too rough off with the topic, you should explain how you actually loop the .map files with
If you are using PAWN to fopen every MTA's .map files and XML Parse, and storing it again to the variables & enums you mentioned above, you'd expect such slowness...
Get your maps manually converted first in a batch, if you want it to load on run time, utilize a database with objects structures, it's actually easy to convert map & store .xml data to .sql, then from PAWN code, use a threaded query for a map (or two and more), create the objects (or store it to your variable first), then process another file, you can schedule this so after creating a map, your system CPU will idle a bit for "some rest", and continue again the next second(s). Decide how many map/cycles to process, it depends on your server's system performance (and the script ofc), since three maps at once could be faster than loading 1 map three times, while loading 6 maps at once is slower (relative to the map size).
Now if you don't care with that all, and just want the map to be created, use ConvertFFS, convert your map, paste your CreateObject, no need variable/enums or database / system that loop files in your pawn script and your overhead will be at compile time.
But to be honest, you need to add more details on what you want to achieve....