Skip to content

Commit

Permalink
Lua code format - (Stylua)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 20, 2023
1 parent 6bcaa68 commit 4b6b064
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions data/scripts/talkactions/gm/position.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
local position = TalkAction("/pos", "!pos")

function position.onSay(player, words, param)
-- create log
logCommand(player, words, param)
-- create log
logCommand(player, words, param)

local splitParam = param:split(",")
if #splitParam == 3 then
local x, y, z = tonumber(splitParam[1]), tonumber(splitParam[2]), tonumber(splitParam[3])
if x and y and z then
player:teleportTo(Position(x, y, z))
else
player:sendTextMessage(MESSAGE_STATUS, "Invalid coordinates. Please enter valid x, y, z values.")
end
elseif param == "" then
local playerPosition = player:getPosition()
player:sendTextMessage(MESSAGE_STATUS, "Your current position is: " ..
playerPosition.x .. ", " .. playerPosition.y .. ", " .. playerPosition.z .. ".")
else
player:sendTextMessage(MESSAGE_STATUS, "Invalid format. Please enter coordinates as x, y, z.")
end
return true
local splitParam = param:split(",")
if #splitParam == 3 then
local x, y, z = tonumber(splitParam[1]), tonumber(splitParam[2]), tonumber(splitParam[3])
if x and y and z then
player:teleportTo(Position(x, y, z))
else
player:sendTextMessage(MESSAGE_STATUS, "Invalid coordinates. Please enter valid x, y, z values.")
end
elseif param == "" then
local playerPosition = player:getPosition()
player:sendTextMessage(MESSAGE_STATUS, "Your current position is: " .. playerPosition.x .. ", " .. playerPosition.y .. ", " .. playerPosition.z .. ".")
else
player:sendTextMessage(MESSAGE_STATUS, "Invalid format. Please enter coordinates as x, y, z.")
end
return true
end

position:separator(" ")
Expand Down

0 comments on commit 4b6b064

Please sign in to comment.