Rafa23Alzira Posted April 17, 2014 Report Share Posted April 17, 2014 Hola chicos, les traigo una pequeña quest con la que podrán mostrarles a sus jugadores las noticias del servidor en tiempo real, sin necesidad de reload o reboot. quest noticias begin state start begin when letter begin send_letter("Últimas Noticias") end when button or info begin local fecha = write_or_read("/home/game/share/locale/germany/quest/noticias/", "fecha.txt", "leer", "linea") say_title("Noticias - "..fecha.."") say(write_or_read("/home/game/share/locale/germany/quest/noticias/", "noticias.txt", "leer", "todo")) end end end Para usarla debéis crear una carpeta llamada noticias en la ruta que pongáis, dentro de ella creáis dos archivos, uno llamado fecha.txt y otro noticias.txt (supongo que ahí ya os guiáis bastante) Necesitareis está función: Debes iniciar sesión para ver el contenido del enlace en esta publicación. Se que no es mucho, pero a alguien le servirá. Jeo, Shogun, dexterxdlol1 and 3 others 6 Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 17, 2014 Report Share Posted April 17, 2014 solo cargo la quest y ya? Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 17, 2014 Author Report Share Posted April 17, 2014 solo cargo la quest y ya? Como explique debes tener añadida la función write_or_read de pacificador y crear la carpeta en esa ruta o en la que elijas. Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 17, 2014 Report Share Posted April 17, 2014 osea después de editar por segunda vez el .txt? Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 17, 2014 Author Report Share Posted April 17, 2014 osea después de editar por segunda vez el .txt? Como que editar por segunda vez? En los txt (creo que no hacía falta explicarlo) en uno va la fecha y en otro las noticias. Quote Link to comment Share on other sites More sharing options...
Jfirewall Posted April 17, 2014 Report Share Posted April 17, 2014 mi viejo pone en questlib.lua la funcion write_or_read que es del pacificador luego creas una carpeta de noticias y dentro colocas noticias.txt y fecha.txt es complicado? porque yo no lo veo xd Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 18, 2014 Report Share Posted April 18, 2014 en que formate la fecha? 17/04/2014 ó /07/abril/2014 ? Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 18, 2014 Report Share Posted April 18, 2014 Si, se pero ejemplo ya puse una fecha y una noticia si pongo otra la quest solo se actualiza para que muestre la otra noticia? Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 18, 2014 Author Report Share Posted April 18, 2014 La fecha como a ti te de la gana. La quest mostrará lo que haya en el txt en ese momento Quote Link to comment Share on other sites More sharing options...
Jfirewall Posted April 18, 2014 Report Share Posted April 18, 2014 si solo debes editar el .txt Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 18, 2014 Report Share Posted April 18, 2014 OKA OKA olle Jfirewall una preguntota, cuando quiero prender una quest no me deja me aparece qc:comand not found y solo se prenden dando un make Quote Link to comment Share on other sites More sharing options...
-YC- Posted April 18, 2014 Report Share Posted April 18, 2014 Una pregunta, es que cuando quiero prender una quest pongo el comando ./qc nombrequest.quest y me bota qc: command not found porqué? solo las puedo prender dando un make Quote Link to comment Share on other sites More sharing options...
Happy Posted April 18, 2014 Report Share Posted April 18, 2014 pues da un make xD Quote Link to comment Share on other sites More sharing options...
Pac092 Posted April 18, 2014 Report Share Posted April 18, 2014 utiliza un getdate para que tome la fecha actual del ordenador o donde este Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 18, 2014 Author Report Share Posted April 18, 2014 utiliza un getdate para que tome la fecha actual del ordenador o donde este La cuestión es que pongas la fecha en la que has puesto las noticias. Quote Link to comment Share on other sites More sharing options...
RafaVK Posted April 23, 2014 Report Share Posted April 23, 2014 Si es algo de información no sería mejor que apareciera en el chat general o tipo pregunta OX cada cierto tiempo o a unas horas específicas???? lo digo por experiencia en mi server tengo una quest de noticias echa por mi pero nadie lee esos pergaminos en la actualidad... Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 24, 2014 Author Report Share Posted April 24, 2014 Si es algo de información no sería mejor que apareciera en el chat general o tipo pregunta OX cada cierto tiempo o a unas horas específicas???? lo digo por experiencia en mi server tengo una quest de noticias echa por mi pero nadie lee esos pergaminos en la actualidad... Si es mucha información ocuparía demasiado en el chat y se haría pesado. Yo por ejemplo pongo todo lo que se ha puesto en los mantenimientos y son 7 u 8 líneas. Quote Link to comment Share on other sites More sharing options...
SergioT Posted May 7, 2015 Report Share Posted May 7, 2015 buenas tardes, puse esta funcion en questlib function write_or_read(path, file, act, text, line) local type_ if os.execute('cd '..path) ~= 0 then os.execute('mkdir '..path) elseif os.execute('[ -f '..path.."/"..file..' ] && echo "s" || echo "n"') == 'n' then os.execute('cd '..path..' && touch '..file) end if act == 'ler' or act == 'read' or act == 'l' or act == 'r' then type_ = 'r' elseif act == 'sobrescrever' or act == 'rewrite' or act == 's' or act == 're' then type_ = 'w' elseif act == 'escrever' or act == 'write' or act == 'e' or act == 'a+' then type_ = 'a+' end local f = io.open(path..'/'..file, type_) if type_ == 'r' then if text == 'all' or text == 'tudo' then return f:read('*all') elseif text == 'line' or text == 'linha' or text == 'l' then return f:read('*l') elseif text == 'sline' or text == 'linhas' or text == 'ls' then local ltable = {} for i in f:lines() do table.insert(ltable, i) end f:close() return ltable[line] end elseif type_ == 'a+' or type_ == 'w' then if string.find(text, '__enter__') ~= 0 then f:write(string.gsub(text, '__enter__', '\n', string.find(text,'__enter__'))..'\n') else f:write(text..'\n') end f:close() end end y la quest y al darle clic al pergamino no aparece nada no abre ninguna informacion y si hice la carpeta noticias los txt fecha y noticias dentro de la carpeta aqui una foto 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...
Rafa23Alzira Posted May 7, 2015 Author Report Share Posted May 7, 2015 ¿Seguro que lo tienes en la ruta indicada? Quote Link to comment Share on other sites More sharing options...
Ryen Posted May 7, 2015 Report Share Posted May 7, 2015 buenas tardes, puse esta funcion en questlib function write_or_read(path, file, act, text, line) local type_ if os.execute('cd '..path) ~= 0 then os.execute('mkdir '..path) elseif os.execute('[ -f '..path.."/"..file..' ] && echo "s" || echo "n"') == 'n' then os.execute('cd '..path..' && touch '..file) end if act == 'ler' or act == 'read' or act == 'l' or act == 'r' then type_ = 'r' elseif act == 'sobrescrever' or act == 'rewrite' or act == 's' or act == 're' then type_ = 'w' elseif act == 'escrever' or act == 'write' or act == 'e' or act == 'a+' then type_ = 'a+' end local f = io.open(path..'/'..file, type_) if type_ == 'r' then if text == 'all' or text == 'tudo' then return f:read('*all') elseif text == 'line' or text == 'linha' or text == 'l' then return f:read('*l') elseif text == 'sline' or text == 'linhas' or text == 'ls' then local ltable = {} for i in f:lines() do table.insert(ltable, i) end f:close() return ltable[line] end elseif type_ == 'a+' or type_ == 'w' then if string.find(text, '__enter__') ~= 0 then f:write(string.gsub(text, '__enter__', '\n', string.find(text,'__enter__'))..'\n') else f:write(text..'\n') end f:close() end end y la quest y al darle clic al pergamino no aparece nada no abre ninguna informacion y si hice la carpeta noticias los txt fecha y noticias dentro de la carpeta aqui una foto Debes iniciar sesión para ver el contenido del enlace en esta publicación. Si no te abre nada en la quest ser por el txt que va bien xD Quote Link to comment Share on other sites More sharing options...
PENTAGRAMA Posted May 7, 2015 Report Share Posted May 7, 2015 buenas tardes, puse esta funcion en questlib function write_or_read(path, file, act, text, line) local type_ if os.execute('cd '..path) ~= 0 then os.execute('mkdir '..path) elseif os.execute('[ -f '..path.."/"..file..' ] && echo "s" || echo "n"') == 'n' then os.execute('cd '..path..' && touch '..file) end if act == 'ler' or act == 'read' or act == 'l' or act == 'r' then type_ = 'r' elseif act == 'sobrescrever' or act == 'rewrite' or act == 's' or act == 're' then type_ = 'w' elseif act == 'escrever' or act == 'write' or act == 'e' or act == 'a+' then type_ = 'a+' end local f = io.open(path..'/'..file, type_) if type_ == 'r' then if text == 'all' or text == 'tudo' then return f:read('*all') elseif text == 'line' or text == 'linha' or text == 'l' then return f:read('*l') elseif text == 'sline' or text == 'linhas' or text == 'ls' then local ltable = {} for i in f:lines() do table.insert(ltable, i) end f:close() return ltable[line] end elseif type_ == 'a+' or type_ == 'w' then if string.find(text, '__enter__') ~= 0 then f:write(string.gsub(text, '__enter__', '\n', string.find(text,'__enter__'))..'\n') else f:write(text..'\n') end f:close() end end y la quest y al darle clic al pergamino no aparece nada no abre ninguna informacion y si hice la carpeta noticias los txt fecha y noticias dentro de la carpeta aqui una foto Debes iniciar sesión para ver el contenido del enlace en esta publicación. xD, le diste permiso 777 ??? Recuerda darle permiso alos txt y ala carpeta para mas seguro (tambien ala quest xD) Se le da Permisos 777 para poder leer el archivo Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted May 7, 2015 Author Report Share Posted May 7, 2015 No hace falta ningún tipo de permiso Quote Link to comment Share on other sites More sharing options...
SergioT Posted May 7, 2015 Report Share Posted May 7, 2015 ya logre solucionarlo si se dan cuenta la funcion esta en otro idioma y la ques q meti en español simplemente cambie la quest para que funcione y fue todo xd gracias por contestar Quote Link to comment Share on other sites More sharing options...
mrsanty Posted May 9, 2015 Report Share Posted May 9, 2015 hola, antes que nada gracias por el aporte, segundo tengo un problema con este sistema ise todo los pasos, cuando entro con cualquier pj, me aparese el pergamino, cuando le doy click no aparese nada solo desaparese. que puede ser. 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.