ID:262275
 
Code:
obj
house_Door
icon = 'turfs.dmi'
icon_state = "door"
density = 1
layer = MOB_LAYER + 2
password
var/opened=0
bought = 0
verb
Buy()
set src in oview(1)
set category="Door"
if(src.bought == 0||src.bought == null)
switch(alert("Would you like to Purchase this house? it cost 30,000 zenni", "Purchase", "Yes","No"))
if("Yes")
if(usr.zenni < 30000)
usr<<"<b><font color = Lime>This costs 30,000 zenni!"
if(usr.zenni >= 30000)
usr.zenni -= 30000
usr<<"<b><font color = Silver>Okay! You may enter your House any time you want now!"
src.name = "[usr]'s House"
src.bought = 1
var/savefile/G = new("Houses.sav")
G["Houses"] << password
usr.client.SaveMob()
Open()
set src in oview(1)
set category="Door"
set name="Open"
if(src.password == null && src.bought == 1)
var/password1 = input("What do you wish to make the password? make it hard so no one can come in except you") as text
src.password = password1
else
if(src.opened == 0 && src.bought == 1||src.opened == null && src.bought == 1)
var/choice = input("What is the password?") as text
if(choice == src.password)
src.opened=1
flick("door5",src)
src.icon_state="door7"
density=0
sleep(30)
flick("door6",src)
src.icon_state="door"
src.opened=0
density=1
else
usr<<"<b><i><u><font color = Red>Incorrect Password!"
else
usr<<"<b>This Door isn't bought yet!"
Sell_House()
set src in oview(1)
set category="Door"
set name="Sell House"
if(src.opened == 0 && src.bought == 1||src.opened == null && src.bought == 0)
usr << "<b><font color = Silver>You sold your House back to the community and got 15,000 zenni back."
usr.zenni += 15000
src.bought = 0
src.verbs += /obj/house_Door/verb/Buy
else
usr << "You can't!"


Problem description:</bThe problem is when i buy the door and set a password. And i log out and go in again the i have to buy the door all over and make a new password again.
I want it so when you log out and go in back you have the same password
I don't exactly know if it will work, but you can try and add my object saver to your game, that may help. Another thing, you can have user set variables to distinguish if you own the house or not. Maybe add numbers to the doors to distigiush them from the others, as well as not having a player who only bought one house to own them all.
In response to CaptFalcon33035
OKK can you what to change in my coding.
Please.
In response to Sayian Hunter
Try this. I'm not sure if it works, I haven't tested it. I simply made a house saver for you.
obj/House
house_Door
icon = 'turfs.dmi'
icon_state = "door"
density = 1
layer = MOB_LAYER + 2
password
var/opened=0
bought = 0
verb
Buy()
set src in oview(1)
set category="Door"
if(src.bought == 0||src.bought == null)
switch(alert("Would you like to Purchase this house? it cost 30,000 zenni", "Purchase", "Yes","No"))
if("Yes")
if(usr.zenni < 30000)
usr<<"<b><font color = Lime>This costs 30,000 zenni!"
if(usr.zenni >= 30000)
usr.zenni -= 30000
usr<<"<b><font color = Silver>Okay! You may enter your House any time you want now!"
src.name = "[usr]'s House"
src.bought = 1
usr.client.SaveMob()
Open()
set src in oview(1)
set category="Door"
set name="Open"
if(src.password == null && src.bought == 1)
var/password1 = input("What do you wish to make the password? make it hard so no one can come in except you") as text
src.password = password1
else
if(src.opened == 0 && src.bought == 1||src.opened == null && src.bought == 1)
var/choice = input("What is the password?") as text
if(choice == src.password)
src.opened=1
flick("door5",src)
src.icon_state="door7"
density=0
sleep(30)
flick("door6",src)
src.icon_state="door"
src.opened=0
density=1
else
usr<<"<b><i><u><font color = Red>Incorrect Password!"
else
usr<<"<b>This Door isn't bought yet!"
Sell_House()
set src in oview(1)
set category="Door"
set name="Sell House"
if(src.opened == 0 && src.bought == 1||src.opened == null && src.bought == 0)
usr << "<b><font color = Silver>You sold your House back to the community and got 15,000 zenni back."
usr.zenni += 15000
src.bought = 0
src.verbs += /obj/house_Door/verb/Buy
else
usr << "You can't!"

world
New()
LoadHouse()
Del()
SaveHouse()

proc/SaveHouse()
var/savefile/F = new ("House.sav")
var/list/L = new
for(var/obj/House/B in world)
B.saved_x = B.x
B.saved_y = B.y
B.saved_z = B.z
L += B
F[""] << L

proc/LoadHouse()
var/savefile/F = new ("House.sav")
var/list/L = new
F[""] >> L
if(!L) return
for(var/obj/House/B in world) if(B.loc) del(B)
for(var/obj/House/B in L)
B.loc = locate(B.saved_x,B.saved_y,B.saved_z)


You may get alot of indetation errors. My dream maker doesn't exactly accept tabs pasted into it, but copies things right out of itself perfectly to paste elsewhere.
In response to CaptFalcon33035
O thanks no error but bad news it's still doesn't work and you see why ?
In response to Sayian Hunter
Err, don't use null || 0, use ![variable here] but just minus the brackets, it stands for the exact opposite, it includes null, 0, and "".

--Super Squirrel
((Pssssh, no one needs oxygen.))