Advertisement
Guest User

ULX Murder

a guest
Dec 18th, 2014
867
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 KB | None | 0 0
  1. //Murder ULX Commands
  2. //Made by ZombieWizzard
  3.  
  4. //Update checker
  5. mulxrepo = "https://raw.github.com/zombiewizzard/murder-ulx-commands/master/data/version-number.txt"
  6. mulxcurversion = 0
  7. mulxnewversion = 0
  8. mulxcheckfailed = false
  9. function UpdateChecker()
  10. if ( file.Exists( "data/version-number.txt", "GAME" ) ) then
  11. mulxcurversion = tonumber( file.Read( "data/version-number.txt", "GAME" ))
  12. end
  13. http.Fetch( mulxrepo,
  14. function( content ) //Succeeded
  15. mulxnewversion = tonumber( content )
  16. end,
  17. function( failCode ) //Failed
  18. if SERVER then //Only logs in server console
  19. print ( "Murder module failed to check for updates" )
  20. print ( mulxrepo, " returned ", failCode )
  21. end
  22. mulxcheckfailed = true
  23. end
  24. )
  25.  
  26. timer.Simple( 5, function()
  27. if mulxcurversion < mulxnewversion and !mulxcheckfailed then
  28. if SERVER then
  29. print( "Murder module update available" )
  30. print( "You are using version ", mulxcurversion )
  31. print( "The latest version is ", mulxnewversion )
  32. end
  33. mulxoutdated = true
  34. elseif !mulxcheckfailed then
  35. if SERVER then
  36. print( "Murder module is up to date" )
  37. print( "You are using version ", mulxcurversion )
  38. end
  39. mulxoutdated = false
  40. end
  41. end )
  42. end
  43.  
  44. UpdateChecker()
  45.  
  46. if CLIENT then
  47. timer.Simple( 10, function() include( "cl_updatenotify.lua" ) end )
  48. end
  49.  
  50. local CATEGORY_NAME = "Murder"
  51.  
  52. //!Murder - Opens the murder administration panel
  53. function ulx.murder( calling_ply )
  54. calling_ply:ConCommand( "mu_adminpanel" ) //Using built in command on caller so it shows the panel to them
  55. end
  56.  
  57. local murder = ulx.command( CATEGORY_NAME, "ulx murder", ulx.murder, "!murder" )
  58. murder:defaultAccess( ULib.ACCESS_ADMIN )
  59. murder:help( "Opens the murder administration panel." )
  60.  
  61. //!FSpec and !UnSpec - Forces the target(s) to/from spectator
  62. function ulx.murderspec( calling_ply, target_plys, should_unspec )
  63. for i=1, #target_plys do
  64. local v = target_plys[ i ]
  65.  
  66. if should_unspec then
  67. v:SetTeam( 2 ) //Player
  68. else
  69. v:SetTeam( 1 ) //Spectator
  70. v:Kill() //Kills them just to make sure it works
  71. end
  72. end
  73. if should_unspec then
  74. ulx.fancyLogAdmin( calling_ply, "#A has forced #T to play!", target_plys )
  75. else
  76. ulx.fancyLogAdmin( calling_ply, "#A has forced #T to spectate!", target_plys )
  77. end
  78. end
  79.  
  80. local murderspec = ulx.command( CATEGORY_NAME, "ulx fspec", ulx.murderspec, "!fspec" )
  81. murderspec:addParam{ type=ULib.cmds.PlayersArg }
  82. murderspec:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  83. murderspec:defaultAccess( ULib.ACCESS_ADMIN )
  84. murderspec:help( "Forces the target(s) to/from spectator." )
  85. murderspec:setOpposite( "ulx unspec", {_, _, true}, "!unspec" )
  86.  
  87. //!FNextMurderer - Forces target to be murderer next round
  88. function ulx.fnextmurderer( calling_ply, target_ply )
  89. RunConsoleCommand( "mu_forcenextmurderer", target_ply:EntIndex() ) //Runs built in command on server console
  90.  
  91. ulx.fancyLogAdmin( calling_ply, true, "#A has forced #T to be murderer next round!", target_ply )
  92. end
  93.  
  94. local fnextmurderer = ulx.command ( CATEGORY_NAME, "ulx fnextmurderer", ulx.fnextmurderer, "!fnextmurderer" )
  95. fnextmurderer:addParam{ type=ULib.cmds.PlayerArg }
  96. fnextmurderer:defaultAccess( ULib.ACCESS_SUPERADMIN )
  97. fnextmurderer:help( "Forces target to be murderer next round." )
  98.  
  99. //!AddLoot - Adds a spawn for loot where you are looking
  100. function ulx.addloot( calling_ply, model )
  101. calling_ply:ConCommand( "mu_loot_add " .. model ) //Based on !rcon to parse the model variable through
  102. //Has to be run on callers console to grab where they are looking
  103. ulx.fancyLogAdmin( calling_ply, true, "#A has added loot with the model #s where they were looking!", model )
  104. end
  105.  
  106. local addloot = ulx.command ( CATEGORY_NAME, "ulx addloot", ulx.addloot, "!addloot" )
  107. addloot:addParam{ type=ULib.cmds.StringArg, hint="model", ULib.cmds.takeRestOfLine }
  108. addloot:defaultAccess( ULib.ACCESS_SUPERADMIN )
  109. addloot:help( "Adds a spawn for loot where you are looking. Use '!ModelList' to find out the model name aliases." )
  110.  
  111. //!LootList - Prints list of loot spawns in your chat
  112. function ulx.lootlist( calling_ply )
  113. calling_ply:ConCommand( "mu_loot_list" ) //Runs on caller so it doesn't print it in server console
  114. end
  115.  
  116. local lootlist = ulx.command ( CATEGORY_NAME, "ulx lootlist", ulx.lootlist, "!lootlist" )
  117. lootlist:defaultAccess( ULib.ACCESS_SUPERADMIN )
  118. lootlist:help( "Prints list of loot spawns in your chat." )
  119.  
  120. //!LootRemove - Removes the loot spawn with the id you provide
  121. function ulx.lootremove( calling_ply, id )
  122. RunConsoleCommand( "mu_loot_remove " .. id ) //Based on !rcon again
  123.  
  124. ulx.fancyLogAdmin( calling_ply, true, "#A has removed the loot spawn with the id #s!", id )
  125. end
  126.  
  127. local lootremove = ulx.command ( CATEGORY_NAME, "ulx lootremove", ulx.lootremove, "!lootremove" )
  128. lootremove:addParam{ type=ULib.cmds.StringArg, hint="id", ULib.cmds.takeRestOfLine }
  129. lootremove:defaultAccess( ULib.ACCESS_SUPERADMIN )
  130. lootremove:help( "Removes the loot spawn with the id you provide." )
  131.  
  132. //!LootRespawn - Respawns all of the loot
  133. function ulx.lootrespawn( calling_ply )
  134. RunConsoleCommand( "mu_loot_respawn" ) //Self explanatory
  135.  
  136. ulx.fancyLogAdmin( calling_ply, true, "#A respawned all of the loot!", target_plys )
  137. end
  138.  
  139. local lootrespawn = ulx.command ( CATEGORY_NAME, "ulx lootrespawn", ulx.lootrespawn, "!lootrespawn" )
  140. lootrespawn:defaultAccess( ULib.ACCESS_SUPERADMIN )
  141. lootrespawn:help( "Respawns all of the loot." )
  142.  
  143. //!ModelList - Lists the names to use for models on !AddLoot in your chat
  144. function ulx.modellist( calling_ply )
  145. calling_ply:ConCommand( "mu_loot_models_list" ) //Runs on callers console so it doesn't print in server console
  146. end
  147.  
  148. local modellist = ulx.command ( CATEGORY_NAME, "ulx modellist", ulx.modellist, "!modellist" )
  149. modellist:defaultAccess( ULib.ACCESS_SUPERADMIN )
  150. modellist:help( "Lists the names to use for models on !AddLoot in your chat." )
  151.  
  152. //!Respawn - Respawns target(s)
  153. function ulx.respawn( calling_ply, target_plys )
  154. for i=1, #target_plys do
  155. local v = target_plys[ i ]
  156. v:SetTeam( 2 ) //Makes sure they aren't a spectator
  157. v:Spawn() //Spawns them in
  158. end
  159.  
  160. ulx.fancyLogAdmin( calling_ply, true, "#A respawned #T!", target_plys )
  161. end
  162.  
  163. local respawn = ulx.command ( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn" )
  164. respawn:addParam{ type=ULib.cmds.PlayersArg }
  165. respawn:defaultAccess( ULib.ACCESS_SUPERADMIN )
  166. respawn:help( "Respawns target(s.)" )
  167.  
  168. //!FTaunt - Forces target to taunt
  169. ulx.taunts={} //Creates taunts table
  170. ulx.taunts[1]="scream"
  171. ulx.taunts[2]="help"
  172. ulx.taunts[3]="funny"
  173. ulx.taunts[4]="morose"
  174.  
  175. function ulx.ftaunt( calling_ply, target_ply, taunt_type )
  176. target_ply:ConCommand( "mu_taunt " .. taunt_type ) //Runs the taunt command on target
  177.  
  178. ulx.fancyLogAdmin( calling_ply, "#A forced #T to use a #t taunt!", target_ply, taunt_type )
  179. end
  180.  
  181. local ftaunt = ulx.command ( CATEGORY_NAME, "ulx ftaunt", ulx.ftaunt, "!ftaunt" )
  182. ftaunt:addParam{ type=ULib.cmds.PlayerArg }
  183. ftaunt:addParam{ type=ULib.cmds.StringArg, completes=ulx.taunts, hint="taunt type", error="invalid taunt type \"%s\" specified", ULib.cmds.restrictToCompletes, default="scream", ULib.cmds.optional }
  184. ftaunt:defaultAccess( ULib.ACCESS_ADMIN )
  185. ftaunt:help( "Forces target to taunt." )
  186.  
  187. //!ShowMurderer - Reveals the murderer's evil presence until he kills someone
  188. function ulx.showmurderer( calling_ply )
  189. local players = team.GetPlayers(2)
  190. local murderer
  191. for k,v in pairs( players ) do
  192. if v:GetMurderer() then
  193. murderer = v
  194. end
  195. end
  196. if murderer && !murderer:GetMurdererRevealed() then
  197. murderer:SetMurdererRevealed(true)
  198. end
  199. end
  200.  
  201. local showmurderer = ulx.command ( CATEGORY_NAME, "ulx showmurderer", ulx.showmurderer, "!showmurderer" )
  202. showmurderer:defaultAccess( ULib.ACCESS_ADMIN )
  203. showmurderer:help( "Reveals the murderer's evil presence until he kills someone." )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement