PHP Code:
//In Control-NPC
function onInitialized() {
// Loading reset accounts list into a global variable when the NPC-Server starts.
resetaccounts = 0;
resetaccounts.loadlines("levels/resetaccounts.txt");
}
function onActionPlayerOnline() {
// Check if the player's account is in the list.
if (resetaccounts.index(player.account) < 0) {
// Reset him if its not.
sendtorc("/reset " @ player.account);
// Add his account to the list so hes not reset again.
resetaccounts.add(player.account);
// Save the list of reset accounts to file again without unloading it from memory.
resetaccounts.savelines("levels/resetaccounts.txt", 0);
}
}
There, I don't think I missed anything.
You can use that method, or only use resetaccounts.txt for players that are currently in the process of resetting then just give them a clientr flag after the reset.