Ulysses
Ulysses Stuff => Suggestions => Topic started by: ULXGmodFan on May 22, 2014, 09:03:45 AM
-
Hello,
I love ulx, especially with lots of plugins. Never have any trouble or miss stuff which I need for my sandbox building server. There is only 1 thing that's really missing for me and that's a jail tp command to preset coördinates. If your server runs on a map you sometimes have a jail included. I know some mods have it, but they're not half as good as ulx is. It can be simply done I think with a command for the sadmin ulx setjailposition or something. Or even jailposition1, jailposition2, jailpos3 and 4 so you can have 4 different cells or somehting. But that's not really needed for sandbox, but would definately be cool as an extra if it's not too much trouble. But a jailposition command would be super.
So I kindly would ask if it's possible to include it, it would be really really really awesome!
Thanks alot
-
Hello there,
eventhough this does not quite belong in the suggestions category, you can accomplish this task easily by yourself, take a look at jailtp:
------------------------------ Jail TP ------------------------------
function ulx.jailtp( calling_ply, target_ply, seconds )
local t = {}
t.start = calling_ply:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground
t.endpos = calling_ply:GetPos() + calling_ply:EyeAngles():Forward() * 16384
t.filter = target_ply
if target_ply ~= calling_ply then
t.filter = { target_ply, calling_ply }
end
local tr = util.TraceEntity( t, target_ply )
local pos = tr.HitPos
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
elseif not jailableArea( pos ) then
ULib.tsayError( calling_ply, "That is not an area where a jail can be placed!", true )
return
else
if target_ply:InVehicle() then
target_ply:ExitVehicle()
end
target_ply:SetPos( pos )
target_ply:SetLocalVelocity( Vector( 0, 0, 0 ) ) -- Stop!
doJail( target_ply, seconds )
end
local str = "#A teleported and jailed #T"
if seconds > 0 then
str = str .. " for #i seconds"
end
ulx.fancyLogAdmin( calling_ply, str, target_ply, seconds )
end
local jailtp = ulx.command( CATEGORY_NAME, "ulx jailtp", ulx.jailtp, "!jailtp" )
jailtp:addParam{ type=ULib.cmds.PlayerArg }
jailtp:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
jailtp:defaultAccess( ULib.ACCESS_ADMIN )
jailtp:help( "Teleports, then jails target(s)." )
Especially at those lines here:
local pos = tr.HitPos
target_ply:SetPos( pos )
Hope I pointed you in the right direction.
Avoid
-
I cant really do Code :-[ I figure I need to put the coördinates at the place where the 0,0,0 is?
But that way you can never change the position while playing. I think it would be handy to have as extra cmd. If a custom jail position isn't set the jail is at the current position as default :)
-
You can have another command that stores the location in the data folder.
Then have jailtp send the target to the stored location .
-
You can have another command that stores the location in the data folder.
Then have jailtp send the target to the stored location .
Could you maybe provide me with steps? I really don't understand which file I should make and which extention etc. Thanks alot
-
Could you maybe provide me with steps? I really don't understand which file I should make and which extention etc. Thanks alot
For the command or the data?
-
To make ULX tpjail work for a location somewhere
-
I'm sorry to ask it again but I really don't understand what I should change. Any help is greatly appreciated.
-
Here's how I would go about doing it:
1. Create a blank data file to put your vector in
2. Hook initialize and read the file using util.StringToType (after you check if there is anything in it) and save that as a global vector (http://wiki.garrysmod.com/page/Global/SetGlobalVector)
3. Create a ulx command to write a vector to that file using util.TypeToString (Have a function in it to refresh the global vector if you overwrite it)
4. Copy jailtp but instead of sending it to the position where you are looking, send it to the global vector instead.
-
Here's what I came up with, I haven't tested it, so tell me if anything goes wrong.
I posted the code in the attachments.
-
Here's how I would go about doing it:
1. Create a blank data file to put your vector in
2. Hook initialize and read the file using util.StringToType (after you check if there is anything in it) and save that as a global vector (http://wiki.garrysmod.com/page/Global/SetGlobalVector)
3. Create a ulx command to write a vector to that file using util.TypeToString (Have a function in it to refresh the global vector if you overwrite it)
4. Copy jailtp but instead of sending it to the position where you are looking, send it to the global vector instead.
I have now idea how to handel util.stringtype and all that stuff, lol, blank textfile? shold I call it lua or addon or? Man I wish i could be better at moddding like this
Here's what I came up with, I haven't tested it, so tell me if anything goes wrong.
I posted the code in the attachments.
Thganks, I will try this, put it in addons?
Edit: Thanks Neku, I understand your file. Looks like other addons I have. So it just overwrites the existing one? On what line do I add the vector coordinates?
Oh and one more thing, should I remove the space in the file name before I put in addons? Are change the space for an underscore?
-
Oh awesome! You added it to the menu. Yes it looks very clear and easy and handy the jailpos in the menu, but if I click it and then try to teleport it says that the map has no jail pos set.
But what you've done is EXACTLY what I needed, many thanks, if this works it should be in ULX standard
-
Oh awesome! You added it to the menu. Yes it looks very clear and easy and handy the jailpos in the menu, but if I click it and then try to teleport it says that the map has no jail pos set.
But what you've done is EXACTLY what I needed, many thanks, if this works it should be in ULX standard
There's a command to set the jail position at your current location by the way.
-
Which is? I tried with rcon ulx jailpos "coordinates copied from getpos"
It would be awesome if it works in the menu too.
Thanks alot
-
It should just be !jailpos.
There aren't any parameters for it, just use it and it will set a jailtp position for that specific map.
Please note: jailpos is not usable in rcon. And jailpos requires superadmin or an "equivalent".
-
I tried, but same error, no jailpos is set for the map
-
Oh. I feel stupid.
Go into the lua file and find
"jailtp" .. game.GetMap() .. ".txt"
This should be the one in the jailtp command. Replace "jailtp" with "jailtp/".
-
Thanks alot, that worked!
Now can I remove the bars somehow so it uses the jail in the level?
-
Thanks alot, that worked!
Now can I remove the bars somehow so it uses the jail in the level?
Oh. In that case, let me rewrite it.
-
Oh. In that case, let me rewrite it.
Rewrite? The lua addon now works, but i wouldn't recommand for others to use because they miss a slash in the code.
But I was wondering if I could just remove the prop fence models and if the jail still works but you can freely walk around in the mapjail instead of the 6 fences. Would the other stuff still work like not being able to use weapons and tools etc?
Thanks
-
There is. ULX spawns in those fences, so comment them out.