ID:264929
 
I'm try to make doors that see if you are a subscriber or a byond member & if not do not allow you to enter,
Code:
/*01*/turf/Doors
/*02*/ BMDoor
/*03*/ icon_state = "Door"
/*04*/ Enter()
/*05*/ if(usr.y==src.y-1)
/*06*/ if(IsByondMember(usr))
/*07*/ return 1
/*08*/ else
/*09*/ return 0
/*10*/ else return 1
/*11*/ SubDoor
/*12*/ icon_state = "Door"
/*13*/ Enter()
/*14*/ if(usr.y==src.y-1)
/*15*/ if(CheckPassport("Pass"))
/*16*/ return 1
/*17*/ else
/*18*/ return 0
/*19*/ else return 1
/*20*/ BMSDoor
/*21*/ icon_state = "Door"
/*22*/ Enter()
/*23*/ if(usr.y==src.y-1)
/*24*/ if(client.IsByondMember())
/*25*/ return 1
/*26*/ if(client.CheckPassport("0123456789abcdef"))
/*27*/ return 1
/*28*/ else
/*29*/ return 0
/*30*/ else return 1
/*31*/ Door
/*32*/ icon_state = "Door"


Problem description:
Doors.dm:6:error: IsByondMember: undefined proc
Doors.dm:15:error: CheckPassport: undefined proc
Doors.dm:24:error: client.IsByondMember: undefined var
Doors.dm:26:error: client.CheckPassport: undefined var
The first two are because it's trying to call the procs as though they are either global, or defined no the /turf, neither of which are the case.

The second two are because "client" as a variable doesn't exist there, so anything using "client" makes no sense.

What you want to do, in all cases there, is grab usr, and confirm it has a client, then check that.

proc/isMember(var/mob/M)
return M.client != null && M.client.IsByondMember()

proc/isSubscribed(var/mob/M, var/subid as text)
return M.client != null && M.client.CheckPassport(subid)


Those procs should probably live under /turf/Doors, and be called like ...

/*22*/        Enter()
/*23*/ if(usr.y==src.y-1)
/*24*/ return isMember(usr) || isSubscribed(usr, "0123456789abcdef")


If it's a common pattern for you, knock the two procs into one:

proc/isMemberOrSubscribed(var/mob/M, var/subid as text)
return M.client != null && (M.client.isMember() || M.client.CheckPassport(subid))
In response to Stephen001 (#1)
Thank you Stephen001
It is now working

You did mean:
turf/proc/isMember(var/mob/M)

right?
In response to Prf X (#2)
It would be <pre>/turf/Door/proc/isMember(var/mob/M)</pre>, as presumably only Doors need to check this.