PDA

View Full Version : Resseting through scripts?


Knightmare1
11-24-2007, 10:43 PM
well, on lots of servers the NPC server resets you, and i was wondering, how would i do that? alot of people who log onto Final Resort are starting with Utopia items, Utopia flags, and utopia levels. its very hard to reset all of em by myself, so how would i do this?

DustyPorViva
11-24-2007, 10:59 PM
Hmm, can't you just access the account data through the browser nowadays and delete them all yourself?

coreys
11-24-2007, 11:52 PM
sendtorc("/reset account");

Make a database with an array of all the accounts that have been reset. When someone logs on it will check if that players account is in the array, if not it will reset them and add them to the list. Then when you want another reset, you just reset the database.

Of course I prefer to save to a file so that when the NPC Server has to be reconnected or anything like that the list isn't lost. (Therefore resetting everyone)

Inverness
11-25-2007, 12:06 AM
Saving resets to a file is best way.

Crow
11-25-2007, 12:25 AM
Mh, I'm creating a serverflag for every account that has been reset. If they log on its destroyed and they get a clientr.flag. If they have that, they wont get reset :p

cbk1994
11-25-2007, 12:33 AM
if ( this.reset.index( @ player.account ) == -1 )
{
this.reset.add( player.account );
sendToRC( "/reset" SPC player.account );
}


It's pretty simple code. Just add it in the onActionPlayerOnline event in the Control NPC.

Knightmare1
11-25-2007, 02:12 AM
if ( this.reset.index( @ player.account ) == -1 )
{
this.reset.add( player.account );
sendToRC( "/reset" SPC player.account );
}


It's pretty simple code. Just add it in the onActionPlayerOnline event in the Control NPC.

why tyvm. i tryed that with on reset and it reset everytime i logged on

cbk1994
11-25-2007, 02:18 AM
why tyvm. i tryed that with on reset and it reset everytime i logged on

Where did you put it?

Knightmare1
11-25-2007, 02:21 AM
Where did you put it?

Control NPC.

cbk1994
11-25-2007, 02:33 AM
Are you on? I can get on FR and look at it.

Inverness
11-25-2007, 03:04 AM
Ugh, do not store reset data in the Control-NPC.
It should be stored in text file >:O

napo_p2p
11-25-2007, 03:15 AM
Ugh, do not store reset data in the Control-NPC.
It should be stored in text file >:O

Definitely.

If the Control-NPC flags are reset for some reason... you have an involuntary server reset. Plus, that string will have the potential to get really big. If someone just edits the Control-NPC flags via RC, the string could get cut short, and (as a result) some people will be reset again.

A text file is less likely to be cleared or tampered with.

cbk1994
11-25-2007, 03:22 AM
I know, I wanted to give something simple for the forums. If I can catch him on, I'm going to use a text file.

I figured it'd be too hard to explain it through the forums.

Knightmare1
11-25-2007, 04:22 AM
I know, I wanted to give something simple for the forums. If I can catch him on, I'm going to use a text file.

I figured it'd be too hard to explain it through the forums.

im online. and tyvm chris. why arent you on your cbk1994 account?

Inverness
11-25-2007, 05:05 AM
//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.