PDA

View Full Version : Resetting Player Attributes


xAndrewx
09-25-2006, 09:08 PM
Create a new database called
'Control_PlayerReset'
Inside that database, add in this script:


public function doPlayerReset(playerAccount, resetNumber)
{
if (temp.playerAccount in this.(@ "v" @ temp.resetNumber @ "-accounts"))
{
return false;
}

this.(@ "v" @ temp.resetVersion @ "-accounts").add(temp.playerAccount);
sendtorc("/reset " @ temp.playerAccount);

this.trigger("update", "");
}


Once you've added both of those two in, add in the Control-NPC [Or in a player-login sequence if there is one!] this script


//Change the second value to the reset value for a quick reset
Control_PlayerReset.doPlayerReset(player.account, 1);

Yen
09-25-2006, 10:07 PM
function onPlayerLogin() is called on DBs at log in :O

xAndrewx
09-25-2006, 10:56 PM
function onPlayerLogin() is called on DBs at log in :O

Via a class etc :p

KuJi
09-25-2006, 11:08 PM
Uhh.. I make it save into a textfile via savevars (with the version + account)

MAINLY due to npc restart.. /savenpcs doesn't always work and people end up getting double-reset0rized =o

xXziroXx
09-26-2006, 02:57 AM
function onPlayerLogin() is called on DBs at log in :O

Isnt it only called in the Control-NPC?

KuJi
09-26-2006, 03:26 AM
Isnt it only called in the Control-NPC?


function onPlayerLogin(temp.plyr)
{
}


would work in any database npc.. and even in weapons/scripts. (clientsided aswell)
ex:


function onPlayerLogin(temp.plyr)
{
if (temp.plyr != NULL)
{
player.chat = format("%s has logged on!", temp.plyr); // I think?
}
}

xXziroXx
09-26-2006, 03:39 AM
Well look at that! I learned something new!

xAndrewx
09-26-2006, 09:30 AM
Uhh.. I make it save into a textfile via savevars (with the version + account)

MAINLY due to npc restart.. /savenpcs doesn't always work and people end up getting double-reset0rized =o

''this.trigger("update", "");''
I've heard that this actually saves the database. Well, that's what I saw in an Era Database NPC :p

ApothiX
09-26-2006, 05:34 PM
function onPlayerLogin(temp.plyr)
{
}


would work in any database npc.. and even in weapons/scripts. (clientsided aswell)
ex:


function onPlayerLogin(temp.plyr)
{
if (temp.plyr != NULL)
{
player.chat = format("%s has logged on!", temp.plyr); // I think?
}
}


function onPlayerLogin(pl) {
if(pl.account != NULL) {
player.chat = format("%s has logged on!", pl.account);
}
}
is the proper way to do it

KuJi
09-26-2006, 10:03 PM
function onPlayerLogin(pl) {
if(pl.account != NULL) {
player.chat = format("%s has logged on!", pl.account);
}
}
is the proper way to do it

o hmm..