ID:142670
 
Code:This is my save, load and login codes
mob
proc
SaveChar()
src.last_x=src.x
src.last_y=src.y
src.last_z=src.z
src.saveverbs=src.verbs
var/theFolder=uppertext(copytext(src.key,1,2))
var/savefile/s=new("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(src.name)]")
Write(s)
proc

count_chars()
var/totalSaves=0
var/theFolder=uppertext(copytext(src.key,1,2))
var/list/saveFiles=flist("savefiles/players/[theFolder]/[src.key]/")
for(var/v in saveFiles)
totalSaves++
return totalSaves

get_char_list()
var/theFolder=uppertext(copytext(src.key,1,2))
var/list/saveFiles=flist("savefiles/players/[theFolder]/[src.key]/")
var/list/save_display=list()
for(var/v in saveFiles)
save_display+=ascii_string2text("[v]")
return save_display
mob
proc
LoadChar()
var/theFolder=uppertext(copytext(src.key,1,2))
var/list/saveFiles=src.get_char_list()
var/theName=input("Which character do you wish to load?","Load")as null|anything in saveFiles
var/savefile/s=new("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(theName)]")
Read(s)
src.loggedIn=1
src.loc=locate(src.last_x,src.last_y,src.last_z)
for(var/stuff in src.V)
src.verbs += stuff
src.CheckBan()
src.CheckPermaBan()
world<<"<font size=1><font color=red><B>Naruto Lost Shinobi:<font color=white>[src]([src.key]) has logged in..."
verb
Save()
usr.SaveChar() // Make a call to the character's saving proc
usr << "Your character has been saved." // Inform the player that he's been saved.
mob
proc
DeleteCharacter() // The load character proc
var/theFolder=uppertext(copytext(src.key,1,2))
var/list/saveFiles=src.get_char_list()
var/theName=input("Are you sure you want to delete this character ?","Delete")as null|anything in saveFiles
var/confirmDelete=input("Are you sure you want to delete \'[theName]\'?","Delete [theName]")in list("Yes","No")
if(confirmDelete == "Yes")
fdel("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(theName)]")
alert("\'[theName]\' has been succesfully deleted.","Delete","Ok")
else
proc
text2ascii_string(string)
var/ascii_string
for(var/i=1,i <= length(string),i++)
ascii_string+=num2text(text2ascii(copytext(string,i,i+1)))+";"
return ascii_string

ascii_string2text(ascii_string)
var/string
var/ascii_list[0]
var/theMarker=findtext(ascii_string,";")
while(theMarker)
ascii_list+=copytext(ascii_string,1,theMarker)
if(findtext(ascii_string,";") && length(ascii_string) > 1)
ascii_string=copytext(ascii_string,theMarker+1)
theMarker=findtext(ascii_string,";")
for(var/v in ascii_list)
string+=ascii2text(text2num(v))
return string


world
New()
..()
WorldRepop()
Del()

world
name = "Naruto Lost Shinobi"
status = "<B><font size = -2><font color = red>Naruto Lost Shinobi 2!</font> <font color = green>{<font color=silver>Version:<font color = green> 8}<font color=green>Host:Orellow</font></font>"
hub = "Cybork.NarutoLS"
view=6
loop_checks=0


mob/Logout()
world << "<font color = red>Naruto Lost Shinobi:<font color = white>[src.name] ([src]) has left the server."
src.SaveChar()
sleep(2)
del(src)
mob/Login()
new/obj/hudMeters/health(src.client)
new/obj/hudMeters/chakra(src.client)
src.loc = locate(6,27,1)
src.updateHealth()
src.updateChakra()


Problem description:
1-You login, press Load... then you simply disconnect =S
2-You are playing, someone logs in and you go to the front screen.
3-My Autosave system isn't activated by time... it is activated by Log Out, so whenever you go to the login screen your game loads the last time you saved (before you go to the login screen)...

Naruto Lost Shinobi:Jivs (Jivs) has left the server.
Naruto Lost Shinobi:Uchiha Angelus (Uchiha Angelus) has left the server.
Naruto Lost Shinobi:Uchiha Angelus(Jivs) has logged in...


C'mon I really need some help here...
In response to Cybork
It might be useless but uhh.. did you check the savefiles folder?
In response to Cybork
Well you could always learn how to code yourself instead of ripping. That way, maybe people would help you if you had another problem.
Well care to show your
Checkban() and Checkpermaban() procs?
might be problem resides there,
same for your auto saving code.
i dont how you programmed ur autosave, so cant really comment on it
a tip if u didnt did it the same way
Make autosave a World proc.
also its really kind of poor programming that you have coded checkban procs on loading rather then make them check person on login.
mob
login()
if(src.client)
src.CheckBan()
else
return
In response to Hardik
Also silly to be handling player connections in Login() rather than client/New(), which is really the first proc called when a player connects.
In response to Garthor
Garthor wrote:
Also silly to be handling player connections in Login() rather than client/New(), which is really the first proc called when a player connects.

I use world/IsBanned(key, addr)
I figure, why not add my banning code check to the same time that byond checks for pagerbans. The result just seems to be a step further in that direction of getting them early.
In response to Garthor
Oh ok.
In response to Hardik
mob
proc
CheckBan()//checks to see if the new player is banned
var/savefile/F = new("bans.sav")
var/checking
F["[src.key]"] >> checking
if(src.key == checking)
src << "You have been banned!"
world<<"[src] tried to login"
del(src)
mob
proc
CheckPermaBan()//checks to see if the new player is banned
var/savefile/F = new("PermaBans.sav")
var/checking
F["[src.key]"] >> checking
if(src.key == checking)
src << "You have been banned!"
world<<"[src] tried to login"
del(src)

Those are the ban procs...
mob/Logout()
world << "<font color = red>Naruto Lost Shinobi:<font color = white>[src.name] ([src]) has left the server."
src.SaveChar()
sleep(2)
del(src)


This is the autosave
In response to Cybork
Tested.
Ban procs are working fine.
it means might be problem resides in some other part of your code(excluding this save system)
In response to Hardik
Save system is a demo from Deadron (?) I changed a few lines in it
In response to Garthor
Can you please tell me... Do I have to replace Login() with New() and Logout() with Del() ?...
I did that, and all npc's went to that location =S
In response to Cybork
No you didn't got what he meant >_>;
In response to Hardik
How do I fix the bug then ?
In response to Hardik
What did he meant then ?
In response to Cybork
i told u to check for banned players at login,
but garthor commented on my post that new() is the first proc for player connection.
In response to Hardik
already posted here my check ban proc... if i use new() at player connection, all the mobs (including npcs) will go to that location =S
In response to Cybork
Help please...
Cybork wrote:
Code:This is my save, load and login codes
> mob
> proc
> SaveChar()
> src.last_x=src.x
> src.last_y=src.y
> src.last_z=src.z
> src.saveverbs=src.verbs
> var/theFolder=uppertext(copytext(src.key,1,2))
> var/savefile/s=new("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(src.name)]")
> Write(s)
> proc
>
> count_chars()
> var/totalSaves=0
> var/theFolder=uppertext(copytext(src.key,1,2))
> var/list/saveFiles=flist("savefiles/players/[theFolder]/[src.key]/")
> for(var/v in saveFiles)
> totalSaves++
> return totalSaves
>
> get_char_list()
> var/theFolder=uppertext(copytext(src.key,1,2))
> var/list/saveFiles=flist("savefiles/players/[theFolder]/[src.key]/")
> var/list/save_display=list()
> for(var/v in saveFiles)
> save_display+=ascii_string2text("[v]")
> return save_display
> mob
> proc
> LoadChar()
> var/theFolder=uppertext(copytext(src.key,1,2))
> var/list/saveFiles=src.get_char_list()
> var/theName=input("Which character do you wish to load?","Load")as null|anything in saveFiles
> var/savefile/s=new("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(theName)]")
> Read(s)
> src.loggedIn=1
> src.loc=locate(src.last_x,src.last_y,src.last_z)
> for(var/stuff in src.V)
> src.verbs += stuff
> src.CheckBan()
> src.CheckPermaBan()
> world<<"<font size=1><font color=red><B>Naruto Lost Shinobi:<font color=white>[src]([src.key]) has logged in..."
> verb
> Save()
> usr.SaveChar() // Make a call to the character's saving proc
> usr << "Your character has been saved." // Inform the player that he's been saved.
> mob
> proc
> DeleteCharacter() // The load character proc
> var/theFolder=uppertext(copytext(src.key,1,2))
> var/list/saveFiles=src.get_char_list()
> var/theName=input("Are you sure you want to delete this character ?","Delete")as null|anything in saveFiles
> var/confirmDelete=input("Are you sure you want to delete \'[theName]\'?","Delete [theName]")in list("Yes","No")
> if(confirmDelete == "Yes")
> fdel("savefiles/players/[theFolder]/[src.key]/[text2ascii_string(theName)]")
> alert("\'[theName]\' has been succesfully deleted.","Delete","Ok")
> else
> proc
> text2ascii_string(string)
> var/ascii_string
> for(var/i=1,i <= length(string),i++)
> ascii_string+=num2text(text2ascii(copytext(string,i,i+1)))+";"
> return ascii_string
>
> ascii_string2text(ascii_string)
> var/string
> var/ascii_list[0]
> var/theMarker=findtext(ascii_string,";")
> while(theMarker)
> ascii_list+=copytext(ascii_string,1,theMarker)
> if(findtext(ascii_string,";") && length(ascii_string) > 1)
> ascii_string=copytext(ascii_string,theMarker+1)
> theMarker=findtext(ascii_string,";")
> for(var/v in ascii_list)
> string+=ascii2text(text2num(v))
> return string

world
> New()
> ..()
> WorldRepop()
> Del()
>
> world
> name = "Naruto Lost Shinobi"
> status = "<B><font size = -2><font color = red>Naruto Lost Shinobi 2!</font> <font color = green>{<font color=silver>Version:<font color = green> 8}<font color=green>Host:Orellow</font></font>"
> hub = "Cybork.NarutoLS"
> view=6
> loop_checks=0

mob/Logout()
> world << "<font color = red>Naruto Lost Shinobi:<font color = white>[src.name] ([src]) has left the server."
> src.SaveChar()
> sleep(2)
> del(src)
> mob/Login()
> new/obj/hudMeters/health(src.client)
> new/obj/hudMeters/chakra(src.client)
> src.loc = locate(6,27,1)
> src.updateHealth()
> src.updateChakra()

Problem description:
1-You login, press Load... then you simply disconnect =S
2-You are playing, someone logs in and you go to the front screen.
3-My Autosave system isn't activated by time... it is activated by Log Out, so whenever you go to the login screen your game loads the last time you saved (before you go to the login screen)...

Naruto Lost Shinobi:Jivs (Jivs) has left the server.
Naruto Lost Shinobi:Uchiha Angelus (Uchiha Angelus) has left the server.
Naruto Lost Shinobi:Uchiha Angelus(Jivs) has logged in...


Cmon dudes... I really need help on this one
Bump
Page: 1 2