Ulysses
Ulysses Stuff => Suggestions => Topic started by: Vakaris on September 25, 2009, 04:19:28 AM
-
I noticed that in my server the suicide command, kill, is just annoying. I made a small lua script to return false to the suicide atempt along with a messange to contact an admin if they're stuck. My small script got broken recently and I couldn't get it to work propperly again. This is where ULX comes in, I am here to request a plugin made for ULX/Ulib to disable the kill command by default for all users and admins alike (we still have the slay and the sslay commands and cna use them if nesessary).
-
I'm curious.... why do you find suicide in a Gmod game server annoying?
-
I'm curious.... why do you find suicide in a Gmod game server annoying?
I host a SB2 server with PvP damage enabled. It's annying for someone to bind kill to a key and use it just before death. Also I like to make bases, tarps, all sorts of player manipulation gizmoes, the suicide command sort of ruins most of this...
-
I've seen this before... somewhere. In any case, an add-on like this wouldn't require ULX, let alone ULib (unless you wanted group overrides). Maybe you could post your original code and people that know Lua could take a look at it?
-
Sure... I'll find it in a minute...
Ok here it is:
C:\Program Files\Steam\SteamApps\MyUserName\Garrysmod\Garrysmod\Lua\Autorun\Server\blocksuicide.lua
function NoSuicide( ply )
ply:PrintMessage( HUD_PRINTTALK, "Suicide has been disabled, contact an online admin for support if needed.")
return false
end
hook.Add( "CanPlayerSuicide", "Suicide", NoSuicide )
-
I can't remember where I saw this before. It might even be a gamemode setting...
-
I got a part of this code from some german website (used a translator), the other part I made up by my self and added the notification messange. It worked perfectly, but later I think an update broke the code... Same as Uclip...
-
See ULX's lib.lua file. It has a function that prevents death.
Use it's function along with a message.
-
See ULX's lib.lua file. It has a function that prevents death.
Use it's function along with a message.
Looked at the file, it seems it's on what the wonders sslay feeds on for power... But I couldn't figure out how to properly merge it with my function (look above for refference). Also, jsut that we're clear, I'm looking for a script or something the could prevent suicide command, but would still allow the player to die from prop physics, PvP damage, suffocation in space, etc. and most imporatantly wouldn't be immune to (s)slay commands. It's getting late here... Ok basicly it's morning - 04:07, I'm going to get some sleep and continue on the matter after that, feel free to post sugestiongs, help, etc. I'll check when I wake up.
-
You're script should work.
Only reason I can think would be another mod that uses the same hook being done badly.
You mentioned in another post Gcombat. I've seen posts of Gcombat breaking certain functions of ULX, and atomicspark mentioned it being a mess.
Gcombat may not be the issue, but, search your other mods for the text "CanPlayerSuicide"
I'm betting one of them is returning something when it shouldn't be.
The function I was talking about in lib.lua are checkDeath and checkSuicide.
We use them both for during punishments where we don't want the person to kill themselves.
Jail, Maul, just to name a few. :)
-
Gcombat doesn't break... oh nevermind. Are we sure that Garry's Mod doesn't have a gamemode setting for this?
-
Gcombat doesn't break... oh nevermind. Are we sure that Garry's Mod doesn't have a gamemode setting for this?
Old versions _did_ break some ULX features...at the time.
http://forums.ulyssesmod.net/index.php/topic,4000.0.html
I only imagine the nightmare of one contributor adding on then another then another.
It's one thing to have one main lead guide several developers (as in Ulysses projects), totally another to have possibly bad re-writes.
Either way, I'm not familiar enough with the gamemode functions off the top of my head... it is possible.
My first inclination though would be that some mod is quite possibly returning true on the CanPlayerSuicide hook, breaking all others.
-
Is "CanPlayerSuicide" built into GMod?
-
http://wiki.garrysmod.com/?title=Gamemode.CanPlayerSuicide
-
Ok so you think my GCombat may break the part? I use GCombat8 because GCombat9 (and GCX and TiberiumMod that came with it) are only a pain in the ass to reedit and/or delete. I run a ton of mods on my server - over 50 to be precise, easily any of them may conflict with the others, but unless anyone else can confirm the script works for them I don't know if I should do a searth on over a million files stacking up to over 5 GB. If anyone needs the full list of my mods then say so.
-
Ok people, forget it. I found the problem - Player Possesor Swep. It caught my eye while I was looking at my mods and when I looked into it's lua\autorun\server\servercontrol.lua I found that that's what was overriding my script. Once I took it out it works perfectly again, now all that's missing is the fix on UClip and my server is back to it's former glory! ;D
Edit: Maybe if I took the following out of the PPS it would work ok?
function FDoNotDieBitch(ply)
if table.HasValue(GlobalNoControlTable, ply:UserID()) then
return false
else
return true
end
end
hook.Add("CanPlayerSuicide", "FDoNotDieBitch", FDoNotDieBitch)
Just tested it out, works perfectly.
-
You can fix PPS for it's author.
I thought the Author knew better. Fptje?
A script using a hook, should "NEVER" return true in a hook IF that hook is meant to continue and do nothing.
returning true in a standard gamemode hook breaks all other like hooks.
That's why your script isn't working with that in PPS.
You could fix it in two possible ways.
Remove the word "true" in the else statement.
Or
Remove the 'else' and 'return true' from the function totally.
ALso, I see that FTpje released that mod almost 2 years ago.
He's no longer supporting it at Facepunch.
I hope he's learned since then that returning true in a standard hook is usually a bad thing.
-
Gamemode.CanPlayerSuicide
Aha!
-
Yes Atomicspark, that's what we've been talking about since first post.
:P
Due to some mod badly using the hook, Vakaris' stopped working.
When you asked about a Garry's mod gamemode function existing, I didn't catch thats what you were looking for, since we'd already been discussing it.
-
Yes Atomicspark, that's what we've been talking about since first post.
:P
Due to some mod badly using the hook, Vakaris' stopped working.
When you asked about a Garry's mod gamemode function existing, I didn't catch thats what you were looking for, since we'd already been discussing it.
I edited the mod by deleting the disallow suicide function from it. I was totally unecesary since in my server suicide is disabled by default.
I do beleave it's spelt " Vakaris's " not " Vakaris' ", since Vakaris is my name (Va-ka-ris the "s" is a part of my name) it does mean one person not multiple objects.