Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = {}
- local welcome_back = {}
- function OnSpawn(pUnit, Event)
- pUnit:RegisterEvent("CheckForPlayers", 2000, 0)
- end
- function CheckForPlayers(pUnit)
- print("function called")
- for place,plr in pairs(pUnit:GetInRangePlayers()) do
- if plr ~= nil then
- print("plr not nil")
- if pUnit:GetDistanceYards(plr) < 10 then
- print("plr close enough")
- for plce,plrs in pairs(players) do
- print(plrs)
- --if plrs ~= plr:GetName() then
- print("plr is new")
- pUnit:SendChatMessage(12,0,"Welcome To The Alliance Mall "..pPlayer:GetName().."!")
- table.insert(players, plr:GetName()
- --[[else
- print("plr not new")
- for plc, plas in pairs(welcome_back) do
- print("preparing to send message saying welcome back")
- if plas ~= plr:GetName() then
- print("sending message welcome back")
- pUnit:SendChatMessage(12,0,"Welcome back "..pPlayer:GetName().."!")
- table.insert(welcome_back, plr:GetName())
- end
- end
- end]]
- end
- end
- end
- end
- end
- RegisterUnitEvent(80051, 18, "OnSpawn")
Advertisement
Add Comment
Please, Sign In to add comment