~dcplusplus-team/adchpp/trunk

« back to all changes in this revision

Viewing changes to plugins/Script/examples/access.lua

  • Committer: poy
  • Date: 2014-04-13 15:01:43 UTC
  • Revision ID: poy@123gen.com-20140413150143-qxvcksfn4xoe31fo
Fix crashes after calling +reload

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
local pm = adchpp.getPM()
105
105
local sm = adchpp.getSM()
106
106
 
 
107
local levelHandle = pm:registerPluginData()
107
108
local saltsHandle = pm:registerPluginData()
108
 
local levelHandle = pm:registerPluginData()
109
109
 
110
110
-- forward declarations.
111
111
local cut_str,
1782
1782
autil.on_unloading(_NAME, save_users_timer)
1783
1783
 
1784
1784
autil.on_unloading(_NAME, maybe_save_users)
 
1785
 
 
1786
-- Clear plugin data registered by this script when it goes off.
 
1787
autil.on_unloading(_NAME, function()
 
1788
        local entities = cm:getEntities()
 
1789
        local size = entities:size()
 
1790
        if size > 0 then
 
1791
                for i = 0, size - 1 do
 
1792
                        entities[i]:clearPluginData(levelHandle)
 
1793
                        entities[i]:clearPluginData(saltsHandle)
 
1794
                end
 
1795
        end
 
1796
end)