daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Target_lease_Lib
  2. @persist [Table]:gtable [IP]:string [Trace_weapon]:entity [Trace_intercept, Trace_position, Trace_velocity]:vector [Kalman_array]:array
  3. @trigger
  4.  
  5. runOnChat(1)
  6.  
  7. if(first() || duped() || dupefinished()){
  8.     function vector kalman(Input:vector, Array:array, Val:number){
  9.         local Iterations = 3
  10.         local Velocity = vec()
  11.         for(I=1, Iterations-1){Velocity += Array:vector(I)-Array:vector(I+1)}
  12.         Velocity /= Iterations-1
  13.         local Predicted_Position = Input*Val+(Array:vector(1)-Velocity)*(1-Val)
  14.         for(I=1, Iterations-1){Array[I+1, vector] = Array:vector(I)}
  15.         Array[1, vector] = Input
  16.         Array:remove(Iterations+1)
  17.         return Predicted_Position
  18.     }
  19. }
  20.  
  21. if(chatClk(owner())){
  22.     local Task = lastSaid():explode(" ")
  23.     if(Task[1, string] == "/ip"){
  24.         IP = Task[2, string], print("IP set to:["+Task[2, string]+"]")
  25.         gSetGroup(IP)
  26.         gSetEnt(6, Trace_weapon)
  27.         hideChat(1)
  28.     }
  29.     elseif(Task[1, string] == "/help"){
  30.         print("Track and Trace:")
  31.         print("Set IP[/ip]")
  32.         hideChat(1)
  33.     }
  34. }
  35.  
  36. Trace_position = gGetVec(3)
  37. Trace_velocity = gGetVec(4)
  38. Trace_intercept = kalman(gGetVec(5), Kalman_array, 0.4)
  39.  
  40. #define Trace_weapon as your weapon entity its for the range table of the tracker
  41. #define every update with the use of gSetVec(7, vector) your guns position
  42. #retrieve intercept data from the variable Trace_intercept
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top