iAxel Posted January 15, 2015 Posted January 15, 2015 In your code is a function of creating a backpack addEventHandler('onPlayerJoin', root, function () Backpack:create(source) end ) But do not have delete function backpack addEventHandler('onPlayerQuit', root, function () --Backpack Delete end ) Help with function delete backpack Example function BackPack:delete(player) Backpack.list[player] = nil setmetatable(self, self) return true end I did the right function?
iAxel Posted January 16, 2015 Posted January 16, 2015 Remove 4th line. So Much? function BackPack:delete(player) Backpack.list[player] = nil return true end
Et-win Posted January 16, 2015 Posted January 16, 2015 He said remove the 4th line. return true ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Cadu12 Posted January 16, 2015 Posted January 16, 2015 Yes, that's right, Monson. Ingame nick: Cadu12
iAxel Posted January 17, 2015 Posted January 17, 2015 Yes, that's right, Monson. See if the backpack is created so function Backpack:create(player, slots) if (Backpack.list[player]) then return Backpack.list[player] end local new = { items = {}, slots = slots or 100, owner = player } setmetatable(new, {__index = Backpack}) Backpack.list[player] = new return new end And thus is deleted function Backpack:delete(player) Backpack.list[player] = nil return true end Maybe I should null and self.items = nil self.slots = nil self.owner = nil --or destroyElement(self.items) destroyElement(self.slots) destroyElement(self.owner) --or destroyElement(self) And thus should delete the backpack? function Backpack:delete(player) self = nil --or destroyElement(self) Backpack.list[player] = nil return true end
MTA Team botder Posted January 17, 2015 MTA Team Posted January 17, 2015 The backpack is not an element, you can't use destroyElement on it. Anyway, that should be enough to delete the backpack: Backpack.list[player] = nil GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
iAxel Posted January 18, 2015 Posted January 18, 2015 The backpack is not an element, you can't use destroyElement on it.Anyway, that should be enough to delete the backpack: Backpack.list[player] = nil Okay, thank you very much
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now