Rafa23Alzira Posted February 26, 2015 Report Share Posted February 26, 2015 Hola chicos, os traigo un sencillo sistema de noticias que serán más cómodas para el usuario y para el staff. Este sistema lee las noticias a traves de un txt y si el usuario aún no lo ha leído le manda un mp con información. Una de las ventajas de este sistema es que no hace falta ningún tipo de reload o /e, ya que lee el qf a través de un txt y solo ejecuta la función si el qf del jugador es menor. Empezamos Abrimos game.py: Debajo de "mall" ponemos "open_notice_info" : self.__open_notice_info, "write_notice_info" : self.__write_notice_info, Luego buscamos __InGameShop_Show(self,url): y bajo de ese def ponemos def __open_notice_info(self): self.interface.RegisterGameMasterName("<--System-->") self.interface.RecvWhisper("<--System-->") def __write_notice_info(self,text): chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, "<--System-->", text.replace("_", " ")) Debe quedar así: Vamos ahora a la parte quest Cogemos esta quest quest noticias begin state start begin function read_notice_line(l) return readline("/quest/system/noticias/noticias.txt", l) end when login begin local qf = readline("/quest/system/noticias/qf.txt", 1) local lineas = 0 if tonumber(qf) > pc.getqf("noticias_ver") then for line in io.lines("/quest/system/noticias/noticias.txt") do lineas = lineas + 1 end cmdchat("open_notice_info") for i = 1,lineas do cmdchat("write_notice_info "..string.gsub(noticias.read_notice_line(i), ' ', '_')) end pc.setqf("noticias_ver", qf) end end end end Y creamos un fichero en nuestra carpeta quest llamado noticias.quest, dentro metemos la quest, guardamos y cerramos. Ahora creamos una carpeta en quest llamada System, y dentro de ella otra llamada noticias. En esa carpeta creamos un archivo llamado qf.txt con un 0 dentro, y creamos otro llamado noticias.txt que puede estar en blanco. ¡Atención! Es probable que no tengáis la función readline, así que aquí os la dejo. function readline(path, x) local linetable = {} for line in io.lines(path) do table.insert(linetable, line) end return linetable[x] end Para terminar añadimos a quest_functions estas dos funciones: readline io.lines Ya lo demás es hacer qc y reload q o reboot y ya tendréis listo esto. Como añadir noticias. Para añadir una nueva versión de noticias deberéis sumar 1 al qf.txt, por ejemplo si está en 11 poner 12 o si está en 0 poner 1. Y en noticias.txt debéis poner cada noticia en una linea. Así queda: leo2993, ArkaNo96, Jeo and 16 others 18 1 Quote Link to comment Share on other sites More sharing options...
mrsanty Posted February 10, 2020 Report Share Posted February 10, 2020 hola muy buenos dias, esta muy bueno el systema de noticias, pero tengo un problema no logro hacerlo andar. el systema ya me vino instalado en el file akron2, y revise los archivos para modificar y estan todos como en la guia. te paso los archivos de la carpeta systema >> noticias Debes iniciar sesión para ver el contenido del enlace en esta publicación. Debes iniciar sesión para ver el contenido del enlace en esta publicación. 4Metin, ChuchoGamer, BielFX and 14 others 16 1 Quote Link to comment Share on other sites More sharing options...
TrafalgarLaw Posted February 10, 2020 Report Share Posted February 10, 2020 yo tampoco puedo hacerlo andar, y el sysser no me da error, y mis files son de marty Tiburon 1 Quote Link to comment Share on other sites More sharing options...
MT3GiroForce Posted September 11, 2020 Report Share Posted September 11, 2020 En 10/2/2020 a las 13:48, TrafalgarLow dijo: yo tampoco puedo hacerlo andar, y el sysser no me da error, y mis files son de marty Funciona bien bro yo ya lo instale en los files martysama jala al 100 de hecho are un tutorial para los que no pueden Quote Link to comment Share on other sites More sharing options...
TrafalgarLaw Posted September 13, 2020 Report Share Posted September 13, 2020 Justo ahora, MT3GiroForce dijo: Funciona bien bro yo ya lo instale en los files martysama jala al 100 de hecho are un tutorial para los que no pueden te lo agradeceria entonces jajaja porque no pesca la wea Quote Link to comment Share on other sites More sharing options...
MT3GiroForce Posted September 14, 2020 Report Share Posted September 14, 2020 hace 23 horas, TrafalgarLow dijo: te lo agradeceria entonces jajaja porque no pesca la wea Pásame tu número WhatsApp y te digo como se hace eso Quote Link to comment Share on other sites More sharing options...
Anime Channel Posted November 22, 2020 Report Share Posted November 22, 2020 MT3GiroFroce podrias pasarme el video? Quote Link to comment Share on other sites More sharing options...
Ondra Souček Posted January 5, 2021 Report Share Posted January 5, 2021 Syserr game SYSERR: Jan 5 13:02:02 :: RunState: LUA_ERROR: locale/germany/quest/questlib.lua:1907: bad argument #1 to `lines' (No such file or directory) SYSERR: Jan 5 13:02:02 :: WriteRunningStateToSyserr: LUA_ERROR: quest noticias.start click Quote Link to comment Share on other sites More sharing options...
TrafalgarLaw Posted January 6, 2021 Report Share Posted January 6, 2021 En 5/1/2021 a las 9:08, Ondra Souček dijo: Syserr game SYSERR: Jan 5 13:02:02 :: RunState: LUA_ERROR: locale/germany/quest/questlib.lua:1907: bad argument #1 to `lines' (No such file or directory) SYSERR: Jan 5 13:02:02 :: WriteRunningStateToSyserr: LUA_ERROR: quest noticias.start click Yo subi uno completo buscalo, estos subem todo con falla Quote Link to comment Share on other sites More sharing options...
TrafalgarLaw Posted January 6, 2021 Report Share Posted January 6, 2021 En 5/1/2021 a las 9:08, Ondra Souček dijo: Syserr game SYSERR: Jan 5 13:02:02 :: RunState: LUA_ERROR: locale/germany/quest/questlib.lua:1907: bad argument #1 to `lines' (No such file or directory) SYSERR: Jan 5 13:02:02 :: WriteRunningStateToSyserr: LUA_ERROR: quest noticias.start click Yo subi uno completo buscalo, estos subem todo con falla Debes iniciar sesión para ver el contenido del enlace en esta publicación. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.