if player kill player with noclip get slay

i want a lua code, slay player when player kill other player using noclip



function SlayPlayerNoclip( ply, killer )
	if ply ~= killer then
		if killer:GetMoveType() == MOVETYPE_NOCLIP then
			ulx.slay
		end
	end
end
hook.Add( "PlayerDeath", "ulx_slay", SlayPlayerNoclip )


Thanks :stuck_out_tongue:

Your argument order is wrong; reference the wiki page: https://wiki.garrysmod.com/page/GM/PlayerDeath

Also, you don’t have to use ulx’s slay, you can just do ply:Kill(). Also, make sure to check if the killer is valid before checking their move type.

sorry but i don’t have idea how to make this .-.

This answers you. You’re doing ply, killer, but there is a second argument that is before the attacker.

So it should be ply, inflictor, killer.

thanks and sorry but i so newbie in lua, anybody can make the code for my .---------.

Learn it yourself, you’ll thank yourself for it.

I maked :smiley:




function PlayerKillNoclip(victim, attacker, dmginfo)
	if victim != attacker and attacker:IsPlayer() then
	 if ( attacker:GetMoveType() == MOVETYPE_NOCLIP ) then
		attacker:Kill()
		attacker:ChatPrint("Você foi morto por matar "..victim:Nick().."com o noclip ativado")
		else print("")
		 end	
	 end
 end
hook.Add("PlayerDeath", "PlayerKillNoclipfunc", PlayerKillNoclip)


:smiley: you are true