19.05.2012, 19:29
Title says it..
How do I change mad without the server restarting? Thanks.
How do I change mad without the server restarting? Thanks.
CMD:loadmap(playerid, params[])
{
new
mapname[60], // a new string for the mapname
string[128] // the string that will be formatted as the path
;
if(sscanf(params, "s[60]", mapname)) // if they didn't type a name
{
// then it sends this message
SendClientMessage(playerid, -1, "USAGE: /loadmap [mapname]");
return 1;
}
// if they did type a name then it formats the name with '.txt'
format(string, 128, "%s.txt", mapname);
// if the file does not exist
if(!fexist(string))
{
// then it returns this message
return SendClientMessage(playerid, -1, "Invalid Map Path");
}
new
File:map = fopen(string, io_read), // open the file for reading
// we then define new variables for the object info.
model,
f:x,
f:y,
f:z,
f:rotX,
f:rotY,
f:rotZ,
f:drawdistance,
szObject[150], // the string to store the file lines in
objectcount = 0 // the count for the objects
;
// while there is text in the line, we read the line, and store the line into the szObject string
while(fread(map, szObject))
{
// using sscanf, we split the line into the object paramters and if the line does
// not follow this format ...
if(sscanf(szObject, "dfffffff", model, x, y, z, rotX, rotY, rotZ, drawdistance))
{
// then we print the formatted print on the console
printf("Invalid Line Format At File: %s", string);
// and then skip the loop iteration
continue;
}
// we split the line into the object format
sscanf(szObject, "dfffffff", model, x, y, z, rotX, rotY, rotZ, drawdistance);
// then we create the object
CreateObject(model, x, y, z, rotX, rotY, rotZ, drawdistance);
// and the object count goes up
objectcount++;
}
printf("%d objects loaded from file: %s", objectcount, string);
fclose(map); // we then close the file
return 1;
}
new Map1[60];
new Map2[60];
OnGameModeInit()
{
Map1[0] = CreateObject(..);
Map1[1] = CreateObject(..);// Game Mode starter map.
return 1;
}
Command header here.
{
for(new i = 0; i < sizeof(Map2); i++)
{
Map2[i] = CreateObject(..);//creates the Map2 defined objects
}
return 1;
}
Command Header Here.
{
for(new i = 0; i < sizeof(Map2); i++)
{
DestroyObject(Map2[i]);//Destorys the Map2 defined objects
}
return 1;
}
CMD:changemapname(playerid, params[])
{
new
name[60],
command[128]
;
if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /changemapname [newname]");
format(command, 128, "mapname %s" name);
SendRconCommand(command);
return 1;
}