Advertisement
IntuitiveNZ

GMOD murder detection

Jul 25th, 2024
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | Source Code | 0 0
  1. @name Tangonun popo kodu
  2. @outputs X Y Z Pos
  3. @persist X Y Z Killerpos:vector N:number
  4.  
  5.  
  6. #ifdef entity:plySpawn()
  7.     #else
  8.         error("This server does not have plycore installed, which this needs to work.")
  9.     #endif
  10.  
  11.  
  12. if(first() | dupefinished()){
  13.     runOnDeath(1)
  14.     N = 0
  15.     Murdered = 0
  16.  
  17.  
  18. function funcDeathCheck() {
  19.  
  20.     local Murdered = lastDeathAttacker(owner())
  21.  
  22.     if (!Murdered) {
  23.         print("Died, but not murdered!")
  24.         return
  25.     }
  26.     if (Murdered) {
  27.         Killer = lastDeathAttacker(owner())
  28.         Killerpos = Killer:pos()
  29.         print("Murdered by: ", Killer)
  30.         N = 1
  31.        
  32.         X = Killerpos:x()
  33.         Y = Killerpos:y()
  34.         Z = Killerpos:z()  # 10 units above the ground surface
  35.  
  36.         print("DEBUG X: ", X)
  37.         print("DEBUG Y: ", Y)
  38.         print("DEBUG Z: ", Z)
  39.         print("DEBUG N: ", N)
  40.        
  41.         timer("resetdeathstate", 500)   # Trigger timer in 2 seconds from now, to reset N
  42.     }
  43. }  #END OF FUNCTION
  44.  
  45. }  #END OF FIRST
  46.  
  47.  
  48.  
  49. if(!owner():isAlive()){
  50.     funcDeathCheck()
  51. }
  52.  
  53. if(clk("resetdeathstate")){
  54.     N = 0
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement