forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfly.lua
More file actions
25 lines (19 loc) · 688 Bytes
/
fly.lua
File metadata and controls
25 lines (19 loc) · 688 Bytes
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
function HandleFlyCommand(Split, Player)
local function ChangeFly( newPlayer )
newPlayer:SetCanFly(not newPlayer:CanFly());
newPlayer:SendMessageSuccess("Fly mode toggled!")
return true
end
if (Split[2] == nil or Split[2] == Player:GetName()) then
ChangeFly(Player)
elseif (Player:HasPermission("core.fly.others")) then
if cRoot:Get():FindAndDoWithPlayer( Split[2], ChangeFly ) then
Player:SendMessageSuccess("Fly mode for player " .. Split[2] .. " toggled!")
else
SendMessageFailure( Player, "Player " .. Split[2] .. " isn't online!")
end
else
Player:SendMessageFailure("You need core.fly.others permission to do that!")
end
return true
end