Advertisement
Eliaseeg

Sistema de tienda

Feb 11th, 2015
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. local mice = {}
  2. local shop = {
  3. --  NOMBRE - PRECIO
  4.     {"Caja", 10},
  5.     {"Pelota", 5},
  6.     {"Yunque", 15}
  7. }
  8.  
  9. function eventNewPlayer(name)
  10.     if not mice[name] then
  11.         mice[name] = {
  12.             quesitos = 10,
  13.             Caja = nil,
  14.             Pelota = nil,
  15.             Yunque = nil
  16.         }
  17.     end
  18. end
  19.  
  20. for name,_ in pairs(tfm.get.room.playerList) do
  21.     eventNewPlayer(name)
  22. end
  23.  
  24. function eventTextAreaCallback(id, name, callback)
  25.     for i=1,3 do
  26.         if callback == shop[i][i] then
  27.             if mice[name].quesitos <= shop[i][2] then
  28.                 print('Caja comprada correctamente')
  29.                 mice[name].quesitos - mice[name].quesitos - shop[i][2]
  30.                 mice[name].""..shop[i][1].."" = true
  31.             end
  32.             print(mice[name].quesitos)
  33.         end
  34.     end
  35. end
  36.  
  37. for i=1,3 do
  38.     print("<a href='event:"..shop[i][1].."'>"..shop[i][1].."</a>")
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement