#Paper Posted March 9, 2011 Posted March 9, 2011 (edited) The event doesn't trigger: --Client: function triggerFunc (theButton) if theButton == GUIEditor_Radio[1] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Red", getLocalPlayer()) elseif theButton == GUIEditor_Radio[2] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Yellow", getLocalPlayer()) elseif theButton == GUIEditor_Radio[3] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Black", getLocalPlayer()) elseif theButton == GUIEditor_Radio[4] then triggerServerEvent(getLocalPlayer(), "onColorSet", "White", getLocalPlayer()) elseif theButton == GUIEditor_Radio[5] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Purple", getLocalPlayer()) elseif theButton == GUIEditor_Radio[6] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Orange", getLocalPlayer()) elseif theButton == GUIEditor_Radio[7] then triggerServerEvent(getLocalPlayer(), "onColorSet", "Blue", getLocalPlayer()) end end addEventHandler("onClientGUIClick", GUIEditor_Radio[1], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[2], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[3], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[4], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[5], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[6], triggerFunc) addEventHandler("onClientGUIClick", GUIEditor_Radio[7], triggerFunc) --Server: addEvent("onColorSet", true) function changeVehicleColor(theColor, thePlayer) local pVhe = getPedOccupiedVehicle(thePlayer) if pVhe then if theColor == "Red" then setVehicleHeadLightColor ( pVhe, 255, 0, 0 ) elseif theColor == "Yellow" then setVehicleHeadLightColor ( pVhe, 255, 255, 0 ) elseif theColor == "Black" then setVehicleHeadLightColor ( pVhe, 0, 0, 0 ) elseif theColor == "White" then setVehicleHeadLightColor ( pVhe, 255, 255, 255 ) elseif theColor == "Purple" then setVehicleHeadLightColor ( pVhe, 160, 32, 240 ) elseif theColor == "Orange" then setVehicleHeadLightColor ( pVhe, 255, 165, 0 ) elseif theColor == "Blue" then setVehicleHeadLightColor ( pVhe, 0, 0, 255 ) end end end addEventHandler("onColorSet", getRootElement(), changeVehicleColor) Edited March 11, 2011 by Guest
Discord Moderators Zango Posted March 9, 2011 Discord Moderators Posted March 9, 2011 I think you might be confused by 'button' argument in onClientGUIClick >> https://wiki.multitheftauto.com/wiki/OnClientGUIClick string button, string state, int absoluteX, int absoluteY [b]button[/b]: the name of the mouse button that the GUI element was clicked with, can be left, right, or middle. remove argument in parentheses at triggerFunc and use source as comparison fx if source == GUIEditor_Radio[1] then
#Paper Posted March 9, 2011 Author Posted March 9, 2011 I think you might be confused by 'button' argument in onClientGUIClick >> https://wiki.multitheftauto.com/wiki/OnClientGUIClick string button, string state, int absoluteX, int absoluteY [b]button[/b]: the name of the mouse button that the GUI element was clicked with, can be left, right, or middle. remove argument in parentheses at triggerFunc and use source as comparison fx if source == GUIEditor_Radio[1] then if i place source it works?
#Paper Posted March 11, 2011 Author Posted March 11, 2011 Yes it works All the triggerServerEvent are bad arguments... <_<
Castillo Posted March 11, 2011 Posted March 11, 2011 You are using it like triggerClientEvent, in triggerServerEvent must be like this: triggerServerEvent("onColorSet", getLocalPlayer(), "Red")
Discord Moderators Zango Posted March 11, 2011 Discord Moderators Posted March 11, 2011 Yes it works All the triggerServerEvent are bad arguments... <_< well yes, that's because you haven't read the documentation for triggerServerEvent it's event, element and arguments. Not element, event, arguments
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now