02.11.2015, 02:02
It is possible to put objects within a file, and everytime I get the server on it will reload the map from the file itself instead of spamming my gamemode with mapping and such.
Object model|PosX|PosY|PosZ|RotX|RotY|RotZ
19941|144.134|931.33|444.11|0.0|.0.0|0.0 4141|1444.134|1131.33|44.11|0.0|.0.0|0.0 5414|1484.134|51.33|344.11|0.0|.0.0|0.0
LoadObjects()
{
new
File:handle = fopen("objects.txt", io_read),
buf[128]
;
if(!handle) return 0;
new
model,
Float:pos[3],
Float:rot[3],
count
;
while(fread(handle, buf))
{
if(sscanf(buf, "p<|>dffffff", model, pos[0], pos[1], pos[2], rot[0], rot[1], rot[2]))
{
count++;
CreateObject(model, pos[0], pos[1], pos[2], rot[0], rot[1], rot[2]);
}
}
fclose(handle);
printf("Objects loaded from 'objects.txt': %d objects.", count);
return 1;
}
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid);
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid, interiorid);
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid, interiorid, playerid);
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid, interiorid, playerid, Float:streamdistance);
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid, interiorid, playerid, Float:streamdistance, Float:drawdistance);
Map_Load("your_file_name");
https://github.com/Gammix/Map-Loader
An edit of Southclaw's map parser filterscript to an include, you can very easily move all your map code to a file and then do in your script: pawn Код:
|