Advertisement
Guest User

Untitled

a guest
May 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. local ply = LocalPlayer()
  2. function GM:OnNPCKilled(victim, ent, weapon)
  3.     -- If something killed the npc
  4.     if not ent then return end
  5.  
  6.     if ent:IsVehicle() and ent:GetDriver():IsPlayer() then ent = ent:GetDriver() end
  7.  
  8.     -- If it wasn't a player directly, find out who owns the prop that did the killing
  9.     if not ent:IsPlayer() then
  10.         ent = Player(tonumber(ent.SID) or 0)
  11.     end
  12.  
  13.     -- If we know by now who killed the NPC, pay them.
  14.     if ply:Team() == TEAM_HUNTER then
  15.         if IsValid(ent) and GAMEMODE.Config.npckillpay > 0 then
  16.             ent:addMoney(GAMEMODE.Config.npckillpay)
  17.             DarkRP.notify(ent, 0, 4, DarkRP.getPhrase("npc_killpay", DarkRP.formatMoney(GAMEMODE.Config.npckillpay)))
  18.         end
  19.     end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement