Advertisement
Guest User

Gift System 26.12.2014

a guest
Dec 26th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. -- (c) 2014 Zetsu --
  2. --    Metin2.Dev   --
  3. quest thsgiftdev begin
  4.     state start begin
  5.     when login begin
  6.             cmdchat("zetsugfsys "..q.getcurrentquestindex())
  7.             if pc.getqf("giftsystemuse") <= get_time() then
  8.                 cmdchat("giftsyshide")
  9.             end
  10.         end
  11.          
  12.         function giverandomitem()
  13.             local random_nr = number(1,5)
  14.             chat("I: The box it's opening...") -- Opening
  15.             pc.give_item2(tonumber(mysql_query('SELECT box'..random_nr..' as gift_box from player.surprisebox WHERE openorclose=1 LIMIT 1;').gift_box[1])) -- Thanks Denis!! :D
  16.             pc.setqf("giftsystemuse", get_time()+60*60*12) -- 12 HRS  (Captain math: cause 1hr has 60 min, 1min=60sec)
  17.             cmdchat("giftsyshide")
  18.         end
  19.          
  20.         when 17609.use with pc.get_level() >= 10 begin
  21.             local random_nr = number(1,5)
  22.             chat("I: The box it's opening...")
  23.             pc.give_item2(tonumber(mysql_query('SELECT box'..random_nr..' as gift_box from player.surprisebox WHERE openorclose=1 LIMIT 1;').gift_box[1])) -- Thanks Denis again!! :D
  24.         end
  25.  
  26.         when button or info begin
  27.             if pc.getqf("giftsystemuse") <= get_time() then
  28.                 thsgiftdev.giverandomitem() -- yeah..function -_- don't try to bind that condition with this..
  29.             else
  30.                 chat("W: You have no gift. Try after 12 hours...") -- Played
  31.                 cmdchat("giftsyshide")
  32.             end
  33.         end
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement