Skip to content

Manual:DIL Manual set password()

iamnove edited this page Jan 18, 2023 · 51 revisions


Function:  set_password( u : unitptr, s : string ) ;
  u
         the unit that you want to set the password of
  s
         the password you are using to set
This function sets a unit password it only works on Players characters of corse.
Example:

---~---~---~---~---~---~---~---~---
dilbegin aware do_password (arg:string);
var
        prmt:string;
 firstpwd:string;
 i:integer;
 tlist:stringlist;
code
{
if(self.type != UNIT_ST_PC) quit;
arg:="";
prmt:=self.prompt;
self.prompt:="Enter new password:  ";
wait (SFB_CMD,self==activator);
block;
tlist:=getwords (excmdstr);
if (length(tlist)>1){
sendtext ("Password must be only one word.  Try again.&n",self);
self.prompt:=prmt;
quit;
}
if (length(excmdstr)<5){
        sendtext ("Password to short. Password must be 5 characters or longer.\
		Try again.&n",self);
        self.prompt:=prmt;
        quit;
        }
if (length(excmdstr)>16){
        sendtext ("Password to long. Try again.&n",self);
        self.prompt:=prmt;
        quit;
        }
        firstpwd:=excmdstr;
        self.prompt:="Enter password again:  ";
wait (SFB_CMD,self==activator);
block;
if (excmdstr!=firstpwd){
sendtext ("Passwords do not match try again.&n",self);
self.prompt:=prmt;
quit;
}
set_password(self,excmdstr);
sendtext("Changed your Password to '"+excmdstr+"' Please write it down!&n",self);
self.prompt:=prmt;
quit;
}
dilend



---~---~---~---~---~---~---~---~---

Clone this wiki locally