Jump to content

[DUDA] ¿Como Enlazo esto?


Sergioks

Recommended Posts

Posted

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. :D

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

Posted

El recurso ese "notifications" tiene una funcion server-side?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

-- 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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (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 :mrgreen:

Edited by Guest

Instagram | ¡Sígueme en YouTube! | Facebook
Todo se puede con algo de esfuerzo

Posted

Fue un error al escribir :P.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Seria mas eficiente poniendo en el primer argumento 'root', en vez de gastar mas recursos del server con un loop. O no?

State: Inactive

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...