adrianoswatt

CastleSys Bless - TalkAction

Oct 16th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. local price = 20000 -- em Gold Por Bless
  2. local gSto = 123123 -- Global Storage que Salva Guild Dominante do Castelo
  3.  
  4. function onSay(cid, words, param)
  5.     if getGlobalStorageValue(gSto) ~= getPlayerGuildId(cid) then
  6.         return doPlayerSendCancel(cid, 'You need to join the guild that dominates the castle to use this command.')
  7.     end
  8.     if getPlayerMoney(cid) >= price then
  9.         x = 0
  10.         for i = 1, 5 do
  11.             if getPlayerBlessing(cid, i) == false then
  12.                 if getPlayerMoney(cid) >= price then
  13.                     doPlayerAddBlessing(cid, i)
  14.                     doPlayerRemoveMoney(cid, price)
  15.                     x = x + 1
  16.                 else
  17.                     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You don\'t have more money, you have been '..x..' blesse(s)!')
  18.                     return true
  19.                 end
  20.             end
  21.             if i == 5 then
  22.                 if x == 0 then
  23.                     doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You already been blessed by the Gods!')
  24.                 else
  25.                     doSendMagicEffect(getPlayerPosition(cid), 28)
  26.                     doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Congratulations, you have been all blessed by the Gods!')
  27.                 end
  28.             end
  29.         end
  30.     else
  31.         doPlayerSendCancel(cid,"You need "..price.." gold coins per bless!")
  32.     end
  33. return TRUE
  34. end
Advertisement
Add Comment
Please, Sign In to add comment