Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. -- ****************************************************************************
  2. --
  3. -- RECURSO: MJ-Core
  4. -- ARCHIVO: servidor/main.lua
  5. -- PROPOSITO: Funcionamiento del recurso por parte del servidor
  6. -- CREADORES: Tomas Andres Navarro < GamerCarl >
  7. --
  8. -- ****************************************************************************
  9. local rroot = getResourceRootElement()
  10. main = {}
  11. main.modulos = { 'MJ-Niveles', 'MJ-System', 'MJ-VIP', 'MJ-Grupos', 'C-BUG', 'scoreboard', 'mapmanager', 'votemanager', 'MTAUtil' } --Tabla de recursos
  12.  
  13.  
  14. -- Inicio de recurso
  15. function main.inicio ()
  16. -- Se cierran todas las cuentas
  17. for k,v in ipairs(getElementsByType('player')) do
  18. logOut(v)
  19. end
  20.  
  21. outputDebugString('[MJ] Iniciando Recursos...')
  22. -- Iniciamos los recursos planteados en la tabla
  23. for k,v in ipairs ( main.modulos ) do
  24. local rec = getResourceFromName ( v )
  25. if rec then
  26. startResource ( rec )
  27. else
  28. --Si un script no puede iniciar se le informara a la consola u debugscript
  29. outputDebugString('[MJ] No se pudo iniciar ' .. v)
  30. end
  31. end
  32.  
  33. -- Confirmamos que los scripts del servidor cargaron correctamente
  34. outputDebugString('[MJ] Modo iniciado satisfactoriamente.')
  35. end
  36. addEventHandler('onResourceStart', resourceRoot, main.inicio, false)
  37.  
  38. -- Detención del recurso
  39. function main.detener ()
  40. --Detiene los recursos de la tabla al detener el core
  41. for k,v in ipairs ( main.modulos ) do
  42. local rec = getResourceFromName ( v )
  43. if rec then
  44. stopResource ( rec )
  45. end
  46. end
  47. end
  48.  
  49. addEventHandler("onResourceStart", rroot, function()
  50. setMapName("Los Santos") -- Se cambia el mapa que se muestre en el buscador de servidores
  51. setTimer(function()
  52. setGameType("Mini Juegos v"..getResourceInfo(getThisResource(), "version"))
  53. end, 2000, 1)
  54. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement