ASSmod Maul Addon

Hi Guys.

I have a Maul Addon for the popular admin program ASSmod. Just wondering if someone could take a look at the code and help me with a little problem, as I am by no means an Lua wizard.

The problem is simple, as you will probably notice if you are familiar with coding:

If the NPC dies 1st, i.e. another player comes and kills it, The mauled subject remains frozen.

Just wondering if somebody could edit the code and post it back, to make it so that aswell as what already happens, if the NPC dies 1st, the mauled subject is unfrozen and can continue playing as he/she was.

Thanks guys: here is the code:

[ lua ]
local PLUGIN = {}

PLUGIN.Name = “Maul” // plugin name
PLUGIN.Author = “Legitcobra” // author
PLUGIN.Date = “January 31, 2008” // date of creation / modification
PLUGIN.Filename = PLUGIN_FILENAME // filename of the plugin
PLUGIN.ClientSide = true // allow to be loaded clientside
PLUGIN.ServerSide = true // allow to be loaded serverside
PLUGIN.APIVersion = 2
PLUGIN.Gamemodes = {} // list of gamemodes that this plugin can be used with. If this
// is empty, all gamemodes are allowed.

if (SERVER) then

ASS_NewLogLevel("ASS_ACL_MAUL")

function PLUGIN.MaulPlayer( PLAYER, CMD, ARGS )

	if (PLAYER:IsTempAdmin()) then

		local TO_MAUL = ASS_FindPlayer(ARGS[1])

		if (!TO_MAUL) then

			ASS_MessagePlayer(PLAYER, "Player not found!

")
return

		end
		
		if (TO_MAUL != PLAYER) then
			if (TO_MAUL:IsBetterOrSame(PLAYER)) then

				ASS_MessagePlayer(PLAYER, "Access denied! \"" .. TO_MAUL:Nick() .. "\" has same or better access then you.")
				return
			end
		end
		
		if (ASS_RunPluginFunction( "AllowPlayerKill", true, PLAYER, TO_MAUL )) then

			TO_MAUL:Freeze(true)
			local NPC = ents.Create("npc_fastzombie")
		
			// Spawn
		
			NPC:SetPos(TO_MAUL:GetPos() + Vector(-100, -32, 0))
			NPC:Spawn()
			NPC:Activate()
			
			local function playerDies()
				NPC:Remove()
				TO_MAUL:Freeze(false)
			end
			hook.Add( "PlayerDeath", "playerDeathTest", playerDies );

			ASS_LogAction( PLAYER, ASS_ACL_MAUL, "mauled " .. ASS_FullNick(TO_MAUL) )
				
		end


	else

		ASS_MessagePlayer( PLAYER, "Access Denied!

")

	end

end
concommand.Add("ASS_MaulPlayer", PLUGIN.MaulPlayer)

end

if (CLIENT) then

function PLUGIN.MaulPlayer(PLAYER)
	
	RunConsoleCommand( "ASS_MaulPlayer", PLAYER:UniqueID() )
	return true

end

function PLUGIN.AddMenu(DMENU)			

	
	DMENU:AddSubMenu( "Maul" , nil, function(NEWMENU) ASS_PlayerMenu( NEWMENU, {"IncludeLocalPlayer"}, PLUGIN.MaulPlayer  ) end )

end

end

ASS_RegisterPlugin(PLUGIN)
[/ lua]

What’s with the fucked up Lua tags?

He added spaces to the tags.

Oops! Sorry guys, hopefully this should work a little better ;D

[ lua ]local PLUGIN = {}

PLUGIN.Name = “Maul” // plugin name
PLUGIN.Author = “Legitcobra” // author
PLUGIN.Date = “January 31, 2008” // date of creation / modification
PLUGIN.Filename = PLUGIN_FILENAME // filename of the plugin
PLUGIN.ClientSide = true // allow to be loaded clientside
PLUGIN.ServerSide = true // allow to be loaded serverside
PLUGIN.APIVersion = 2
PLUGIN.Gamemodes = {} // list of gamemodes that this plugin can be used with. If this
// is empty, all gamemodes are allowed.

if (SERVER) then

ASS_NewLogLevel(“ASS_ACL_MAUL”)

function PLUGIN.MaulPlayer( PLAYER, CMD, ARGS )

if (PLAYER:IsTempAdmin()) then

local TO_MAUL = ASS_FindPlayer(ARGS[1])

if (!TO_MAUL) then

ASS_MessagePlayer(PLAYER, "Player not found!
")
return

end

if (TO_MAUL != PLAYER) then
if (TO_MAUL:IsBetterOrSame(PLAYER)) then

ASS_MessagePlayer(PLAYER, “Access denied! “” … TO_MAUL:Nick() … “” has same or better access then you.”)
return
end
end

if (ASS_RunPluginFunction( “AllowPlayerKill”, true, PLAYER, TO_MAUL )) then

TO_MAUL:Freeze(true)
local NPC = ents.Create(“npc_fastzombie”)

// Spawn

NPC:SetPos(TO_MAUL:GetPos() + Vector(-100, -32, 0))
NPC:Spawn()
NPC:Activate()

local function playerDies()
NPC:Remove()
TO_MAUL:Freeze(false)
end
hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies );

ASS_LogAction( PLAYER, ASS_ACL_MAUL, "mauled " … ASS_FullNick(TO_MAUL) )

end

else

ASS_MessagePlayer( PLAYER, "Access Denied!
")

end

end
concommand.Add(“ASS_MaulPlayer”, PLUGIN.MaulPlayer)

end

if (CLIENT) then

function PLUGIN.MaulPlayer(PLAYER)

RunConsoleCommand( “ASS_MaulPlayer”, PLAYER:UniqueID() )
return true

end

function PLUGIN.AddMenu(DMENU)

DMENU:AddSubMenu( “Maul” , nil, function(NEWMENU) ASS_PlayerMenu( NEWMENU, {“IncludeLocalPlayer”}, PLUGIN.MaulPlayer ) end )

end

end

ASS_RegisterPlugin(PLUGIN)[/ lua]

Get rid of any spaces in the lua tags.

do it like this:


[*lua]Insert Code Here[/lua]

Just remove the *

[editline]07:32PM[/editline]

And this is the unedited code:

[lua]local PLUGIN = {}

PLUGIN.Name = “Maul” // plugin name
PLUGIN.Author = “Legitcobra” // author
PLUGIN.Date = “January 31, 2008” // date of creation / modification
PLUGIN.Filename = PLUGIN_FILENAME // filename of the plugin
PLUGIN.ClientSide = true // allow to be loaded clientside
PLUGIN.ServerSide = true // allow to be loaded serverside
PLUGIN.APIVersion = 2
PLUGIN.Gamemodes = {} // list of gamemodes that this plugin can be used with. If this
// is empty, all gamemodes are allowed.

if (SERVER) then

ASS_NewLogLevel(“ASS_ACL_MAUL”)

function PLUGIN.MaulPlayer( PLAYER, CMD, ARGS )

if (PLAYER:IsTempAdmin()) then

local TO_MAUL = ASS_FindPlayer(ARGS[1])

if (!TO_MAUL) then

ASS_MessagePlayer(PLAYER, "Player not found!
")
return

end

if (TO_MAUL != PLAYER) then
if (TO_MAUL:IsBetterOrSame(PLAYER)) then

ASS_MessagePlayer(PLAYER, “Access denied! “” … TO_MAUL:Nick() … “” has same or better access then you.”)
return
end
end

if (ASS_RunPluginFunction( “AllowPlayerKill”, true, PLAYER, TO_MAUL )) then

TO_MAUL:Freeze(true)
local NPC = ents.Create(“npc_fastzombie”)

// Spawn

NPC:SetPos(TO_MAUL:GetPos() + Vector(-100, -32, 0))
NPC:Spawn()
NPC:Activate()

local function playerDies()
NPC:Remove()
TO_MAUL:Freeze(false)
end
hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies );

ASS_LogAction( PLAYER, ASS_ACL_MAUL, "mauled " … ASS_FullNick(TO_MAUL) )

end

else

ASS_MessagePlayer( PLAYER, "Access Denied!
")

end

end
concommand.Add(“ASS_MaulPlayer”, PLUGIN.MaulPlayer)

end

if (CLIENT) then

function PLUGIN.MaulPlayer(PLAYER)

RunConsoleCommand( “ASS_MaulPlayer”, PLAYER:UniqueID() )
return true

end

function PLUGIN.AddMenu(DMENU)

DMENU:AddSubMenu( “Maul” , nil, function(NEWMENU) ASS_PlayerMenu( NEWMENU, {“IncludeLocalPlayer”}, PLUGIN.MaulPlayer ) end )

end

end

ASS_RegisterPlugin(PLUGIN)[/lua]