daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function my_load(name)
  2.     if not alife_storage_manager.get_state()['my_data'] then
  3.         return
  4.     end
  5.     return alife_storage_manager.get_state()['my_data'][name]
  6. end
  7.  
  8. local function my_save(name, value)
  9.     if not alife_storage_manager.get_state()['my_data'] then
  10.         alife_storage_manager.get_state()['my_data'] = {}
  11.     end
  12.     alife_storage_manager.get_state()['my_data'][name] = value
  13. end
  14.  
  15. local tmr = 0
  16. local function my_timer()
  17.     local tg = time_global()
  18.     if (tg >= tmr) then
  19.         tmr = tg + 2000
  20.         printf("my_timer: %s", tmr)
  21.     end
  22. end
  23.  
  24. axr_keybind.bind("DIK_NUMPAD1",function(p)
  25.     if p == 1 then
  26.         if ((my_load("state") or 0) == 0) then
  27.             my_save("state", 1)
  28.             AddUniqueCall(my_timer)
  29.         else
  30.             my_save("state", 0)
  31.             RemoveUniqueCall(my_timer)
  32.         end
  33.     end
  34. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top