ULX

Author Topic: Anti-suicide plugin  (Read 17075 times)

0 Members and 1 Guest are viewing this topic.

Offline Vakaris

  • Newbie
  • *
  • Posts: 31
  • Karma: 0
Re: Anti-suicide plugin
« Reply #15 on: September 26, 2009, 03:24:12 AM »
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?

Code: [Select]
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.
« Last Edit: September 26, 2009, 03:35:50 AM by Vakaris »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Anti-suicide plugin
« Reply #16 on: September 26, 2009, 07:26:29 AM »
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.
« Last Edit: September 26, 2009, 07:35:26 AM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: Anti-suicide plugin
« Reply #17 on: September 26, 2009, 10:12:39 AM »
Quote
Gamemode.CanPlayerSuicide

Aha!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Anti-suicide plugin
« Reply #18 on: September 26, 2009, 03:16:58 PM »
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Vakaris

  • Newbie
  • *
  • Posts: 31
  • Karma: 0
Re: Anti-suicide plugin
« Reply #19 on: September 26, 2009, 04:24:29 PM »
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.