@@ -326,46 +326,48 @@ core.register_chatcommand("teleport", {
326
326
return true , " Teleporting to " .. target_name
327
327
.. " at " .. core .pos_to_string (p )
328
328
end
329
+
330
+ if not core .check_player_privs (name , {bring = true }) then
331
+ return false , " You don't have permission to teleport other players (missing bring privilege)"
332
+ end
333
+
334
+ local teleportee = nil
335
+ local p = {}
336
+ local teleportee_name = nil
337
+ teleportee_name , p .x , p .y , p .z = param :match (
338
+ " ^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$" )
339
+ p .x , p .y , p .z = tonumber (p .x ), tonumber (p .y ), tonumber (p .z )
340
+ if teleportee_name then
341
+ teleportee = core .get_player_by_name (teleportee_name )
342
+ end
343
+ if teleportee and p .x and p .y and p .z then
344
+ teleportee :setpos (p )
345
+ return true , " Teleporting " .. teleportee_name
346
+ .. " to " .. core .pos_to_string (p )
347
+ end
329
348
330
- if core .check_player_privs (name , {bring = true }) then
331
- local teleportee = nil
332
- local p = {}
333
- local teleportee_name = nil
334
- teleportee_name , p .x , p .y , p .z = param :match (
335
- " ^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$" )
336
- p .x , p .y , p .z = tonumber (p .x ), tonumber (p .y ), tonumber (p .z )
337
- if teleportee_name then
338
- teleportee = core .get_player_by_name (teleportee_name )
339
- end
340
- if teleportee and p .x and p .y and p .z then
341
- teleportee :setpos (p )
342
- return true , " Teleporting " .. teleportee_name
343
- .. " to " .. core .pos_to_string (p )
344
- end
345
-
346
- local teleportee = nil
347
- local p = nil
348
- local teleportee_name = nil
349
- local target_name = nil
350
- teleportee_name , target_name = string.match (param , " ^([^ ]+) +([^ ]+)$" )
351
- if teleportee_name then
352
- teleportee = core .get_player_by_name (teleportee_name )
353
- end
354
- if target_name then
355
- local target = core .get_player_by_name (target_name )
356
- if target then
357
- p = target :getpos ()
358
- end
359
- end
360
- if teleportee and p then
361
- p = find_free_position_near (p )
362
- teleportee :setpos (p )
363
- return true , " Teleporting " .. teleportee_name
364
- .. " to " .. target_name
365
- .. " at " .. core .pos_to_string (p )
349
+ local teleportee = nil
350
+ local p = nil
351
+ local teleportee_name = nil
352
+ local target_name = nil
353
+ teleportee_name , target_name = string.match (param , " ^([^ ]+) +([^ ]+)$" )
354
+ if teleportee_name then
355
+ teleportee = core .get_player_by_name (teleportee_name )
356
+ end
357
+ if target_name then
358
+ local target = core .get_player_by_name (target_name )
359
+ if target then
360
+ p = target :getpos ()
366
361
end
367
362
end
368
-
363
+ if teleportee and p then
364
+ p = find_free_position_near (p )
365
+ teleportee :setpos (p )
366
+ return true , " Teleporting " .. teleportee_name
367
+ .. " to " .. target_name
368
+ .. " at " .. core .pos_to_string (p )
369
+ end
370
+
369
371
return false , ' Invalid parameters ("' .. param
370
372
.. ' ") or player not found (see /help teleport)'
371
373
end ,
0 commit comments