stoneharry

Untitled

Apr 2nd, 2011
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 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.         print("function called")
  10.     for place,plr in pairs(pUnit:GetInRangePlayers()) do
  11.         if plr ~= nil then
  12. print("plr not nil")
  13.             if pUnit:GetDistanceYards(plr) < 10 then
  14. print("plr close enough")
  15.                 for plce,plrs in pairs(players) do
  16. print(plrs)
  17.                     --if plrs ~= plr:GetName() then
  18. print("plr is new")
  19.                         pUnit:SendChatMessage(12,0,"Welcome To The Alliance Mall "..pPlayer:GetName().."!")
  20.                         table.insert(players, plr:GetName()
  21.                     --[[else
  22. print("plr not new")
  23.                         for plc, plas in pairs(welcome_back) do
  24. print("preparing to send message saying welcome back")
  25.                             if plas ~= plr:GetName() then
  26. print("sending message welcome back")
  27.                                 pUnit:SendChatMessage(12,0,"Welcome back "..pPlayer:GetName().."!")
  28.                                 table.insert(welcome_back, plr:GetName())
  29.                             end
  30.                         end
  31.                     end]]
  32.                 end
  33.             end
  34.         end
  35.     end
  36. end
  37.  
  38. RegisterUnitEvent(80051, 18, "OnSpawn")
Advertisement
Add Comment
Please, Sign In to add comment