Advertisement
Guest User

Untitled

a guest
May 12th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. quest lanciadadi begin
  2.     state start begin
  3.         function DoDices(dices)
  4.             local _urDice
  5.             local _cpuDice
  6.             for i = 0, dices do
  7.                 _urDice = number(1,6)
  8.                 _cpuDice = number(1,6)
  9.                 if _urDice ~= _cpuDice then return false end -- if
  10.             end -- for
  11.             return true
  12.         end --  function
  13.        
  14.         when NPC_VNUM.chat."Voglio lanciare i dadi" begin
  15.             say("Quanti dadi vuoi lanciare? (Min 1, Max 5)")
  16.             local Dices = input()
  17.             Dices = tonumber(Dices)
  18.             if Dices and Dices > 0 and Dices < 6 then
  19.                 if DoDices(Dices) then
  20.                     say("Hai vinto!")
  21.                     -- Dare premio
  22.                 else
  23.                     say("Hai perso!")
  24.                 end -- if
  25.             else
  26.                 say("Inserisci un numero tra 1 e 5")
  27.             end -- if
  28.         end -- when
  29.     end -- state
  30. end -- quest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement