Код:
stock GetMapCount()
{
new mcount = 0, file[600];
for(new i = 0; i < MAX_MAP_FILES; i++)
{
format(file, sizeof(file), "/Maps/%d.ini", i);
if(fexist(file))
{
mcount ++;
}
}
return mcount;
}
stock GetFreeMapID()
{
new file[50], id = 0;
for(new i = 0; i < MAX_MAP_FILES; i++)
{
format(file, sizeof(file), "/Maps/%d.ini", i);
if(fexists(file)) continue;
id = i;
break;
}
return id;
}
stock NoMapCheck()
{
new tcount = 0, file[500];
for(new i = 0; i < MAX_MAP_FILES; i++)
{
format(file, sizeof(file), "/Maps/%d.ini", i);
if(fexist(file))
{
tcount ++;
}
}
if(tcount == 0)
{
print("_____________________________________________________________");
print("WARNING: The server has detected there are no map files!");
print("currently installed. The server has been set to");
print("automatically shut down in 25000/ MS. (25 Seconds)");
print("_____________________________________________________________");
SetTimer("No_Maps", 25000, false);
return 1;
}
return 1;
}
function No_Maps() return SendRconCommand("exit");
public load_Map_basic(Mapid, name[], value[])
{
if(strcmp(name, "FSMapName", true) == 0)
{
strmid(Map[FSMapName], value, false, strlen(value), 128);
LoadFilterScript(Map[FSMapName]);
}
/*printf("[Debug] Name: %s - Value: %s", name, value); For Debug Purposes*/
if(strcmp(name, "MapName", true) == 0)
{
new mpname[50];
strmid(Map[MapName], value, false, strlen(value), 128);
format(mpname, sizeof(mpname), "mapname %s", Map[MapName]);
SendRconCommand(mpname);
}
if(strcmp(name, "HumanSpawnX", true) == 0) Map[HumanSpawnX] = floatstr(value);
if(strcmp(name, "HumanSpawnY", true) == 0) Map[HumanSpawnY] = floatstr(value);
if(strcmp(name, "HumanSpawnZ", true) == 0) Map[HumanSpawnZ] = floatstr(value);
if(strcmp(name, "HumanSpawn2X", true) == 0) Map[HumanSpawn2X] = floatstr(value);
if(strcmp(name, "HumanSpawn2Y", true) == 0) Map[HumanSpawn2Y] = floatstr(value);
if(strcmp(name, "HumanSpawn2Z", true) == 0) Map[HumanSpawn2Z] = floatstr(value);
if(strcmp(name, "ZombieSpawnX", true) == 0) Map[ZombieSpawnX] = floatstr(value);
if(strcmp(name, "ZombieSpawnY", true) == 0) Map[ZombieSpawnY] = floatstr(value);
if(strcmp(name, "ZombieSpawnZ", true) == 0) Map[ZombieSpawnZ] = floatstr(value);
if(strcmp(name, "Interior", true) == 0) Map[Interior] = strval(value);
if(strcmp(name, "GateX", true) == 0) Map[GateX] = floatstr(value);
if(strcmp(name, "GateY", true) == 0) Map[GateY] = floatstr(value);
if(strcmp(name, "GateZ", true) == 0) Map[GateZ] = floatstr(value);
if(strcmp(name, "CPx", true) == 0) Map[CPx] = floatstr(value);
if(strcmp(name, "CPy", true) == 0) Map[CPy] = floatstr(value);
if(strcmp(name, "CPz", true) == 0) Map[CPz] = floatstr(value);
if(strcmp(name, "GaterX", true) == 0) Map[GaterX] = floatstr(value);
if(strcmp(name, "GaterY", true) == 0) Map[GaterY] = floatstr(value);
if(strcmp(name, "GaterZ", true) == 0) Map[GaterZ] = floatstr(value);
if(strcmp(name, "MoveGate", true) == 0) Map[MoveGate] = strval(value);
if(strcmp(name, "GateID", true) == 0) Map[GateID] = strval(value);
if(strcmp(name, "AllowWater", true) == 0) Map[AllowWater] = strval(value);
if(strcmp(name, "EvacType", true) == 0) Map[EvacType] = strval(value);
if(strcmp(name, "Weather", true) == 0)
{
Map[Weather] = strval(value);
SetWeather(Map[Weather]);
}
if(strcmp(name, "Time", true) == 0)
{
Map[Time] = strval(value);
SetWorldTime(Map[Time]);
printf("Map ID %d's Information Has Been Loaded.", Mapid);
}
return 1;
}
stock LoadMap(Mapid)
{
new Map_file[80];
format(Map_file, sizeof(Map_file), "/Maps/%d.ini", Mapid);
if(fexist(Map_file))
{
printf("loading Map %s", Map_file);
INI_ParseFile(Map_file, "load_Map_%s", .bExtra = true, .extra = Mapid);
return 1;
}
return 0;
}
stock LoadNewMap()
{
new file[64];
mapid %= MAX_MAP_FILES;
format(file, sizeof(file), "/Maps/%d.ini", mapid);
if(!fexist(file)) return printf("[NOTICE] File Bugged.");
LastMapStarted = mapid;
mapid++;
return mapid-1;
}