Jump to content

triggerClientEvent


FuriouZ

Recommended Posts

Posted

Hey

I have problem with triggerClientEvent

so, if i press button, then debug line 74 says attempt to call global 'trigerClientEvent' (a nil value)

settings: (client)

GUIEditor = {} 
  
function drawSettingsWind() 
        GUIEditor.window = guiCreateStaticImage(0.08, 0.04, 0.72, 0.94, "img/window.png", true) 
        GUIEditor.closeButton = guiCreateStaticImage(0.94, 0.00, 0.06, 0.09, "img/close.png", true, GUIEditor.window)   
        guiSetVisible(GUIEditor.window, true)    
        guiSetEnabled(GUIEditor.window, true)        
end 
--[[ 
function showSettingsWind () 
        guiSetVisible(GUIEditor.window, true)    
        guiSetEnabled(GUIEditor.window, true)    
end]] 
addEvent("showSettings", true)  
addEventHandler("showSettings", getRootElement(), drawSettingsWind) 
  

panel: (client)

addEventHandler("onClientGUIClick", root, 
function() 
if source == GUIEditor.settingsButton then 
    triggerClientEvent ( "showSettings", getLocalPlayer() ) --Line 74 
end 
end 
)    

Merry Christmas and thanks :)

IIYAMA, stay away from this topic.Thanks.

Posted

Well, you're trying to call triggerClientEvent from the client, but triggerClientEvent exists only on the server.

If the event you want to trigger is on the same side, you can use triggerEvent

Posted
Well, you're trying to call triggerClientEvent from the client, but triggerClientEvent exists only on the server.

If the event you want to trigger is on the same side, you can use triggerEvent

Thanks! , i'll try it :)

EDIT: It worked perfectly, thanks again ! :wink:

Posted

if the script1 file it's in same folder with the script2 file then instead of use tiggerEvent you can use function name ( elements )

example:

function blabla( player ) 
  if isElement( player ) then 
     return true 
  else 
     return false 
   end 
end 
  
function blabla2 () 
      -- insteat of use triggerEvent [ This is just one example you can use it and for more things ] 
      if ( blabla( localPlayer ) == true ) then 
         blabla 
      else 
         blabla 
      end 
end 

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