• Could you help me with this lua script?!
    1 replies, posted
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: [url]http://www.garrysmod.org/downloads/?a=view&id=119953[/url] This is what I have so far... Probably totally wrong... Don't make fun... :( [code]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\n") killer.LastKillCount = killer.LastKillCount + 1 end end end end hook.Add("PlayerDeath", "RdmCheck", CheckForRDM) timer.Simple(20, function() game.ConsoleCommand("rp_respawntime 60\n") -- Set respawn time end) [/code] I'm pretty sure this: [code]game.ConsoleCommand("say /wanted "..killer:Name().." Murder!")[/code] 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.
Sorry, you need to Log In to post a reply to this thread.