All pastes #382876 Raw Edit

Untitled

public lua v1 · immutable
·published 2007-03-05 23:36 UTC
rendered paste body
function SaveProfile( ply, tablename, directory )if (SERVER) then local plyid = ply:UniqueID()	if directory == nil then 	ply:PrintMessage(HUD_PRINTTALK,"ERROR: Profiles database missing/undetermined.")		return end	if directory ~= nil then 	local stringtb = Util.TableToKeyValues(tablename) -- obsolete	//local concat = table.concat(tablename, ":")		local plyid1 = ply:UniqueID()	//local plyid2 = string.sub(plyid1,11)	local gamedirec = directory.."/"..plyid1..".txt"		Msg("game directory (writing to): " ..gamedirec.."\n")	file.Write(gamedirec,stringtb)		endendendfunction LoadProfile( ply, directory )if (SERVER) then	if directory == nil then 	ply:PrintMessage(HUD_PRINTTALK,"ERROR: Game profile database missing/corrupt.")		return end          -- NO SPECIFIED FOLDER?!	if directory ~= nil then 		local plyid1 = ply:UniqueID()	//local plyid2 = string.sub(plyid1,11)	local gamedirec = ""..directory.."/"..plyid1..".txt"	Msg(gamedirec.." is the profile directory!!!!\n")		//local stringtb2 = string.Explode(":", file.Read(gamedirec) or {})		local stringtb = util.KeyValuesToTable(file.Read(gamedirec))		Msg("game directory (reading from): " ..gamedirec.."\n")	endendreturn stringtb end