Uissu

[X-TIBIA][TALKACTION] Player Broadcast

Feb 4th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. function onSay(cid, words, param) -- By Byerne XTibia
  2.     local item, type = {12596,1}, MESSAGE_INFO_DESCR
  3.    
  4.     if (not param or param == '') then
  5.         return true, doPlayerSendCancel(cid, "Command param required.")
  6.     end
  7.     if not doPlayerRemoveItem(cid, item[1], item[2]) then
  8.         strocnt = item[2] == 1 and getItemArticleById(item[1]) or item[2]
  9.         return true, doPlayerSendCancel(cid, "You need at least "..strocnt.." "..getItemNameById(item[1]).." to broadcast a message.")
  10.     end
  11.     for _, pid in ipairs(getPlayersOnline()) do
  12.         if getPlayerGroupId(cid) > getPlayerGroupId(pid) then
  13.             doPlayerSendTextMessage(pid, type, getPlayerName(cid)..' ['..getPlayerLevel(cid)..']: '..param)
  14.         end
  15.         return true
  16.     end
  17.     doPlayerSendTextMessage(cid, 18, words..' '..param)
  18. return TRUE
  19. end
Advertisement
Add Comment
Please, Sign In to add comment