Advertisement
Guest User

Flight v3 by Frankke

a guest
Dec 8th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. admins={Redninn=true, Toxigi=true, Infinityonhannah=false, Frankke=true, Moyasune=true}
  2. flyers={Frankke=true}
  3. spacers={Moyasune=true}
  4. -- don't forget commas and spaces
  5.  
  6. commands={"admin","fly","space","unfly","unspace","unadmin","kill"}
  7. for i=1,#commands,1 do
  8. system.disableChatCommandDisplay (commands[i],true)
  9. end
  10.  
  11. -- system.disableChatCommandDisplay ("admin",true)
  12. -- system.disableChatCommandDisplay ("unadmin",true)
  13. -- system.disableChatCommandDisplay ("kill",true)
  14. -- hide the commands comment in case the above doesn't work :P
  15.  
  16. function eventChatCommand(name,command)
  17. if string.sub(command,0,5)=="admin" and admins[name] then
  18. message=string.sub(command,7)
  19. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  20.     for k,v in pairs(tfm.get.room.playerList) do
  21.     if message==k then
  22. admins[message]=true
  23. print("congrats "..message.." is now an admin")
  24. end
  25. end
  26. end
  27. if string.sub(command,0,7)=="unspace" and admins[name] then
  28. message=string.sub(command,9)
  29. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  30. spacers[name]=false
  31. print(message.." can no longer fly with space")
  32. end
  33. if string.sub(command,0,5)=="unfly" and admins[name] then
  34. message=string.sub(command,7)
  35. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  36. flyers[name]=false
  37. tfm.exec.bindKeyboard(message,38,true,true)
  38. print(message.." can no longer fly with up")
  39. end
  40. if string.sub(command,0,3)=="fly" and admins[name] then
  41. message=string.sub(command,5)
  42. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  43. flyers[name]=true
  44. tfm.exec.bindKeyboard(message,38,true,true)
  45. print(message.." can now fly with up")
  46. end
  47. if string.sub(command,0,5)=="space" and admins[name] then
  48. message=string.sub(command,7)
  49. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  50. spacers[name]=true
  51. tfm.exec.bindKeyboard(message,32,true,true)
  52. print(message.." can now fly with space")
  53. end
  54. if string.sub(command,0,7)=="unadmin" and admins[name] then
  55. message=string.sub(command,9)
  56. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  57.     for k,v in pairs(tfm.get.room.playerList) do
  58.     if message==k then
  59. admins[message]=false
  60. print("Too bad "..message.." is no longer an admin")
  61. end
  62. end
  63. end
  64. if string.sub(command,0,4)=="kill" and admins[name] then
  65. message=string.sub(command,6)
  66. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  67. tfm.exec.killPlayer(message)
  68. end
  69. end
  70. function eventNewPlayer(name)
  71. if flyers[name] then
  72. tfm.exec.bindKeyboard(name,38,true,true)
  73. if spacers[name] then
  74. tfm.exec.bindKeyboard(name,32,true,true)
  75. end
  76. end
  77. end
  78. for name,player in pairs(tfm.get.room.playerList) do
  79. eventNewPlayer(name)
  80. end
  81.  
  82. function eventKeyboard(name,key,down,x,y)
  83. if key==38 and flyers[name] then
  84. tfm.exec.movePlayer(name,0,0,true,0,-50,false)
  85. end
  86. if key==32 and spacers[name] then
  87. tfm.exec.movePlayer(name,0,0,true,0,-50,false)
  88. end
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement