I ran into some problems using copylevel() yesterday and had to look at resources from different threads to figure out my problem entirely so I decided to put all my findings into one thread in hopes that it makes it easier for others to understand how to use this command.
Important Notes
. copylevel() is used to create an exact duplicate of a level that will be saved into a different directory from that of the level being copied (the copied level does NOT have to have the same name as the original level)
. The NPC-Server must have read rights to the directory where the level to be copied can be found.
. The NPC-Server must have read/write rights to the directory where the copied level is going to be saved.
. There must be a placeholder file in the directory that you're going to save the copied level to that is bigger than 0 kb in order for the level to be saved correctly (assuming the directory didn't exist before and doesn't have any files in it).
. Avoid using "levels/" when defining your directories in both parameters.
. copylevel() can only be performed on the serverside.
Example
You wish to copy testLevel.nw from the levels/test/ directory into the levels/backup/test/ directory (assuming all the notes above are met):
PHP Code:
copylevel("test/testLevel.nw", "backup/test/testLevel.nw");