ID:145414
 
Code:
client
New()
..()
world << "[src.mob] has entered."
Del()
world << "[src.mob] has left."
src.mob.client.Save_Char()
del(src.mob)


Problem description:

how do i make this so if the usr key is mxjerrett it says something different that if anyone else enters i had 1 before but it wont work with my new saving system
Src.mob is the player key I think.


You might be looking for src.

Just src.
In response to RedlineM203
well i cant figure out how to make it so it displays different things
In response to Mxjerrett
Try using the mob/Login() and mob/Logout() procedures.
In response to King Gunnerblast
can u tell me what is wrong with this

client
proc
Load_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z




client
New()
if(src.mob=="Mxjerrett")
world <<"[src.mob], our god, has entered."
else
world <<"[src.mob] has entered."
Del()
world << "[src.mob] has left us."
src.mob.client.Save_Char()
del(src.mob)



mob/Choosechar
Login()
spawn()
src.Choose_Char()
proc//we start with the procs
Choose_Char()
var/list/char_menu = newlist()
var/Create = "Create New Character"
var/Load = "Load Character"
var/Quit = "Exit"
if(fexists("Player/[src.client.ckey]"))
char_menu.Add(Create,Load,Quit)
var/choice = input("What do you want to do?","Welcome back to [world.name]") in char_menu

if(choice == Create)
switch(alert("Creating a New Character will delete your existing character. Continue?","Warning","Yes","No"))
if("Yes")
Create_Char()
if("No")
Choose_Char()
return
if(choice == Load)
src.client.Load_Char()
if(choice == Quit)
del(src)
else
char_menu.Add(Create,Quit)
var/choice = input("What do you want to do?","Welcome to [world.name]!") in char_menu

if(choice == Create)
Create_Char()
if(choice == Load)
del(src)

..()


Create_Char()
var/mob/mob_created
var/world_name = "[world.name]"
var/value = key
var/text = "What would you like your name to be?"
var/name = input(src, text, world_name, value)as text
if(!name)
src.Create_Char()
return

var/choose_char = input("What would you like to be?")in list("Human","Monster")
switch(choose_char)
if("Human")
mob_created = new/mob/man()
mob_created <<"You are a human."
if("Monster")
mob_created = new/mob/mob()
mob_created <<"You are a monster."

mob_created.loc = locate(1,1,1)
mob_created.name = name
src.client.mob = mob_created


world
mob = /mob/Choosechar


mob
verb
Save()
src.client.Save_Char()
src << "\blue You have been saved."

mob
man
icon = 'man.dmi'
mob
icon = 'mob.dmi'






i get this error when i run the game

runtime error: Cannot read null.client
proc name: Del (/client/Del)
usr: null
src: Mxjerrett (/client)
call stack:
Mxjerrett (/client): Del()
In response to Mxjerrett
This may or may not be the problem, but it's really getting on my nerves. This:

src.mob.client.Save_Char()


Is the same as:

Save_Char()


Thinking about it, that probably is the problem. at that point, the mob is gone, IIRC.
In response to Audeuro
i know wut the problem is but i dont know how to fix it it is this part


client
New()
if(key=="Mxjerrett")
world <<"[src.mob], our god, has entered."
else
world <<"[src.mob] has entered."
Del()
world << "[src.mob] has left us."
Save_Char()
del(src)
In response to Mxjerrett
You need to call ..() in client/New(), otherwise the player will get booted.

~~> Unknown Perosn
In response to Unknown Person
oh lol how did i miss that
In response to Mxjerrett
kk using a code simular to the 1 above how would make it so u could save multiple characters
In response to Mxjerrett
You make a var called chosenslot.. And save a savefile like... var/savefile/F=new("Saves/[src.ckey][src.chosenslot].sav"). And you load in the same way, tadaaa..