#include <lib.h> #include <objects.h> #include <commands.h> #include "users.h" inherit LIB_DAEMON; //inherit OB_PLAYER; void create() { daemon::create(); //user::create(); } void change_password(string who, string passwd) { if(!((int)master()->valid_apply( ({ "law" }) ))) return; if(!stringp(who) || !stringp(passwd)) return; if(member_group(who, "assist") || member_group(who, "superuser")) return; if(!user_exists(who)) return; if(find_player(who)) return; unguarded((: restore_object, DIR_PLAYERS+"/"+who[0..0]+"/"+who :)); this_object()->SetPassword(crypt(passwd, 0)); unguarded((: save_object, DIR_PLAYERS+"/"+who[0..0]+"/"+who :)); } void xmote(string who, string pos, int lev) { if(!((int)master()->valid_apply( ({ "assist" }) ))) return; if(!stringp(who) || !user_exists(who)) return; if(member_group(who, "superuser")) return; if(find_player(who)) return; unguarded((: restore_object, DIR_PLAYERS+"/"+who[0..0]+"/"+who :)); if(pos) this_object()->SetPosition(pos); if(lev) this_object()->set_level(lev); unguarded((: save_object, DIR_PLAYERS+"/"+who[0..0]+"/"+who :)); } void suicide(string who) { if(!((int)master()->valid_apply(({ who })))) return; if(!((int)master()->valid_apply(({ (string)this_player(1)->GetKeyName()})))) return; if(archp(this_player())) return; this_player()->eventDestruct(); log_file("suicide", who+" at "+ctime(time())+"\n"); delete_user(who); } static private void delete_user(string who) { string tmp; rename(sprintf("%s/%s/%s%s", DIR_PLAYERS, who[0..0], who, __SAVE_EXTENSION__), sprintf("%s/rid/%s%s", DIR_PLAYERS, who, __SAVE_EXTENSION__)); if(unguarded((: file_exists, tmp = DIR_ACCOUNTS+"/"+who+__SAVE_EXTENSION__ :))) unguarded((: rm, tmp :)); } void setup() { } int eventDestruct() { return daemon::eventDestruct(); }