Author Topic: Adminsit teleport command help  (Read 1449 times)

0 Members and 1 Guest are viewing this topic.

Offline samsterminator

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Adminsit teleport command help
« on: November 12, 2017, 04:33:07 PM »
Hi, I'm running a server on the map rp_downtown_v4c_v4 which has a large open area for admin sits, I made this basic ulx command that will teleport the admin that runs the command to the admin area with the person who made the report, I was just wondering if there is any way I can make it so that it will place the group of people randomly around the area so that if 2 admins start sits at the same time, they're not both placed in the same place in the admin sit area? Thanks for any help

Code: [Select]
function ulx.startsit( calling_ply, target_ply )

if ulx.getExclusive( target_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
return
elseif not target_ply:Alive() then
ULib.tsayError( calling_ply, target_ply:Nick() .. " is dead!", true )
return
else
if target_ply:InVehicle() then
target_ply:ExitVehicle()
end

target_ply:SetPos( Vector( 1249.226, -5828.228,  -5828.228 ) )
target_ply:SetLocalVelocity( Vector( 0, 0, 0 ) )

calling_ply:SetPos( Vector( 1455.038, -5841.248,  -134.968 ) )
calling_ply:SetLocalVelocity( Vector( 0, 0, 0 ) )

end

local str = "#A started an adminsit with #T"
ulx.fancyLogAdmin( calling_ply, str, target_ply, seconds )
end
local startsit = ulx.command( CATEGORY_NAME, "ulx startsit", ulx.startsit, "!startsit" )
startsit:addParam{ type=ULib.cmds.PlayerArg }
startsit:defaultAccess( ULib.ACCESS_ADMIN )
startsit:help( "Starts an adminsit and teleports all listed members to the adminzone." )

Edit: Also, I would like to be able to use the command to bring more than 1 person, but as far as I'm aware if I add more than 1 player name slot to the command I will have to fill every name slot every time (I didn't have time to check) So if anyone knows how to make it so there is an option to teleport multiple people that would be great.
« Last Edit: November 12, 2017, 04:44:26 PM by samsterminator »

Offline [?] The Last Centurion

  • Newbie
  • *
  • Posts: 23
  • Karma: 2
Re: Adminsit teleport command help
« Reply #1 on: January 02, 2018, 11:57:12 AM »
Well you can use math.random for randomizing the X and Y location so it's (usually) never the same as anyone else using the command. You can find another ULX command that uses multi-targeting and copy that code/use it as a base. You can also probably respawn the player if they're dead, instead of just saying they're dead.

I'm sorry I can't really give you any examples, I'm new to lua, but I gave you all info you asked for.