Jump to content

[help] triggerClientEvent


#RooTs

Recommended Posts

What is wrong ?.....

has no errors in debug

server.lua

addEventHandler ( 'onPlayerLogin', getRootElement ( ), 
    function () 
    triggerClientEvent ( source, "onClientPlayerLogin", source ) -- I've tried in (thePlayer) and (playerSource) I did not succeed 
    end 
) 

client.lua

addEvent( "onClientPlayerLogin", true ) 
addEventHandler( "onClientPlayerLogin", resourceRoot, 
    function() 
        bindKey( "F3", "down", toggleState ) 
        addEventHandler("onClientRender",getRootElement(),renderLoginMessages) 
        botoes() 
    end 
) 

Link to comment

@Revolt, thanks, I added more events

server.lua

addEventHandler ( 'onPlayerLogin', getRootElement ( ), 
    function () 
    triggerClientEvent ( source, "onClientPlayerLogin", resourceRoot ) 
    end 
) 
addEventHandler ( 'onPlayerLogout', getRootElement ( ), 
    function () 
    triggerClientEvent ( source, "onClientPlayerLogout", resourceRoot ) 
    end 
) 

client.lua

addEvent( "onClientPlayerLogin", true ) 
addEventHandler( "onClientPlayerLogin", resourceRoot, 
    function() 
        bindKey( "F3", "down", toggleState ) 
        addEventHandler("onClientRender",getRootElement(),renderLoginMessages) 
        botoes() 
    end 
) 
  
function removeEvent() 
    unbindKey( "F3", "down", toggleState ) 
    removeEventHandler("onClientRender",getRootElement(),renderLoginMessages) 
    botoes() 
end 
addEvent( "onClientPlayerLogout", true ) 
addEventHandler( "onClientPlayerLogout", resourceRoot, removeEvent ) 
addEventHandler( "onClientPlayerQuit", resourceRoot, removeEvent ) 

something wrong in your view? :roll:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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