stoneharry

Untitled

Apr 2nd, 2011
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. local players = {}
  2. local welcome_back = {}
  3.  
  4. function OnSpawn(pUnit, Event)
  5.   pUnit:RegisterEvent("CheckForPlayers", 2000, 0)
  6. end
  7.  
  8. function CheckForPlayers(pUnit)
  9.     for place,plr in pairs(pUnit:GetInRangePlayers()) do
  10.         if plr ~= nil then
  11.             if pUnit:GetDistanceYards(plr) < 10 then
  12.                 for plce,plrs in pairs(players) do
  13.                     if plrs ~= plr:GetName() then
  14.                         pUnit:SendChatMessage(12,0,"Welcome To The Alliance Mall "..pPlayer:GetName().."!")
  15.                         table.insert(players, plr:GetName())
  16.                     else
  17.                         for plc, plas in pairs(welcome_back) do
  18.                             if plas ~= plr:GetName() then
  19.                                 pUnit:SendChatMessage(12,0,"Welcome back "..pPlayer:GetName().."!")
  20.                                 table.insert(welcome_back, plr:GetName())
  21.                             end
  22.                         end
  23.                     end
  24.                 end
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. RegisterUnitEvent(80051, 18, "OnSpawn")
Advertisement
Add Comment
Please, Sign In to add comment