Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Target_lease_Lib
- @persist [Table]:gtable [IP]:string [Trace_weapon]:entity [Trace_intercept, Trace_position, Trace_velocity]:vector [Kalman_array]:array
- @trigger
- runOnChat(1)
- if(first() || duped() || dupefinished()){
- function vector kalman(Input:vector, Array:array, Val:number){
- local Iterations = 3
- local Velocity = vec()
- for(I=1, Iterations-1){Velocity += Array:vector(I)-Array:vector(I+1)}
- Velocity /= Iterations-1
- local Predicted_Position = Input*Val+(Array:vector(1)-Velocity)*(1-Val)
- for(I=1, Iterations-1){Array[I+1, vector] = Array:vector(I)}
- Array[1, vector] = Input
- Array:remove(Iterations+1)
- return Predicted_Position
- }
- }
- if(chatClk(owner())){
- local Task = lastSaid():explode(" ")
- if(Task[1, string] == "/ip"){
- IP = Task[2, string], print("IP set to:["+Task[2, string]+"]")
- gSetGroup(IP)
- gSetEnt(6, Trace_weapon)
- hideChat(1)
- }
- elseif(Task[1, string] == "/help"){
- print("Track and Trace:")
- print("Set IP[/ip]")
- hideChat(1)
- }
- }
- Trace_position = gGetVec(3)
- Trace_velocity = gGetVec(4)
- Trace_intercept = kalman(gGetVec(5), Kalman_array, 0.4)
- #define Trace_weapon as your weapon entity its for the range table of the tracker
- #define every update with the use of gSetVec(7, vector) your guns position
- #retrieve intercept data from the variable Trace_intercept
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement