On Slay help

Hello people,

Pretty much I have a deathrun server, and I was wondering how I would make it if a user is on TEAM_DEATH and the user slays themselves, ONLY if they slay themselves, how I would get it to respawn them, because I don’t want it respawning if slayed by someone on TEAM_RUNNER, or slayed by someone else on the death team, how would I do this…?



	if TEAM == TEAM_DEATH and ... then
		v:Spawn()
	else
		return( false )
	end


I had an idea of it being something like this… (I’m not that great at coding, but I assumed it would be SOMETHING like this…) I’m sure this is completely incorrect way of starting out, but I was wondering if someone can point me in the right direction of this… thanks

Why not just block suiciding?

Suiciding is blocked, but slaying bypasses it.

Why do you allow users to slay themselves/others? Isn’t that just suicide?

I don’t allow them to slay themselves, but I have some admins that tend to anyways, And I believe it is just suicide, but it still doesn’t stop them, because deathrun automatically stops deaths from typing explode in console, which it stops, but slaying doesn’t.

In the slay command, just put something like


if SlayTarget == Slayer then return end

It seems to disallow me to actually slay anyone now… help would be appreciated… thanks

What is the exact code you used?



function ulx.slay( calling_ply, target_plys )
	local affected_plys = {}
	
	if SlayTarget == Slayer then return end

	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 not v:Alive() then
			ULib.tsayError( calling_ply, v:Nick() .. " is already dead!", true )
		elseif v:IsFrozen() then
			ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
		else
			v:Kill()
			table.insert( affected_plys, v )
		end
	end

	ulx.fancyLogAdmin( calling_ply, "#A slayed #T", affected_plys )
end
local slay = ulx.command( CATEGORY_NAME, "ulx slay", ulx.slay, "!slay" )
slay:addParam{ type=ULib.cmds.PlayersArg }
slay:defaultAccess( ULib.ACCESS_ADMIN )
slay:help( "Slays target(s)." )


Is what it looks like atm.

so you want them to not beable to slay the TEAM_DEATH?

I want the person to not be able to slay themselves, if you take a look at this
if SlayTarget == Slayer then return end

Uh, those variables don’t exist. They were just examples.

oh… my bad LOL, such a stupid thing I did, sorry, let me go fix it.

Why would you want them not to slay them selfs?

So I got something like this
if target_ply == v then return end
But for V, what would I set? I tried LocalPlayer(), ply, v, none of them seem to work.

Uh, might it be a better idea to just speak to the admins doing it as opposed to trying awkward ULX work arounds?

[lua]
elseif v == calling_ply then
ULib.tsayError( calling_ply, v:Nick() … " attempted to slay themself", true )
[/lua]

Add that to the conditional statment

Nah, that involves an element of trust! Because obviously you get admins you dont trust, riiiiiight?