Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
b98e8d6d
Commit
b98e8d6d
authored
10 years ago
by
LeMagnesium
Committed by
ShadowNinja
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a better error message when trying to teleport another player without bring privileges
parent
741df993
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
builtin/game/chatcommands.lua
+39
-37
39 additions, 37 deletions
builtin/game/chatcommands.lua
with
39 additions
and
37 deletions
builtin/game/chatcommands.lua
+
39
−
37
View file @
b98e8d6d
...
...
@@ -326,46 +326,48 @@ core.register_chatcommand("teleport", {
return
true
,
"Teleporting to "
..
target_name
..
" at "
..
core
.
pos_to_string
(
p
)
end
if
not
core
.
check_player_privs
(
name
,
{
bring
=
true
})
then
return
false
,
"You don't have permission to teleport other players (missing bring privilege)"
end
local
teleportee
=
nil
local
p
=
{}
local
teleportee_name
=
nil
teleportee_name
,
p
.
x
,
p
.
y
,
p
.
z
=
param
:
match
(
"^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$"
)
p
.
x
,
p
.
y
,
p
.
z
=
tonumber
(
p
.
x
),
tonumber
(
p
.
y
),
tonumber
(
p
.
z
)
if
teleportee_name
then
teleportee
=
core
.
get_player_by_name
(
teleportee_name
)
end
if
teleportee
and
p
.
x
and
p
.
y
and
p
.
z
then
teleportee
:
setpos
(
p
)
return
true
,
"Teleporting "
..
teleportee_name
..
" to "
..
core
.
pos_to_string
(
p
)
end
if
core
.
check_player_privs
(
name
,
{
bring
=
true
})
then
local
teleportee
=
nil
local
p
=
{}
local
teleportee_name
=
nil
teleportee_name
,
p
.
x
,
p
.
y
,
p
.
z
=
param
:
match
(
"^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$"
)
p
.
x
,
p
.
y
,
p
.
z
=
tonumber
(
p
.
x
),
tonumber
(
p
.
y
),
tonumber
(
p
.
z
)
if
teleportee_name
then
teleportee
=
core
.
get_player_by_name
(
teleportee_name
)
end
if
teleportee
and
p
.
x
and
p
.
y
and
p
.
z
then
teleportee
:
setpos
(
p
)
return
true
,
"Teleporting "
..
teleportee_name
..
" to "
..
core
.
pos_to_string
(
p
)
end
local
teleportee
=
nil
local
p
=
nil
local
teleportee_name
=
nil
local
target_name
=
nil
teleportee_name
,
target_name
=
string.match
(
param
,
"^([^ ]+) +([^ ]+)$"
)
if
teleportee_name
then
teleportee
=
core
.
get_player_by_name
(
teleportee_name
)
end
if
target_name
then
local
target
=
core
.
get_player_by_name
(
target_name
)
if
target
then
p
=
target
:
getpos
()
end
end
if
teleportee
and
p
then
p
=
find_free_position_near
(
p
)
teleportee
:
setpos
(
p
)
return
true
,
"Teleporting "
..
teleportee_name
..
" to "
..
target_name
..
" at "
..
core
.
pos_to_string
(
p
)
local
teleportee
=
nil
local
p
=
nil
local
teleportee_name
=
nil
local
target_name
=
nil
teleportee_name
,
target_name
=
string.match
(
param
,
"^([^ ]+) +([^ ]+)$"
)
if
teleportee_name
then
teleportee
=
core
.
get_player_by_name
(
teleportee_name
)
end
if
target_name
then
local
target
=
core
.
get_player_by_name
(
target_name
)
if
target
then
p
=
target
:
getpos
()
end
end
if
teleportee
and
p
then
p
=
find_free_position_near
(
p
)
teleportee
:
setpos
(
p
)
return
true
,
"Teleporting "
..
teleportee_name
..
" to "
..
target_name
..
" at "
..
core
.
pos_to_string
(
p
)
end
return
false
,
'Invalid parameters ("'
..
param
..
'") or player not found (see /help teleport)'
end
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment