deadx2

Untitled

Aug 28th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.20 KB | None | 0 0
  1. quest tombola_start begin
  2.     state start begin
  3.         when login begin
  4.             chat("tombola1")
  5.             local number_list = number(1,TOMBOLA_QUANTITY_LIST)
  6.             local item_reward_list = string.format(TOMBOLA_REWARD_LIST[number_list][1][1]).."|".. string.format(TOMBOLA_REWARD_LIST[number_list][1][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][2])
  7.             cmdchat("tombola_start "..q.getcurrentquestindex()) --- this command send quest index to client, you'll see now why is important  
  8.             --chat("tombola_prepare "..item_reward_list)
  9.             cmdchat("tombola_prepare "..item_reward_list)
  10.         end
  11.        
  12.         when button or info begin
  13.             chat("tombola2")
  14.             if pc.getqf("start_game") == 0 then
  15.                 --local number_use = pc.getf("tombola_start","used_today")
  16.                 chat("tombola3")
  17.                 if pc.get_level() < TOMBOLA_LIMIT_LVL then
  18.                     notice("Ta przyjemność zarezerwowana jest dla bardziej doświadczonych graczy.")
  19.                     notice("Zdobądź "..TOMBOLA_LIMIT_LVL.." poziom i wygrywaj w Tomboli!")
  20.                     return
  21.                 end
  22.                 --local first_use = pc.getf("tombola_start","limit_time")--time when use first time of day
  23.  
  24.                 --if first_use + TOMBOLA_LIMIT_TIME < get_time() then
  25.             --      pc.setf("tombola_start","used_today",TOMBOLA_COUNT_FREE)
  26.             --      number_use = TOMBOLA_COUNT_FREE
  27.             --      pc.setf("tombola_start","limit_time",get_time())
  28.             --  end
  29.                 local ilosc_sm = pc.get_sm()
  30.                 local ilosc_sz = pc.get_sz()
  31.             --  if number_use > 0 then
  32.             --      tombola_start.losuj()
  33.             --  else
  34.                     --if number_use == 0 then
  35.                 --      notice("TOMBOLA ERROR 12")
  36.                 --      return
  37.                 --  end
  38.                     chat("tombola4")
  39.                     if ilosc_sm < TOMBOLA_PRICE then
  40.                         chat("tombola5")
  41.                         notice("Nie masz wystarczającej ilości SM.")
  42.                         notice("Możesz skorzystać z losowania za jedyne "..TOMBOLA_PRICE.." Smoczych Monet.")
  43.                         notice("Doładuj Smocze Monety na naszej stronie "..ADRES_WWW.." i zagraj jeszcze raz!")
  44.                         return
  45.                     end
  46.                     tombola_start.losuj()
  47.                 end
  48.             --end
  49.         end
  50.  
  51.  
  52.  
  53.         function losuj()
  54.             local number_list = number(1,TOMBOLA_QUANTITY_LIST)
  55.             local item_reward_list = string.format(TOMBOLA_REWARD_LIST[number_list][1][1]).."|".. string.format(TOMBOLA_REWARD_LIST[number_list][1][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][2])
  56.             cmdchat("tombola_prepare "..item_reward_list)
  57.             local liczba_okrazen = math.random(1,3)
  58.             local ktory_item = math.random(1,16)
  59.             local item_reward = TOMBOLA_REWARD_LIST[number_list][ktory_item][1]
  60.             local reward_count = TOMBOLA_REWARD_LIST[number_list][ktory_item][2]
  61.             local to_position = (ktory_item-1)+(liczba_okrazen*16)
  62.             local speed_down =  math.random(2,10)
  63.             pc.setqf("item_reward",item_reward)
  64.             pc.setqf("reward_count",reward_count)
  65.             cmdchat("tombola_run "..to_position.."|"..speed_down)
  66.             --chat("item wylosowany:"..item_name(item_reward))--debug mode
  67.             pc.setqf("start_game", 1)
  68.         end
  69.     end
  70. end
Add Comment
Please, Sign In to add comment