Guest User

Untitled

a guest
Jan 21st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. @name Thingy
  2. @persist [E Target]:entity
  3. @trigger
  4. if (first()) {
  5. #Starting stuff
  6. E = entity():isWeldedTo() #isWeldedTo will make the e2 apply the force to the prop it is welded to instead of the e2 itself.
  7. runOnTick(1)
  8. runOnChat(1)
  9. }
  10. #If you said something..
  11. if (chatClk(owner())) {
  12. #Explode for easier use
  13. M = lastSaid():explode(" ")
  14. #Attack:
  15. if (M:string(1) == "/target") {
  16. hideChat(1) #Hide chat message
  17. Target = findPlayerByName(M:string(2)) #Attempt to find the player
  18. if (Target) { #If found..
  19. print("Attacking " + Target:name())
  20. } else { #If not found..
  21. print("No player named '" + M:string(2) + "' found.")
  22. }
  23. #Stop attacking:
  24. } elseif (M:string(1) == "/off") {
  25. hideChat(1) #Hide chat message
  26. print("Stopped attacking " + Target:name()) #Notify
  27. Target = noentity() #Set Target to nil
  28. }
  29. } elseif (tickClk() & Target) { #If current execution was caused by runOnTick() and if Target is a valid entity, apply force.
  30. E:applyForce(((Target:pos()+vec(0,0,45)-E:massCenter())*10-E:vel())*E:mass())
  31. }
Add Comment
Please, Sign In to add comment