Could you help me with this lua script?!

I’m trying to modify this Script For my DarkRP server so that it makes a player wanted when they kill someone the first 3 times, before arresting them:

This is what I have so far… Probably totally wrong… Don’t make fun… :frowning:


function CheckForRDM(victim, _, killer)

	victim:ConCommand("NLRDeathMessage") -- Run client msg function
	timer.Simple(20, function()
	if( !victim:Alive() ) then 
	victim:Spawn() 
	end
	end)

	if(victim:IsPlayer() && killer:IsPlayer()) then -- Check if they're both players (should be)
	
        if(!killer.LastKillTime) then killer.LastKillTime = CurTime() end -- Set Kill Time if not exist
        if(!killer.LastKillCount) then killer.LastKillCount = 0 end -- Set Kill counter if not exist
        if(!killer.LastKilled || killer.LastKilled != victim) then 
            killer.LastKilled = victim 
            killer.LastKillCount = 0
        end
			
       if (victim:SteamID() == killer:SteamID()) then return end -- is the same person
               
        if(killer.LastKillCount == 0 ) then killer.LastKillCount = 1 return end -- Check if its the first time the killer kills someone
                
		if(killer.LastKillTime < CurTime() - 30 && killer.LastKilled == victim) then
		
			if(killer.LastKillCount > 3 ) then -- If killer have killed less then 3 times then continue
		
            PrintMessage( HUD_PRINTTALK, (killer:Name().." had a warrent issued for Murder!"))
			game.ConsoleCommand("say /wanted "..killer:Name().." Murder!")
		-- Check if the killers last kill time was under 30 seconds
			
			else -- If killer have killed more then 4 times arrest the person
			
				PrintMessage( HUD_PRINTTALK, (killer:Name().." has been Arrested for Excessive Killing!")) -- Send text to all players chat!
                game.ConsoleCommand("rp_arrest "..killer:Name().." 160
")
                killer.LastKillCount = killer.LastKillCount + 1
				
            end
        
        end
    end   
end
hook.Add("PlayerDeath", "RdmCheck", CheckForRDM)

	timer.Simple(20, function()
			game.ConsoleCommand("rp_respawntime 60
") -- Set respawn time
	end)


I’m pretty sure this:


game.ConsoleCommand("say /wanted "..killer:Name().." Murder!")

is where im not sending the proper command to DarkRP…
The script does arrest properly, but will not warrant the player…
I’m sure this must be possible… what am I doing wrong?

Any help would be greatly appreciated…
Thanks!

Instead of that, you could try

[lua]
self:SetDarkRPVar(“wanted”, true)
killer.warranted = true
timer.Simple(GetConVarNumber(“searchtime”), UnWarrant, ply, killer)
for a, b in pairs(player.GetAll()) do
b:PrintMessage(HUD_PRINTCENTER, Killer:Nick()…“is wanted for excessive killing!”)
end
[/lua]

However, it may give a error because the UnWarrant function requires a player.