BorderLine Posted May 20, 2013 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) Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Moderators IIYAMA Posted May 20, 2013 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
BorderLine Posted May 20, 2013 Author Posted May 20, 2013 that isnt the problem. the problem are triggers, elementdata just are for colours, i can change that. Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Jacob Lenn Posted May 20, 2013 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, ... ] )
BorderLine Posted May 20, 2013 Author Posted May 20, 2013 riiiiight.. i forgot thaaaaaat.!!!!!! im gonna try now.. thxnks Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
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