Heló fórum!
Találtam egy object betöltõt az angol fórumon:
http://forum.sa-mp.com/showthread.php?t=176461
INC:
//
// MTA .map loader by mick88
// Release 0.1
// 13th September 2010
//
// MTA .map files supported for MTA verion 1.0.4,
// other versions not tested
//
// Requirements: SSCANF2 plugin by Y_Less
//
//
// FS commands for RCON admin: /LoadMtaMap [file path) - loads .map file
// /DeleteVehicles - deletes all spawned vehicles
// /DeleteObjects - deletes all created objects
//
// Public function: LoadMtaMap(file[]) - loads .map file
//
//
// Supported map items: objects, vehicles
//
// Supported object data: model, posX, posY, posZ, rotX, rotY, rotZ
// Supported vehicle data: model, paintjob, mods (upgrades), colors (2 colors),
// posX, posY, posZ, rotZ, interior, world (dimension)
//
// Currently not supported:
// 3rd nad 4th vehicle colors, vehicle registration, vehicle rotations X and Y
//
//
#include <a_samp>
#include <sscanf2>
#define ADD_OBJECT(%1) CreateObject(%1) //Change this if you use a streamer i.e. to CreateDynamicObject(%1) for Incognito\'s streamer etc.
//the function must have format: model x y z rx ry rz
#define DELETE_OBJECT(%1) DestroyObject(%1) //Change this if you use a streamer
#define MAX_CREATED_OBJECTS MAX_OBJECTS //max id of object to be deleted. Change if you use a streamer
#define VEHICLE_RESPAWN_DELAY 60*5 //60*5 is 5 minutes
#define MAX_MODS 14 //there is 14 vehicle component slots in gta (0-13)
forward LoadMtaMap(file[]);
public LoadMtaMap(file[])
{
if (!fexist(file)) return 0;
new File:MapFile=fopen(file);
new n, string[400];
new Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz;
new modelid, paintjob, interior, world;
while(fread(MapFile, string))
{
if (!sscanf(string, \"p<\\\">\'object\'\'model=\'d\'interior=\'d\'dimension=\'d\'posX=\'f\'posY=\'f\'posZ=\'f\'rotX=\'f\'rotY=\'f\'rotZ=\'f\", modelid, interior, world, x, y, z, rx, ry, rz))
{
n++;
//modelid x y z rx ry rz interior world
ADD_OBJECT(modelid, x, y, z, rx, ry, rz);
}
else if (!sscanf(string, \"p<\\\">\'vehicle\'\'paintjob=\'d\'model=\'d\'interior=\'d\'dimension=\'d\'posX=\'f\'posY=\'f\'posZ=\'f\'rotZ=\'f\", paintjob, modelid, interior, world, x, y, z, rz))
{
n++;
new col1, col2, colors[20];
sscanf(string, \"p<\\\">\'color=\'s[20] \", colors);
sscanf(colors, \"p<,>dd\", col1, col2);
new mods[80], mod[MAX_MODS];
sscanf(string, \"p<\\\">\'upgrades=\'s[80] \", mods);
sscanf(mods, \"p<,>A<d>(0)[\"#MAX_MODS\"]\", mod);
//modelid x y z rz col1 col2 paintjob interior world
new vehicleid = CreateVehicle(modelid, x, y, z, rz, col1, col2, VEHICLE_RESPAWN_DELAY);
for (new i; i < MAX_MODS; i++) if (mod) AddVehicleComponent(vehicleid, mod);
ChangeVehiclePaintjob(vehicleid, paintjob);
LinkVehicleToInterior(vehicleid, interior);
SetVehicleVirtualWorld(vehicleid, world);
}
}
fclose(MapFile);
printf(\"%d items loaded from \'%s\'\", n, file);
return n;
}
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!IsPlayerAdmin(playerid)) return false; //Admin commands
new command[32], param[64];
if (sscanf(cmdtext[1], \"s[32]S()[64]\", command, param)) return false;
if (!strcmp(command, \"loadmtamap\"))
{
if (!param[0]) return SendClientMessage(playerid, 0xFF0000FF, \"Usage: /LoadMtaMap [file path]\");
new msg[128];
new n = LoadMtaMap(param);
format(msg, 128, \"%d items loaded from %s\", n, param);
SendClientMessage(playerid, 0xFFFFFFFF, msg);
return 1;
}
else if (!strcmp(command, \"deletevehicles\"))
{
for (new i=1; i < MAX_VEHICLES; i++) DestroyVehicle(i);
SendClientMessage(playerid, 0xFFFFFFFF, \"All vehices have been destroyed!\");
return 1;
}
else if (!strcmp(command, \"deleteobjects\"))
{
for (new i=1; i < MAX_CREATED_OBJECTS; i++) DELETE_OBJECT(i);
SendClientMessage(playerid, 0xFFFFFFFF, \"All objects have been deleted!\");
return 1;
}
return 0;
}
Az a baj, hogy nem tudom, hogy hogy kell használni, aki tudja, kérem írja le!
Heló: Havasi
Például, ha MTA-ban csináltál egy mapot, és lemetetted drift néven, akkor kaptál egy drift.map fájlt. Azt a drift.map fájlt berakod a scriptfiles mappába és a módba a GameModeInit alá beírod a következõ módon:
public OnGameModeInit()
{
LoadMtaMap(\"drift.map\", true);
return 1;
}
Remélem érthetõen leírtam. :)