Authentication (users).mac

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

LamahHerder
a hill giant
a hill giant
Posts: 299
Joined: Sat Jun 29, 2002 2:37 am

Authentication (users).mac

Post by LamahHerder » Mon Sep 22, 2003 12:23 pm

generic authentication code i use in some of my bot's
sure others could find use for it.

(users).mac

Code: Select all

|===========|
| 08/15/03a |
|___________|
|           |
|   Users   |
|  by m0nk  |
|___________|
|
| Usage:
| 1. Add "#include (users).mac" to any existing macro
| 2. Add this label at top of any sub event_ you want only certain ppl to use
|	:verify
|		/varset v1 "$arg(1,"$p0")"
|		/call Verify $v1
|		/if "$Verified"!="Yes" /return
|
| 3. Add your permanent users names (in lower case) in Sub AddAcceptableUsers
| 4. Edit a(1,0) with how many users you have (set empty users to NULL)

#define Verified "v0"			| Accepted User Yes/No (v1 also used)

Sub AddAcceptableUsers
	/echo Adding Acceptable Users
	/varset a(1,0) "1"		| Number of Perm Users
	/varset a(1,1) "playername"	| Perm user 1
	/varset a(1,2) "NULL"		| Perm User 2
	/varset a(1,3) "NULL"		| Perm User 3
	/varset a(1,4) "NULL"		| Perm User 4
	/varset a(1,5) "NULL"		| Perm User 5
	/varset a(1,6) "NULL"		| Perm User 6
	/varset a(1,7) "NULL"		| Perm User 7
	/varset a(1,8) "NULL"		| Perm User 8
	/varset a(1,9) "NULL"		| Perm User 9
/return

Sub Verify
	/echo Attempting to Auth $v1
	:doVerify
		/for l0	1 to $a(1,0)
		 /delay	1
		 /if "$lcase($v1)"!="$a(1,$l0)" /next l0
		 /if "$lcase($v1)"=="$a(1,$l0)" /goto :verify_yes
		/goto :verify_no

	:verify_no
		/varset	Verified "no"
		/return
	:verify_yes
		/varset	Verified "yes"
/return