1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Auto wanted

Discussion in 'Modder General Chat' started by Ace0, Jan 24, 2015.

  1. Ace0

    Ace0 Member

    How can I make it so when a player attacks any Civil Protection, they become wanted?
     
  2. mindfulhacker

    mindfulhacker New Member

    This is very easy. If nobody beats me to it, I'll post the code for it in the morning.
     
  3. Matryan

    Matryan Well-Known Member

    Code (Text):
    hook.Add("PlayerHurt", "setattackerwanted", function(victim, attacker, health, damage)

        if not victim:isCP() then return end

        attacker:wanted(victim, "Attempted Murder")

    end)
    Throw that in addons\darkrpmodification-master\lua\darkrp_modules\autowanted\sv_autowanted.lua
     
  4. Ace0

    Ace0 Member

    It works, but each time they shoot me, they keep getting wanted on the top. Can you make so the first time they are shot, they only get wanted once?
     
  5. Matryan

    Matryan Well-Known Member

    Code (Text):
    hook.Add("PlayerHurt", "setattackerwanted", function(victim, attacker, health, damage)

        if not victim:isCP() or attacker:isWanted() then return end

        attacker:wanted(victim, "Attempted Murder")

    end)
     
  6. (FPtje) Atheos

    (FPtje) Atheos Main Developer Staff Member

    That'll probably lead to an "attempt to index `isWanted`, a nil value" error because the attacker is not always a player (think of prop kills).
    Code (Text):
    hook.Add("PlayerHurt", "setattackerwanted", function(victim, attacker, health, damage)

        if not victim:isCP() or not attacker:IsPlayer() or attacker:isWanted() then return end

        attacker:wanted(victim, "Attempted Murder")

    end)
    untested code.
     
  7. Matryan

    Matryan Well-Known Member

    I should really stop developing and ATTEMPTING TO help people at 2:00 in the morning....
     
  8. mindfulhacker

    mindfulhacker New Member

    Calm down.
     
  9. Matryan

    Matryan Well-Known Member

    I am calm...?
    If you are referring to my emphasis using capital letters, I am implying that I'm only attempting to help people, yet not actually helping.
     
  10. Ace0

    Ace0 Member

    Lol, did that guy start an argument? XD
     
  11. Matryan

    Matryan Well-Known Member

    I don't think so.
     
  12. (FPtje) Atheos

    (FPtje) Atheos Main Developer Staff Member

  13. Matryan

    Matryan Well-Known Member

  14. revoltinstyle_

    revoltinstyle_ New Member

    Sorry to revive an old thread, but whenever any CP in my server accidentally crashes a car, it says their wanted. By themselves. I'm currently using TDM Cars.
     

Share This Page