• Print

Author Topic: Re: Trouble in Terrorist Town Commands for ULX  (Read 117859 times)

0 Members and 1 Guest are viewing this topic.

Offline morten7000

  • Newbie
  • *
  • Posts: 39
  • Karma: -1
Re: Trouble in Terrorist Town Commands for ULX
« Reply #30 on: September 20, 2013, 09:37:46 am »
Hi ulysses,
Im sorry for bringing this dead thread up again, but i thought why not write in the original threat than making a whole new "request help" thread,

Its because: Is there a way to code in the original code so that if a target "slaynr" player leave without the punishment we will be autobanned and added the the ban list of ulx?
Here is the code that i got and its from the workshop on steam.. well i think they are the same :P

Code: [Select]
function ulx.slaynr( calling_ply, target_ply, num_slay, should_slaynr )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
local slays_left = tonumber(target_ply:GetPData("slaynr_slays")) or 0
local current_slay
local new_slay
   

if ulx.getExclusive( target_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
elseif num_slay < 0 then
ULib.tsayError( calling_ply, "Invalid integer:\"" .. num_slay .. "\" specified.", true )
else
current_slay = tonumber(target_ply:GetPData("slaynr_slays")) or 0
if not should_slaynr then
                new_slay = current_slay + num_slay 
            else
                new_slay = current_slay - num_slay
            end

            --local slay_reason = reason
            --if slay_reason == "reason" then
            -- slay_reason = false
            --end

if new_slay > 0 then
                target_ply:SetPData("slaynr_slays", new_slay)
                --target_ply:SetPData("slaynr_reason", slay_reason)
            else
target_ply:RemovePData("slaynr_slays")
                --target_ply:RemovePData("slaynr_reason")   
            end

    local slays_left = tonumber(target_ply:GetPData("slaynr_slays"))  or 0
local slays_removed = ( current_slay - slays_left ) or 0

if slays_removed==0 then
chat_message = ("#T will not be slain next round.")
elseif slays_removed > 0 then
chat_message = ("#A removed ".. slays_removed .." round(s) of slaying from #T.")
elseif slays_left == 1 then
chat_message = ("#A will slay #T next round.")
elseif slays_left > 1 then
chat_message = ("#A will slay #T for the next ".. tostring(slays_left) .." rounds.")
end
ulx.fancyLogAdmin( calling_ply, chat_message, target_ply, reason )
end
end
end
local slaynr = ulx.command( CATEGORY_NAME, "ulx slaynr", ulx.slaynr, "!slaynr" )
slaynr:addParam{ type=ULib.cmds.PlayerArg }
slaynr:addParam{ type=ULib.cmds.NumArg, default=1, hint="rounds", ULib.cmds.optional, ULib.cmds.round }
--slaynr:addParam{ type=ULib.cmds.StringArg, hint="reason",  ULib.cmds.optional}
slaynr:addParam{ type=ULib.cmds.BoolArg, invisible=true }
slaynr:defaultAccess( ULib.ACCESS_ADMIN )
slaynr:help( "Slays target(s) for a number of rounds" )
slaynr:setOpposite( "ulx rslaynr", {_, _, _, true}, "!rslaynr" )
--[Helper Functions]---------------------------------------------------------------------------
hook.Add("TTTBeginRound", "SlayPlayersNextRound", function()
local affected_plys = {}

for _,v in pairs(player.GetAll()) do
local slays_left = tonumber(v:GetPData("slaynr_slays")) or 0
       
if v:Alive() and slays_left > 0 then
local slays_left=slays_left -1

if slays_left == 0 then
                v:RemovePData("slaynr_slays")
                v:RemovePData("slaynr_reason")
else
                v:SetPData("slaynr_slays", slays_left)
            end

v:Kill()
table.insert( affected_plys, v )
local corpse = corpse_find(v)
if corpse then
corpse_identify(corpse)
corpse_remove(corpse)
end
end
end

local slay_message
for i=1, #affected_plys do
local v = affected_plys[ i ]
local string_inbetween

if i > 1 and #affected_plys == i then
string_inbetween=" and "
elseif i > 1 then
string_inbetween=", "
end

string_inbetween = string_inbetween or ""
slay_message = ( ( slay_message or "") .. string_inbetween )
slay_message = ( ( slay_message or "") .. v:Nick() )
end

local slay_message_context
if #affected_plys == 1 then slay_message_context ="was" else slay_message_context ="were" end
if #affected_plys ~= 0 then
ULib.tsay(_, slay_message .. " ".. slay_message_context .." slain.")
end
end)

hook.Add("PlayerSpawn", "Inform" , function(ply)
local slays_left = tonumber(ply:GetPData("slaynr_slays")) or 0
local slay_reason = false
       
if ply:Alive() and slays_left > 0 then
local chat_message = ""

if slays_left > 0 then
chat_message = (chat_message .. "You will be slain this round")
end
if slays_left > 1 then
chat_message = (chat_message .. " and ".. (slays_left - 1) .." round(s) after the current round")
end
if slay_reason then
chat_message = (chat_message .. " for \"".. slays_reason .."\".")
else
chat_message = (chat_message .. ".")
end
ply:ChatPrint(chat_message)
end
end)

Thanks for you time and Hopefully help :3

Ps again sorry if i "bumbed" this unnessesary, just tell me and i would leave this thread right away and make a "request some sexy beast coder help" :3

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: Trouble in Terrorist Town Commands for ULX
« Reply #31 on: September 20, 2013, 04:49:02 pm »
There is always a way, it would involve a player disconnect hook official wiki maurits.tv
Code: Lua
  1. hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline morten7000

  • Newbie
  • *
  • Posts: 39
  • Karma: -1
Re: Trouble in Terrorist Town Commands for ULX
« Reply #32 on: September 21, 2013, 02:26:23 am »
Hmm Nice :D.. Well Im not that good at lua but sometime gotta be the first and i think this would be a good start :D. Thansk for pointing me in the right direction. If im totally lost, i'll return :D

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Trouble in Terrorist Town Commands for ULX
« Reply #33 on: October 23, 2013, 01:10:07 pm »
I made this little "extension" to slaynr. It prints to admins if someone leaves with 1 or more slays left. Feel free to use/modify it:
Code: Lua
  1. function SlayNRLeaveInform (ply)
  2.         local slays_left = tonumber(ply:GetPData("slaynr_slays")) or 0 --Taken from Bender and Skillz' TTT module. Shortcut to their "slaynr" PData.
  3.         if slays_left > 0 then --Slays left need to be more than 0. Or else this will print to everyone that leaves.
  4.                 for _, a in ipairs (player.GetAll()) do
  5.                         if a:IsAdmin() then --Checks for admins, basically.
  6.                                 ULib.tsayColor(a, true, Color(255, 255, 255), "The player ", Color(255, 0, 0), ply:Nick(), Color(255, 255, 255), " (", Color(255, 0, 0), ply:SteamID(), Color(255, 255, 255), ") left the server with ", Color(255, 0, 0), tostring(slays_left), Color(255, 255, 255), " slay(s) left.")
  7.                                 --Prints to admins that someone with slays left leaves. I like colors.
  8.                         end
  9.                 end
  10.         end
  11. end
  12. hook.Add("PlayerDisconnected", "Players with slaynr's left will notify admins on leave", SlayNRLeaveInform)
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Roflburger

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Ulx Slaynr Error.
« Reply #34 on: December 18, 2013, 09:39:16 am »
My ULX won't let me slay anybody for the next round.
Normally it works fine, it started about a week ago.
it basically says once you try.
"<Player> will not be slain next round"

This is for both the ULX menu, and the Advanced Damage Logger/RDM tool.
I've had a quick Google search i saw someone with the same issue, but it was months ago and no response for a fix.
I'm guessing this is a maybe a known issue, someone point my <censor> in the right direction please?
I know it's not exactly ULX since bender made it and all, but i tried emailing him but i didn't get a response.
If anyone could help me i would be eternally grateful.

Regards,

EDIT-JamminR - keep it family friendly here please.
« Last Edit: December 18, 2013, 02:01:10 pm by JamminR »

Offline bender180

  • Full Member
  • ***
  • Posts: 217
  • Karma: 42
    • Benders Villa
Re: Trouble in Terrorist Town Commands for ULX
« Reply #35 on: December 18, 2013, 05:07:30 pm »
sadly due to time issues I myself am unable to maintain the commands, ive had to end my gmod community because i didnt have time, as for skillz he is no longer as far as i know invested or intrested in ttt so i doubt he will look to far into it sorry, maybe once i stop working 12 hour days (7am to 7pm) I will pick these back up if someone else hasn't.
Made community pool and community bowling and for the life of me couldn't tell you why they are popular.
Also made the ttt ulx commands.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Ulx Slaynr Error.
« Reply #36 on: December 21, 2013, 07:29:37 am »
My ULX won't let me slay anybody for the next round.
Normally it works fine, it started about a week ago.
it basically says once you try.
"<Player> will not be slain next round"

This is for both the ULX menu, and the Advanced Damage Logger/RDM tool.
I've had a quick Google search i saw someone with the same issue, but it was months ago and no response for a fix.
I'm guessing this is a maybe a known issue, someone point my <censor> in the right direction please?
I know it's not exactly ULX since bender made it and all, but i tried emailing him but i didn't get a response.
If anyone could help me i would be eternally grateful.

Regards,

EDIT-JamminR - keep it family friendly here please.

Similar thing happened on my ttt server a while back, when i tried to prevent the round from ending both buttons made it say "The round will end as normal" or whatever. One day it just fixed itself and I have no clue why that happened.

Offline travelsonic

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Trouble in Terrorist Town Commands for ULX
« Reply #37 on: December 21, 2013, 07:59:02 am »
Pardon me for necro'n an old thread, but there is an issue with slaynr I want to bring up first off to see if it is an issue with the server, how it is configured, etc, and 2nd if it isn't, propose it get fixed - and also propose that perhaps a lower maximum value is given for default - and left to the server owners to set higher if needed.

One night a few admins and superadmins - myself included - were dicking around on the server we admin on.  For fun I decided to see just how many slays you can do with slaynr.  I found I was able to put a number that was 236 digits long into it.  [Why you can enter a number bigger than a googol ... I dunno... :o :o ]  After I did that, however, things quickly - for a lack of better words - went to .  Things were bugging out.  Myself, and anyone else who shared a partial match in name to the one I passed for the player name parameter kept getting slain even after I removed all the slays, even after some superadmins removed all the slays.  The owner reloaded everything - probably unnecessarily - and did some tweaking before it stopped.   Hehe.
« Last Edit: December 21, 2013, 10:29:48 am by travelsonic »

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Trouble in Terrorist Town Commands for ULX
« Reply #38 on: December 21, 2013, 09:55:26 am »
Why you can enter a number far, far larger than a googolplex ... I dunno... :o :o
I don't think you know how big a googolplex is...
http://en.wikipedia.org/wiki/Googolplex

Offline travelsonic

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Trouble in Terrorist Town Commands for ULX
« Reply #39 on: December 21, 2013, 10:24:07 am »
I don't think you know how big a googolplex is...
http://en.wikipedia.org/wiki/Googolplex

I don't think you know that a single brainfart a lack of knowledge on a number doth not make.  We all brainfart sometimes.  ;)

Fixed it to something more correct... the number you can enter is larger than a googol.... still, holy balls... why is it even possible to enter a number that big for slaynr?
« Last Edit: December 21, 2013, 10:39:21 am by travelsonic »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Trouble in Terrorist Town Commands for ULX
« Reply #40 on: December 21, 2013, 05:01:40 pm »
All, as has been stated several times before by both authors of this project, no new updates will be made to it due to time constraints and lack of interest.
If you want something fixed, do it yourself.

My first reaction to entering insane numbers is, If you don't have the common sense not to enter some insanely huge number that may or in this case may not be prevented, or trust someone with access
to the command not to, then you shouldn't have access to the command.

Sure..code checks could be done, it's not hard to set them in the ULX command object, but, again, the developers probably never thought you'd not have enough
common sense to know not to enter some number that would be remembered for eternity.

There's a reason slaynr has admin-only access by default.
Admins should be level-headed and have commom sense.

Seems in this case neither applied.

LOCKING TOPIC
The original authors may request it be opened when time permits.
New authors who pick the project up should start new thread, making sure to give credit and allowing for original authors to pick back up/work with as requested in previous threads.
It may also be moved to the release archives if no new interest is shown within a few months/years.
« Last Edit: December 21, 2013, 05:03:26 pm by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print