Author Topic: SlayQ  (Read 2195 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarado

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
SlayQ
« on: June 01, 2014, 01:38:14 PM »
Heya,

So I'm trying to modify ULX's default "slay" command so that instead you add the player you want slayed into a queue and when the round next starts, the SlayQ automatically slays said player without the Admin needing to manually slay the player themselves.

Now this works perfectly fine, the player dies at Round start and no errors pop up but when I try to add a text for the SlayQ to say after someone is slain the console gives me an error.
Here is the Section for the SlayQ script:
Code: [Select]
------------------------------ SlayQ ------------------------------
function ulx.slay( calling_ply, target_plys )
local affected_plys = {}

for i=1, #target_plys do
local v = target_plys[ i ]

if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
else
hook.Add("TTTBeginRound", "Kill SlayQ", function()
v:Kill()
table.insert( affected_plys, v )
player.PrintMessage( HUD_PRINTTALK, v .. " was slain by SlayQ for RDM") -- The bit that says the message
end)
end
end

end
local slay = ulx.command( CATEGORY_NAME, "ulx slayq", ulx.slay, "!slayq" )
slay:addParam{ type=ULib.cmds.PlayersArg }
slay:defaultAccess( ULib.ACCESS_ADMIN )
slay:help( "Adds Target to slay queue." )

And this is the console error:

Code: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/fun.lua:114: attempt to concatenate upvalue 'v' (a userdata value)
1. fn - addons/ulx/lua/ulx/modules/sh/fun.lua:114
2. Call - addons/ulib/lua/ulib/shared/hook.lua:183
3. unknown - gamemodes/terrortown/gamemode/init.lua:671

Thanks,
Tarado

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given