Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. script_name("moonmanager")
  2. script_description("lua scripts manager")
  3. script_version_number(1)
  4. script_authors("allah")
  5.  
  6.  
  7. function main()
  8. wait(0)
  9. sampfuncsRegisterConsoleCommand("ml.threads", command1)
  10. sampfuncsRegisterConsoleCommand("ml.unload", command2)
  11. sampfuncsRegisterConsoleCommand("ml.reload", command3)
  12. while true do
  13. wait(0)
  14. end
  15. end
  16.  
  17. function command2(param)
  18. local s = script.find(param)
  19. if s ~= nil then
  20. s:unload()
  21. sampfuncsLog(string.format("* script \'%s\' succesfully unloaded", param))
  22. --else sampfuncsLog(string.format("* script \'%s\' not found", param))
  23. end
  24.  
  25. param2 = param
  26. local l = script.list()
  27. for i, v in ipairs(l) do
  28. if tonumber(param) == i then
  29. v:unload()
  30. sampfuncsLog(string.format("* script \'%s\' succesfully unloaded", param2))
  31. end
  32. end
  33.  
  34. end
  35.  
  36. function command3(param)
  37. local s = script.find(param)
  38. if s ~= nil then
  39. s:reload()
  40. sampfuncsLog(string.format("* script \'%s\' succesfully reloaded", param))
  41. --else sampfuncsLog(string.format("* script \'%s\' not found", param))
  42. end
  43.  
  44. param2 = param
  45. local l = script.list()
  46. for i, v in ipairs(l) do
  47. if tonumber(param) == i then
  48. v:reload()
  49. sampfuncsLog(string.format("* script \'%s\' succesfully reloaded", param2))
  50. end
  51. end
  52.  
  53. end
  54.  
  55. function command1()
  56.  
  57. sampfuncsLog("id name filename description authors")
  58. local l = script.list()
  59. for i, v in pairs(l) do
  60. sampfuncsLog(string.format("%d %s %s %s %s", i, v.name, v.filename, v.description, table.concat(v.authors)))
  61. end
  62. --print(string.format("%s - %s", v.name, v.description))
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement