stoneharry

Untitled

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