02-18-2016, 06:01 PM
(This post was last modified: 02-20-2016, 07:40 AM by LogicParrot.)
(02-18-2016, 05:14 PM)Schwertspize Wrote: I would prefer writing a separate file for each player, but how to store any data just in memory? (and accessing it, with the corresponding cPlayer object)
-- Global storage table PlayerStorage = {} PlayerUUID = my_cPlayer_object:GetUUID() -- Create new player storage, if not created already if PlayerStorage[PlayerUUID] == nil then PlayerStorage[PlayerUUID] = {} end -- Save player data PlayerStorage[PlayerUUID].effect = "whatever"; PlayerStorage[PlayerUUID].etc = 42814 -- Check and read player data if PlayerStorage[PlayerUUID].effect ~= nil then -- Data exists else -- Data does not exist end -- Delete specific player data PlayerStorage[PlayerUUID].effect = nil -- Delete all player data PlayerStorage[PlayerUUID] = nil