$NPCSpawnCount = 0;
function serverCmdNPCSpawn(%client,%type)
{
$NPCSpawnData[$NPCSpawnCount] = %type SPC isObject(%client.player) ? %client.player.getPosition() : "0 0 0";
$NPCSpawnCount++;
writeNPCSpawn();
}
function writeNPCSpawn()
{
%file = new FileObject();
%file.openForWrite("config/server/Medieval/NPC/Spawns.txt");
%file.writeLine($NPCSpawnCount);
for(%i=0;%i<$NPCSpawnCount;%i++)
{
%file.writeLine($NPCSpawnData[%i]);
}
%file.close();
%file.delete();
}
Try using my code, there are heaps of things wrong with your code it's probably faster to use this.