Sergioks Posted December 14, 2013 Posted December 14, 2013 Hola! Necesito Una Ayudita en un script. quiero hacer un panel de mensajes con el script 'notifications' Esta es la function de mi client: function EnviarNot() showCursor ( true ) local tipo = guiGetText (GUIEditor.combobox[1]) local message = guiGetText (GUIEditor.edit[3]) exports["notifications"]:showBox ( "".. tipo .."","".. message .."" ) end El Mensaje Me Va Bien y Todo, Pero, Por estar en Client solo yo lo veo. ¿ Como Hago para que me aparezca en Global? Enlazar el mensaje: exports["notifications"]:showBox ( "".. tipo .."","".. message .."" ) En Server.? Lo Intente poniendo todo eso de local tipo = guiGetText (GUIEditor.combobox[1]) En El Server.lua pero nada, porque no estan especificadas. ¿como hago alli? Porfavor soy un noob en esto del scripting y he tenido problemas con eso. Tambien intente con un triggerServerEvent y tampoco nada, y el TriggerClientEvent no lo se usar. porfavor alguien que pueda ayudarme a hacerlo, o facilitarme el codigo que debo poner en el server-side. Les Agradeceria MUCHO - Gracias Por Leer Mi Mensaje. Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
Castillo Posted December 14, 2013 Posted December 14, 2013 El recurso ese "notifications" tiene una funcion server-side? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sergioks Posted December 14, 2013 Author Posted December 14, 2013 El recurso ese "notifications" tiene una funcion server-side? Si Hablas de Lo que tiene el script "Notifications" en en archivo "server.lua" es Esto: function showBox(player, value, str) if isElement(player) then triggerClientEvent(player, "CreateBox", getRootElement(), value, str) end end Pero si hablas sobre el codigo este: exports["notifications"]:showBox ( "".. tipo .."","".. message .."" ) Ese funciona en client y en server. es como el outputChatbox. Generalmente, lo unico que quiero es saber, como hacer que el mensaje aparesca por say, y que todos lo lean. ( sea outputChatbox o notifications box ) porque, he logrado que dicho script aparezca, pero poniendo en client lo mismo que puse en el post. por lo cual, solo me aparece a mi, y a nadie mas. quiero que lo lean todos ( que este en el Server.lua ) pero no se como hacerlo. Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
Castillo Posted December 14, 2013 Posted December 14, 2013 -- client side: function EnviarNot ( ) showCursor ( true ) local tipo = guiGetText ( GUIEditor.combobox[1] ) local message = guiGetText ( GUIEditor.edit[3] ) triggerServerEvent ( "showText", localPlayer, tipo, message ) end -- server side: addEvent ( "showText", true ) addEventHandler ( "showText", root, function ( tipo, message ) exports [ "notifications"] :showBox ( root, tipo, message ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sergioks Posted December 14, 2013 Author Posted December 14, 2013 (edited) -- client side: function EnviarNot ( ) showCursor ( true ) local tipo = guiGetText ( GUIEditor.combobox[1] ) local message = guiGetText ( GUIEditor.edit[3] ) triggerServerEvent ( "showText", localPlayer, tipo, message ) end -- server side: addEvent ( "showText", true ) addEventhandler ( "showText", root, function ( tipo, message ) for _, player in ipairs ( getElementsByType ( "player" ) ) do exports [ "notifications"] :showBox ( player, tipo, message ) end end ) me dice esto: ERROR: Server.lua:130: arrempt to call global 'addEventhandler' ( a nil value ) ---- Ha No Ya Lo Arregle, Gracias Edited December 14, 2013 by Guest Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
Alexs Posted December 14, 2013 Posted December 14, 2013 Es 'addEventHandler' con la H en mayúscula, Lua hace diferencia en esas cosas. Developer @ MYVAL
Sergioks Posted December 14, 2013 Author Posted December 14, 2013 Es 'addEventHandler' con la H en mayúscula, Lua hace diferencia en esas cosas. Si, eso fue lo que le cambie y se arreglo. Gracias a Los 2 Por La Ayuda Instagram | ¡Sígueme en YouTube! | Facebook Todo se puede con algo de esfuerzo
Castillo Posted December 14, 2013 Posted December 14, 2013 Fue un error al escribir . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted December 15, 2013 Posted December 15, 2013 Seria mas eficiente poniendo en el primer argumento 'root', en vez de gastar mas recursos del server con un loop. O no? State: Inactive
Castillo Posted December 15, 2013 Posted December 15, 2013 A primera vista pense que no era posible, ya que verificaba si 'player' era un elemento, pero me confundi, igual no estoy seguro de si es mas eficiente realmente. Aca lo tenes usando 'root': addEvent ( "showText", true ) addEventHandler ( "showText", root, function ( tipo, message ) exports [ "notifications"] :showBox ( root, tipo, message ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts