ID:145065
 
Code:


#if !defined(SUPER_NEW)
#define SUPER_NEW "New Character"
#endif
#if !defined(SUPER_)
#define SUPER_LOAD "Load Character"
#endif
#if !defined(SUPER_QUIT)
#define SUPER_QUIT "Quit"
#endif

//proc
client
proc
Load()
if(src.mob.save_file_1)
var/savefile/load
load = new ("Player Saves/[mob.ckey]/Save File 1.sav")
load["mob"] >> src.mob
load["x"] >> src.mob.x
load["y"] >> src.mob.y
load["z"] >> src.mob.z
if(src.mob.save_file_2)
var/savefile/load
load = new ("Player Saves/[mob.ckey]/Save File 2.sav")
load["mob"] >> src.mob
load["x"] >> src.mob.x
load["y"] >> src.mob.y
load["z"] >> src.mob.z
if(src.mob.save_file_3)
var/savefile/load
load = new ("Player Saves/[mob.ckey]/Save File 3.sav")
load["mob"] >> src.mob
load["x"] >> src.mob.x
load["y"] >> src.mob.y
load["z"] >> src.mob.z
//end
mob/var/save_file_1 = 0
mob/var/save_file_2 = 0
mob/var/save_file_3 = 0
var/list/Name = list()

var/list/HTML_TAGS = list ("<",">")
mob/proc/Check_For_Tagilitys(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE

var/list/NUM_TAGS = list ("1","2","3","4","5","6","7","8","9","0")
mob/proc/Check_For_Nums(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE

var/list/SYM_TAGS = list ("!","@","#","$","%","^","&","*","(",")","-","_","+","=","(",")","{","}",";",":","'","<",">",",",".","?","/","[","]")
mob/proc/Check_For_Syms(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE

mob/Guest
Login()
src.verbs -= new/mob/verb/OOC
src.verbs -= new/mob/verb/Say

if(src.client.key == "Guest") //Here's the line's to stop the Runtime Error - Fixed by Hant Teath
del(src.client)

// if(src.client.byond_version < 349)
// src << "\red You BYOND Version: [src.client.byond_version] is out of Date! Please upgrade to the latest Version: 348!"
// del(src.client)

src.loc = locate(87,6,3)

Start

switch(alert("Welcome to Dragonball","New Character","Load Character","Delete Character"))

if("New Character")
switch(alert("Which Slot do you wish to Select?","","Slot 1","Slot 2","Slot 3"))

if("Slot 1")
if(fexists("Player Saves/[src.client.ckey]/Save File 1.sav"))
switch(alert("You already have a Character on Slot 1. Overwrite it?","","Yes","No"))
if("Yes")
fdel("Player Saves/[src.client.ckey]/Save File 1.sav")
src.save_file_1 = 1
Create()
else
goto Start
return
else
src.save_file_1 = 1
Create()
if("Slot 2")
if(fexists("Player Saves/[src.client.ckey]/Save File 2.sav"))
switch(alert("You already have a Character on Slot 2. Overwrite it?","","Yes","No"))
if("Yes")
fdel("Player Saves/[src.client.ckey]/Save File 2.sav")
src.save_file_2 = 1
Create()
else
goto Start
return
else
src.save_file_2 = 1
Create()
if("Slot 3")
if(fexists("Player Saves/[src.client.ckey]/Save File 3.sav"))
switch(alert("You already have a Character on Slot 3. Overwrite it?","","Yes","No"))
if("Yes")
fdel("Player Saves/[src.client.ckey]/Save File 3.sav")
src.save_file_3 = 1
Create()
else
goto Start
return
else
src.save_file_3 = 1
Create()

if("Load Character")
switch(alert("Which Character Slot do you wish to Select?","","Slot 1","Slot 2","Slot 3"))

if("Slot 1")
if(fexists("Player Saves/[src.client.ckey]/Save File 1.sav"))
usr.save_file_1 = 1
usr.client.Load()
else
alert("No Saved File Found!")
sleep(5)
goto Start
return
if("Slot 2")
if(fexists("Player Saves/[src.client.ckey]/Save File 2.sav"))
usr.save_file_2 = 1
usr.client.Load()
else
alert("No Saved File Found!")
sleep(5)
goto Start
return
if("Slot 3")
if(fexists("Player Saves/[src.client.ckey]/Save File 3.sav"))
usr.save_file_3 = 1
usr.client.Load()
else
alert("No Saved File Found!")
sleep(5)
goto Start
return

if("Delete Character")
var/del_name = ""
switch(alert("Which Slot do you wish to Delete?","","Slot 1","Slot 2","Slot 3"))

if("Slot 1")
switch(alert("Are you Sure?","","Yes","No"))
if("Yes")
if(fexists("Player Saves/[src.client.ckey]/Save File 1.sav"))
var/savefile/Load = new("Player Saves/[src.client.ckey]/Save File 1.sav")
Load["name"] >> del_name
var/savefile/N = new("World Save Files/Player Names.sav")
Name.Remove(ckey(del_name))
N["Name"] << Name
fdel("Player Saves/[src.client.ckey]/Save File 1.sav")
goto Start
else
alert("No Saved File Found!")
sleep(5)
goto Start
else
goto Start
return
if("Slot 2")
switch(alert("Are you Sure?","","Yes","No"))
if("Yes")
if(fexists("Player Saves/[src.client.ckey]/Save File 2.sav"))
var/savefile/Load = new("Player Saves/[src.client.ckey]/Save File 2.sav")
Load["name"] >> del_name
var/savefile/N = new("World Save Files/Player Names.sav")
Name.Remove(ckey(del_name))
N["Name"] << Name
fdel("Player Saves/[src.client.ckey]/Save File 2.sav")
else
alert("No Saved File Found!")
sleep(5)
goto Start
else
goto Start
return
if("Slot 3")
switch(alert("Are you Sure?","","Yes","No"))
if("Yes")
if(fexists("Player Saves/[src.client.ckey]/Save File 3.sav"))
var/savefile/Load = new("Player Saves/[src.client.ckey]/Save File 3.sav")
Load["name"] >> del_name
var/savefile/N = new("World Save Files/Player Names.sav")
Name.Remove(ckey(del_name))
N["Name"] << Name
fdel("Player Saves/[src.client.ckey]/Save File 3.sav")
else
alert("No Saved File Found!")
sleep(10)
goto Start
else
goto Start
return
..()

proc
Create()
var/mob/mobcreation
var/newname = null
//var/config = "065-090&097-122&095&032"

while(newname == null)newname = input("Pick Character Name","Name",src.key) as text //(newname,config)|| removed

if(ckey(newname) in Name)
alert("This name is already in use. Try again please,")
Create()

if(lentext(newname) > 25)
alert("Your name can not exceed 25 characters.")
Create()

if(isnull(newname) | newname == "" | !newname)
alert("Your name may not be blank.")
Create()

if(Check_For_Tagilitys(newname,HTML_TAGS) == TRUE)
alert("Your name may not have tagilitys of html in it.")
Create()

if(Check_For_Nums(newname,NUM_TAGS) == TRUE)
alert("Your name may not have numbers in it.")
Create()

if(Check_For_Syms(newname,SYM_TAGS) == TRUE)
alert("Your name may not have symbols in it.")
Create()

else

newname = html_encode(newname)
var/race = input("What were you born as?","Choose a Birth Race") in list ("Uchiha","Kaguya","Hyuuga","Lee","Akimichi","Aburame","Inuzuka","Nara","Haku")
switch(race)

if("Uchiha")
usr.Uchiha=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Uchiha"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Aburame=0
usr.Akimichi = 0

if("Kaguya")
usr.Kaguya=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Kaguya"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Hyuuga")
usr.Hyuuga=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Hyuuga"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Lee")
usr.NonClan=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Non-Clan"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Akimichi")
usr.Akimichi=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Akimichi"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0

if("Aburame")
usr.Aburame=1
usr.Realplayer = 1
usr.Konchuu = 10
usr.human = 1
usr.Clan = "Aburame"
usr.Haku = 0
usr.Akimichi=0
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0

if("Inuzuka")
usr.Inuzuka=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Inuzuka"
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Nara")
usr.Nara=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Nara"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Haku")
usr.Haku=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Haku"
usr.Akimichi=0
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0

if(src.save_file_1)
mobcreation.save_file_1 = 1
if(src.save_file_2)
mobcreation.save_file_2 = 1
if(src.save_file_3)
mobcreation.save_file_3 = 1

var/savefile/N = new("World Save Files/Player Names.sav")
Name.Add(ckey(mobcreation.name))
N["Name"] << Name

world << "<font color = #F9DB13>Client Information: <font color = white>Everyone welcome our newest Player: [mobcreation.name]"

src.client.mob = mobcreation
del(src)


Problem description: Well basicly it a login for my friend i made some of it and it dosn't seem to working anymore , i know it pretty big so if you have time plz help me :)

Ugh. The goto abuse in that code has to go. There's really no way to address your code without getting rid of that problem first.

As far as loading, you also need to load your x,y,z values to local vars, not to the mob directly. If you set mob.x and the mob is already located nowhere, it's not going to change. Load those values into vars first, and then set the mob's loc using locate().

Lummox JR
I noticed something that interested me in this piece of coding. It doesn't seem to be original, because you have a little conflict of animes.
This was in your code

"switch(alert("Welcome to Dragonball""

and I believe that Haku and Uchiha are Naruto characters, could this be faulty editing? perhaps you forgot to change one part of the coding to say "Naruto". I have a hunch but Im not sure about it. Im aware that the Dragonball Rebirth coding was released a little bit ago, they used a similar login system to this almost identical, I havent looked at the Rebirth coding though so I couldnt tell you for sure, but I think this is edited Dragonball Rebirth Login.

If I'm wrong I apologize, it could just be a typo.
In response to Anthony7
i used a dragon ball game login , b/c i wanted like pop-up in the login so it has someof it

but my game is on naruto stuff
In response to Domedaydevice141
Domedaydevice141 wrote:
i used a dragon ball game login , b/c i wanted like pop-up in the login so it has someof it

but my game is on naruto stuff

Well, this is a good lesson in why you should never rip code: because ripped code always sucks, and you're just building new bugs on top of someone else's crappy code. Time to start that sucker over from scratch.

Lummox JR
In response to Lummox JR
Like he says, you need to start from scratch. I'm going to give you a quick code to show you how its done... well.

But it isn't a title screen. Its a autologin. Change what you want. If you wreck it, repair costs £9000.

mob
Login()
if(fexists("players/[src.ckey].sav"))//Savefile check.
var/savefile/F = new("players/[src.ckey].sav")//Load your file.
usr << "<FONT COLOR=red><b><i>You appear to have a Savefile. Loading..."
F["HP"] >> hp //The first part "F["Blah"]" is what the var is named as in the file
F["Strength"] >> strength //Remember you can change and add anything that is a var...
F["CurLocation"] >> loc //WARNING - I just made THAT from scratch. Read the "CurLocation" below...
//And you can add more here... but remember to make sure it saves what you load (Below)
usr << "<FONT COLOR=red>Welcome back [usr]."
else
var/savefile/F = new("players/[src.ckey].sav")//Creates a savefile.
usr << "<FONT COLOR=red><b><i>You appear to be new to the game. Creating a savefile..."
F["HP"] << hp //Whatever you save you can save by using "<<" insted of ">>"
F["Strength"] << strength //Remember you can change and add anything that is a var...
F["CurLocation"] << loc //WARNING - You might need seperate ones for X,Y,Z insted
//Save your custom functions by doing the same as above but with "<<"
usr << "<FONT COLOR=red>Welcome [usr]!" //Nice first-time welcome.
..() // I reckon its best to have it after the save...
Logout()
var/savefile/F = new("players/[src.ckey].sav")//Creates a savefile.
F["HP"] << hp //Whatever you save you can save by using "<<" insted of ">>"
F["Strength"] << strength //Remember you can change and add anything that is a var...
F["CurLocation"] << loc //WARNING - You might need seperate ones for X,Y,Z insted
//Save your custom functions by doing the same as above but with "<<" Again
..() //And now the file is saved, we can properly logout.



If someone wants to comment on that, go ahead. I might turn it into a personal first library as it has a lot of detail on what to do.
In response to RedlineM203
Your comment method is annoying: it makes the code unreadable. Well, not specifically "unreadable"- but annoying to read. Try putting space between the code and comments.

O-matic
In response to RedlineM203
Frelling gads, you can't save or load loc directly! If loc is a turf, it's going to save everything on that turf including other mobs, should they be stacked together for any reason. If a copy of your mob is saved, when the player who saved it loads up again it will roll back your character. If your mob is already located there and someone else loads with the same saved location, your mob will end up in null space.

usr is not especially safe in Login(); slightly, but not a lot and pretty much not at all when saved characters are involved. Also, always close your HTML tags.

And what O-matic said goes triple from me: ALWAYS put a tab between your code and the comment, so it's readable.

Lummox JR
In response to RedlineM203
lol ty

i used db one b/c i had no idea how to make the pop-up one

thax again
In response to Lummox JR
well based on the old one , i made a new somone what from scratch , if you see goto , i used it b/c i am new and i don't know how to replace it.


src/va
align
Create2
//defining variable
var/list/Name = list()
var/list/HTML_TAGS = list ("<",">")
mob/proc/Check_For_Tagilitys(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE

var/list/NUM_TAGS = list ("1","2","3","4","5","6","7","8","9","0")
mob/proc/Check_For_Nums(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE

var/list/SYM_TAGS = list ("!","@","#","$","%","^","&","*","(",")","-","_","+","=","(",")","{","}",";",":","'","<",">",",",".","?","/","[","]")
mob/proc/Check_For_Syms(T as text,var/list/L)
for(var/V in L)
if(findtext(T,V))
return TRUE
//defining variable ends
mob
Login()
var/N

N=input("Welcome to the Ninja Academy, what would yo like to do?", "Login")in list("New Character","Load Character", "Delete Character") //to ask what will happen as a switch form

if(N=="New Character")
Create2()

if(N=="Load Character") // load
var/list{players=src.PlayerList();listing=new()}
listing+=players
var/selection=input("which character do you wish to load?", "Load Character") in listing
src.LoadPlayer(selection)
sleep(10)
src.Frozen = 0
src.Move_Delay = Speed1
src.testing = 0
src.Moveing = 0
if(N=="Delete Character")// deleting character
there
var/savefile/F=new("players/[src.ckey]/mobs.sav")
F.cd="/[ckey]";var/list{Players=F.dir;listing=new()}
var/Cancel="Cancel";listing+=Players;listing+=Cancel
var/selection=input("Which character would you like to delete?","Deleteing Character") in listing
if(selection){F.cd="/[ckey]";F.dir.Remove(selection)};if(selection==Cancel)usr<<"Alright."
else goto there

proc
Create2()
var/newname = null

while(newname == null)newname = input("Pick Character Name","Name",src.key) as text //(newname,config)|| removed

if(ckey(newname) in Name)
alert("This name is already in use. Try again please,")
Create2()

if(lentext(newname) > 25)
alert("Your name can not exceed 25 characters.")
Create2()

if(isnull(newname) | newname == "" | !newname)
alert("Your name may not be blank.")
Create2()

if(Check_For_Tagilitys(newname,HTML_TAGS) == TRUE)
alert("Your name may not have tagilitys of html in it.")
Create2()

if(Check_For_Nums(newname,NUM_TAGS) == TRUE)
alert("Your name may not have numbers in it.")
Create2()

if(Check_For_Syms(newname,SYM_TAGS) == TRUE)
alert("Your name may not have symbols in it.")
Create2()

else

newname = html_encode(newname)
var/race = input("What were you born as?","Choose a Birth Race") in list ("Uchiha","Kaguya","Hyuuga","Lee","Akimichi","Aburame","Inuzuka","Nara","Haku")
switch(race)

if("Uchiha")
usr.Uchiha=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Uchiha"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Aburame=0
usr.Akimichi = 0

if("Kaguya")
usr.Kaguya=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Kaguya"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Hyuuga")
usr.Hyuuga=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Hyuuga"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Lee")
usr.NonClan=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Non-Clan"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Akimichi")
usr.Akimichi=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Akimichi"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0

if("Aburame")
usr.Aburame=1
usr.Realplayer = 1
usr.Konchuu = 10
usr.human = 1
usr.Clan = "Aburame"
usr.Haku = 0
usr.Akimichi=0
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0

if("Inuzuka")
usr.Inuzuka=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Inuzuka"
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Nara")
usr.Nara=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Nara"
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
usr.Akimichi = 0

if("Haku")
usr.Haku=1
usr.Realplayer = 1
usr.human = 1
usr.Clan = "Haku"
usr.Akimichi=0
usr.Inuzuka=0
usr.Gaaraclan=0
usr.Kaguya=0
usr.Hyuuga=0
usr.Nara=0
usr.NonClan=0
usr.Uchiha=0
usr.Aburame=0
client
Del()
SavePlayer5()
del(mob)
return ..()



well now the problem is that the pop-up dosn't comon i know i made mistake b/c i made it , plz help if you can