Author Topic: Warp Target Player  (Read 2234 times)

0 Members and 1 Guest are viewing this topic.

Offline Darkblizzard

  • Newbie
  • *
  • Posts: 39
  • Karma: 1
Warp Target Player
« on: October 13, 2018, 12:51:01 PM »
Hello,
I posted a warp code for ULX, but I noticed that it would only teleport the caster when the command is used. Is there anyway to make it so the command can target players to teleport that player to the warp location?
Thanks


Code: [Select]
local CATEGORY_NAME = 'Teleport'

local warps = {
-- ['name of warp location'] = Position that you want players to be teleported to
['admin'] = Vector(-1936.525879, -2138.591553, 8439.391602),
['spawn'] = Vector(423.965302, 9198.730469, 74.031250)
}


local WarpACs = { 'admin', 'spawn' }

function ulx.warp(caller, place)
if not warps[place] then
ULIb.tsayError(caller, 'That is not a valid warp location!', true)
else
local pos = warps[place]
if not isvector(pos) then
ULIb.tsayError(caller, 'Invalid warp vector, please check warps list.', true)
else
caller:SetPos(pos)
ulx.fancyLogAdmin(caller, '#A has teleported to warp location: ' .. place..'.')
end
end
end

local warp = ulx.command(CATEGORY_NAME, 'ulx warp', ulx.warp, '!tp')
warp:defaultAccess(ULib.ACCESS_ADMIN) -- Put ULib.ACCESS_OPERATOR for operator, ULib.ACCESS_SUPERADMIN for only superadmins, or ULib.ACCESS_ALL for everyone.
warp:addParam{type = ULib.cmds.StringArg, hint = 'warp location name', completes = WarpACs}
warp:help('Teleports a user to a location specified by a name.')

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given