Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Resseting through scripts? (https://forums.graalonline.com/forums/showthread.php?t=77689)

Knightmare1 11-24-2007 10:43 PM

Resseting through scripts?
 
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

PHP Code:

if ( this.reset.index( @ player.account ) == -)
{
  
this.reset.addplayer.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

Quote:

Originally Posted by cbkbud (Post 1360256)
PHP Code:

if ( this.reset.index( @ player.account ) == -)
{
  
this.reset.addplayer.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

Quote:

Originally Posted by Knightmare1 (Post 1360281)
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

Quote:

Originally Posted by cbkbud (Post 1360285)
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

Quote:

Originally Posted by Inverness (Post 1360295)
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

Quote:

Originally Posted by cbkbud (Post 1360300)
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

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.


All times are GMT +2. The time now is 02:49 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.