ID:147974
 
//I want it so that when one walks into it will...
//if there is no owner: block and offer the house
//if the owner is some1 else: block and say the owners name
//if the person is the owner: welcome and allow pass
area/home1enter
var
mob
owner = null
Enter(mob/M)
if(src.owner == M)
return 1
return 0
if(src.owner == null)
M << "You buy the house!"
src.owner = M
return..()
else
M << "This home belongs to [src.owner]"
Xallius wrote:
//I want it so that when one walks into it will...
//if there is no owner: block and offer the house
//if the owner is some1 else: block and say the owners name
//if the person is the owner: welcome and allow pass
area/home1enter
var
mob
owner = null
Enter(mob/M)
if(src.owner == M)
return 1
return 0

Nothing will execute past the return 0 statement. This isn't too bad though since most of the code that comes next should really be handled in Entered().

The one thing this part is missing though is a check if src.owner is null. In that case it should also return 1, so use an || operator for this. Later on you might want to check if M has sufficient funds to buy the house, so you'll need something a little more complex then.
Enter(mob/M)
if(!src.owner || src.owner == M)
return 1
M << "This home belongs to [src.owner.name]"
return 0

Entered(mob/M)
if(src.owner == null)
M << "You buy the house!"
src.owner = M
else
M << "Welcome home, [M.name]!"

Lummox JR
In response to Lummox JR
//now i have this and i am getting some errors

turf/home
Enter(mob/M)
if(!src.owner || src.owner == M)
return 1
M << "This home belongs to [src.owner.name]"
return 0

Entered(mob/M)
if(src.owner == null)
M << "You buy the house!"
src.owner = M
else
M << "Welcome home, [M.name]!"
In response to Xallius
Xallius wrote:
//now i have this and i am getting some errors

turf/home
Enter(mob/M)
if(!src.owner || src.owner == M)
return 1
M << "This home belongs to [src.owner.name]"
return 0

Entered(mob/M)
if(src.owner == null)
M << "You buy the house!"
src.owner = M
else
M << "Welcome home, [M.name]!"

*cough* indentation errors, 100% sure remember, after the Entered(mob/M) always indent the next line.
turf/home   
Enter(mob/M)
if(!src.owner || src.owner == M)
return 1
M << "This home belongs to [src.owner.name]"
return 0

Entered(mob/M)
if(src.owner == null)
M << "You buy the house!"
src.owner = M
else
M << "Welcome home, [M.name]!"

In response to JackGuy
I retyped it and double checked it and now it works fine
but now after i purchase the house (become src.owner) it wont let me walk through it again, and i cant leave.

Thank you so much for your help ^_^!