#Paper Posted February 3, 2011 Share Posted February 3, 2011 Where's the error? --CLIENT SIDE function VehLight() if source == GUIEditor_Button[1] then local R = gettok ( guiGetText(GUIEditor_Edit[1]), 1, string.byte(',') ) local G = gettok ( guiGetText(GUIEditor_Edit[1]), 2, string.byte(',') ) local B = gettok ( guiGetText(GUIEditor_Edit[1]), 3, string.byte(',') ) local PVeh = getPedOccupiedVehicle(getLocalPlayer()) local P = getLocalPlayer() triggerServerEvent("onVehLightsChange",getLocalPlayer(),getLocalPlayer(),R,G,B,PVeh,P) end end addEventHandler("onClientGUIClick",GUIEditor_Button[1],VehLight,false) --SERVER SIDE addEvent("onVehLightsChange", true) function changevhelights (R,G,B,PVeh,P) setVehicleHeadLightColor(PVeh,R,G,B) outputChatBox("#00FF00<#9370DBServer#00FF00>#ff0000: #0000ffYour vehicle lights has been setted!", P, 255,255,255, true) end addEventHandler("onVehLightsChange", getRootElement(), changevhelights) Link to comment
SDK Posted February 3, 2011 Share Posted February 3, 2011 You should add more info, , what do you want the script to do, what doesn't work, what errors does /debugscript 3 give ... For now, these remarks: 1) gettok returns a string 2) you're sending the local player 3 times using that server event: source, 1st arg and last arg Link to comment
#Paper Posted February 4, 2011 Author Share Posted February 4, 2011 For now, these remarks:1) gettok returns a string 2) you're sending the local player 3 times using that server event: source, 1st arg and last arg how to fix? Link to comment
SDK Posted February 4, 2011 Share Posted February 4, 2011 1) use tonumber() 2) remove the wrong arguments ... now it is: client sends getLocalPlayer(),R,G,B,PVeh,P server receives R,G,B,PVeh,P Link to comment
#Paper Posted February 4, 2011 Author Share Posted February 4, 2011 1) use tonumber()2) remove the wrong arguments ... now it is: client sends getLocalPlayer(),R,G,B,PVeh,P server receives R,G,B,PVeh,P for the gettok? Link to comment
SDK Posted February 4, 2011 Share Posted February 4, 2011 yes, tonumber(gettok( guiGetText(GUIEditor_Edit[1]), 1, string.byte(',') )) Link to comment
#Paper Posted February 4, 2011 Author Share Posted February 4, 2011 yes, tonumber(gettok( guiGetText(GUIEditor_Edit[1]), 1, string.byte(',') )) ty Link to comment
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