stevensalvaro Posted March 17, 2016 Share Posted March 17, 2016 Hello, I want to make when vehicle has item id 1 then setelementdata "test" 1 , and when player enter vehicle and press 'N' then item ID 1 work. What function i need ? am i right about : When vehicle has item id 1 ----- "setElementData function" When Player enter vehicle ----- "getElementData function" When press N ---- Trigger the event ? Link to comment
Dimos7 Posted March 17, 2016 Share Posted March 17, 2016 addEventHandler("onPlayerLogin", root, function() bindKey(source, "n", "down", factionVehicle) end) addEventHandler("onResourceStart", root, function() for p, v in ipairs(getElementsByType("player")) do bindKey(v, "n", "down", factionVehicle) end end) function factionVehicle(thePlayer, theVehicle) --your code end Link to comment
stevensalvaro Posted March 17, 2016 Author Share Posted March 17, 2016 so if i want to make it work with get / set element data , i must to write : client addEventHandler("onPlayerLogin", root, function() bindKey(source, "n", "down", factionVehicle) end) addEventHandler("onResourceStart", root, function() for p, v in ipairs(getElementsByType("player")) do bindKey(v, "n", "down", factionVehicle) end end) function factionVehicle(thePlayer, theVehicle) getElementData (theVehicle, "test") triggerServerEvent ("test1", getLocalPlayer(), theVehicle) end end Link to comment
Dimos7 Posted March 17, 2016 Share Posted March 17, 2016 that is server side not client 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