-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHire_bot.lua
63 lines (45 loc) · 1.36 KB
/
Hire_bot.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
local enabled = true
local hirebot = "hirebot"
local spawndur = 180000
local function Timed(eventid, delay, repeats, worldobject)
worldobject:DespawnOrUnsummon( 1000 )
worldobject:RemoveEvents()
end
local function checkdespawn(eventid, delay, repeats, player)
local HireNPCnear = player:GetNearestCreature( 60, 70000 )
local nearplayer = HireNPCnear:GetNearestPlayer( 5 )
if nearplayer == nil then
--spawnedHire:DespawnOrUnsummon( 1000 )
player:RemoveEventById( eventid )
HireNPCnear:RegisterEvent(Timed, 2000, 1, player)
end
end
local function Hirefunc(event, player)
local x = player:GetX()
local y = player:GetY()
local z = player:GetZ()
local o = player:GetO()
local HireNPCnear = player:GetNearestCreature( 60, 70000 )
local spawnedHire
if HireNPCnear == nil then
spawnedHire = player:SpawnCreature( 70000, x+1, y+1, z+0.5, o-3.5, 1, spawndur )
else
player:SendAreaTriggerMessage("Hire NPC nearby")
end
eventid = player:RegisterEvent(checkdespawn, 1000, 0, player)
end
local function PlrMenu(event, player, message, Type, lang)
if (message:lower() == hirebot) then
local mingmrank = 3
if (GMonly and player:GetGMRank() < mingmrank) then
player:SendBroadcastMessage("|cff5af304Only a GM can use this command.|r")
return false
else
Hirefunc(event, player)
return false
end
end
end
if enabled then
RegisterPlayerEvent(42, PlrMenu)
end