BorderLine Posted May 20, 2013 Share Posted May 20, 2013 hi everyone. I have a problems with triggers. I have this code to make "nitro mod color", but i did in client side, but only i see my own effect, but i didnt see the others players. Then a make this to trigger to serverside. If anyone can helpme PD: THIS MOD WILL BE UPLOAD TO COMUNITY TO AVOID THEFTS Thanks ClientSide function startClient () addEventHandler("onClientRender", getRootElement(), Nos) end addEvent("nitrON",true) addEventHandler("NitrON",getRootElement(),startClient) function startClient2 () removeEventHandler("onClientRender", getRootElement(), Nos) end addEvent("nitrOFF",true) addEventHandler("NitrOFF",getRootElement(),startClient2) function Nos () ntcr = getElementData ( getLocalPlayer(), "NNR" ) ntcg = getElementData ( getLocalPlayer(), "NNG" ) ntcb = getElementData ( getLocalPlayer(), "NNB" ) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) local x, y, z = getElementPosition(theVehicle) fxAddGlass(x,y,z,ntcr,ntcg,ntcb,100,0.15,7.5) end ServerSide function nitroon() triggerClientEvent( "NitrON", getRootElement(),getRootElement()) end bindKey("mouse1","down",nitroon) bindKey("lctrl", "down", nitroon) bindKey("rctrl", "down", nitroon) function nitrooff() triggerClientEvent( "NitrOFF", getRootElement(),getRootElement() ) end bindKey("mouse1","up",nitrooff) bindKey("lctrl", "up",nitrooff) bindKey("rctrl", "up",nitrooff) Link to comment
Moderators IIYAMA Posted May 20, 2013 Moderators Share Posted May 20, 2013 Maybe because you only get localPlayer Element data? localPlayer or getLocalPlayer() = YOU Learn to work with tables, you have to change your system totally. Link to comment
BorderLine Posted May 20, 2013 Author Share Posted May 20, 2013 that isnt the problem. the problem are triggers, elementdata just are for colours, i can change that. Link to comment
Jacob Lenn Posted May 20, 2013 Share Posted May 20, 2013 1st thing, when you are triggering you must write as 1st argument player which you triggering to. For example: function nitroon(player) triggerClientEvent(player, "NitrON", getRootElement()) end bindKey("mouse1","down",nitroon) bindKey("lctrl", "down", nitroon) bindKey("rctrl", "down", nitroon) 2nd thing is your bindKey. When you are using bindKey on serverside your 1st argument must be player. bindKey ( player thePlayer, string key, string keyState, function handlerFunction, [ var arguments, ... ] ) Link to comment
BorderLine Posted May 20, 2013 Author Share Posted May 20, 2013 riiiiight.. i forgot thaaaaaat.!!!!!! im gonna try now.. thxnks 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