if(fexists("player_saves/[ckey(lowertext(name))]"))
{
var/savefile/A=new("player_saves/[ckey(lowertext(name))]")
var/CorrPW
A["Password"]>>CorrPW
var/tmp/UP=input("Password: ") as password
var/tmp/Email=input("Email: ") as text
if(Review_Email(Email))
del(src)
if(UP==CorrPW)
var/tmp/mob/NewMob
var/tmp/MobPath = text2path("/mob/Player/[lowertext(A["Class"])]")
NewMob = new MobPath
NewMob.Read(A)
var/B = NewMob.Powerlevel.current
var/C = NewMob.Powerlevel.max
var/D = NewMob.Energy.current
var/E = NewMob.Energy.max
NewMob.CurrPowerlevel = B
NewMob.MaxPowerlevel = C
NewMob.CurrEnergy = D
NewMob.MaxEnergy = E
NewMob.loc=locate(50,50,1)
NewMob.cansave = 0
//NewMob.DRPEN = 0
//NewMob.DamageReduction = 0
for(var/obj/Equipment/I in NewMob.contents) { client.AddItem(I) }
for(var/obj/Equipment/P in NewMob.equipment) { client.AddEquipment(P.type, P.dSlot) }
Convert(NewMob, CorrPW, Email, B, C, D, E)
mb_msgout("{YCharacter conversion complete please relog!{x", NewMob)
fdel("player_saves/[ckey(lowertext(name))]")
del(NewMob)
del(src)
else
mb_msgout("{YWrong password.{x")
del(src)
}
mob
proc
Convert(mob/M, password, email, currpl, maxpl, currenergy, maxenergy)
var
DBI = "dbi:mysql:[sql_db]:[sql_ip]:[sql_port]"
DBConnection/my_connection = new()
connected = my_connection.Connect(DBI,sql_user,sql_pass)
if(!connected)
mb_msgout("Sorry, for some odd reason your character could not be created.", src)
return
Query(M.client.create_query(M))
Query("UPDATE `[sql_table]` SET x='[M.x]', y='[M.y]', z='[M.z]', password='[password]', email='[email]', CurrPowerlevel='[currpl]', MaxPowerlevel='[maxpl]', CurrEnergy='[currenergy]', MaxEnergy='[maxenergy]' WHERE name='[M.name]';")
client/proc
delete_query(mob/m)
var/QUERY = "DELETE FROM `Characters` WHERE `name`='[m.name]';"
return QUERY
create_query(mob/mob)
var/qr="INSERT INTO `[sql_table]` ("
for(var/x=1 to mob.vars.len)
if(isclient(mob.vars[mob.vars[x]]))continue
if(ignored_vars.Find(mob.vars[x]))continue
if(x==mob.vars.len)
qr += "`[mob.vars[x]]`"
else //making the initial part of the query
qr += "`[mob.vars[x]]`"
qr += ","
qr += ") VALUES ("
var/list/VARIABLES=mob.vars
//giant mess of stuff below
for(var/x=1 to VARIABLES.len)
//world.log << "[VARIABLES[x]] ([isnull(VARIABLES[VARIABLES[x]]) ? "null" : "[VARIABLES[VARIABLES[x]]]"]) = [x]/[VARIABLES.len]"
if(x==(VARIABLES.len))
if(isclient(VARIABLES[VARIABLES[x]]))continue
if(ignored_vars.Find(VARIABLES[x]))continue
if( islist(VARIABLES[VARIABLES[x]]))
qr += "'[implodetext(VARIABLES[VARIABLES[x]],"|")]'"
continue
if( istext(VARIABLES[VARIABLES[x]]) || isdatum(VARIABLES[VARIABLES[x]]) || ispath(VARIABLES[VARIABLES[x]]))
qr += "\"[VARIABLES[VARIABLES[x]]]\""
continue
if( isnum(VARIABLES[VARIABLES[x]]) )
qr += "[VARIABLES[VARIABLES[x]]]"
continue
if( isnull(VARIABLES[VARIABLES[x]]))
qr += "null"
continue
else qr += "'BROKEN'"
else
if(isclient(VARIABLES[VARIABLES[x]]))continue
if(ignored_vars.Find(VARIABLES[x]))continue
if( istext(VARIABLES[VARIABLES[x]]) || isdatum(VARIABLES[VARIABLES[x]]) || ispath(VARIABLES[VARIABLES[x]]))
qr += "'[VARIABLES[VARIABLES[x]]]',"
continue
if( isnum(VARIABLES[VARIABLES[x]]) )
qr += "[VARIABLES[VARIABLES[x]]],"
continue
if( islist(VARIABLES[VARIABLES[x]]))
qr += "'[implodetext(VARIABLES[VARIABLES[x]],"|")]',"
continue
if( isnull(VARIABLES[VARIABLES[x]]))
qr += "null"
qr += ","
continue
else
qr += "'BROKEN',"
qr += ");"
world.log << qr
return qr
Problem description:
above are the 3 procs involved..for some reason my convert code to mysql was working now its not..randomly it was literally working then just stopped no code changes at all.. anyways can anyone inform me why this is the error it produces.
runtime error: Cannot execute null.create query().
proc name: Convert (/mob/proc/Convert)
source file: ZClient.dm,29
usr: the wilson (/mob/new_player)
src: the wilson (/mob/new_player)
call stack:
the wilson (/mob/new_player): Convert(Wilson (/mob/Player/namekian), "putange", "test@test.com", 2.43729e+06, 2.43729e+06, 100, 100)
the wilson (/mob/new_player): UserLogin()
the wilson (/mob/new_player): Login()
Basically what the error says. M.client is null.