nagymark686 Posted August 24, 2018 Share Posted August 24, 2018 i need help, how to make this work. Please... -- Bind keys function bindsetVehicleComponentPosition() bindKey(source, "p", "down", "setVehicleComponentPosition") end addEventHandler("onPlayerJoin", root, bindTurnIndicators) -- Bind on resource start for k,v in pairs(getElementsByType("players")) do bindKey(v, "p", "down", "resetVehicleComponentPosition") outputServerLog("player: "..getPlayerName(v)) end -- Toggling Spoiler function setVehicleComponentPosition( veh ) if thePlayer press "p" setVehicleComponentPosition (theVeh, "movspoiler_25.0_3000", -0,003, -1,99, 0,48, 0) end I also wanted to know how to work this: Link to comment
Hoffmann Posted August 25, 2018 Share Posted August 25, 2018 (edited) The onClientRender event and some basic math are decision if you want to make movements smoother Edited August 25, 2018 by NeverUnbeatable Link to comment
JeViCo Posted August 25, 2018 Share Posted August 25, 2018 1. You created binds on commands that don't exist. 2. this part of code won't work because 1 end missing. function setVehicleComponentPosition( veh ) if thePlayer press "p" setVehicleComponentPosition (theVeh, "movspoiler_25.0_3000", -0,003, -1,99, 0,48, 0) end 3. Name of this function is setVehicleComponentPosition so you can't manage vehicle components 4. This function will instantly change position of component. You need setTimer function on onClientRender event 5. Your vehicle must have part called movspoiler_25.0_3000 (use zmodeller or other software to find/create it) @nagymark686 1 Link to comment
nagymark686 Posted August 25, 2018 Author Share Posted August 25, 2018 and you help me corret this? i mean you write down for me, please? Link to comment
SycroX Posted August 25, 2018 Share Posted August 25, 2018 11 hours ago, JeViCo said: 1. You created binds on commands that don't exist. 2. this part of code won't work because 1 end missing. function setVehicleComponentPosition( veh ) if thePlayer press "p" setVehicleComponentPosition (theVeh, "movspoiler_25.0_3000", -0,003, -1,99, 0,48, 0) end 3. Name of this function is setVehicleComponentPosition so you can't manage vehicle components 4. This function will instantly change position of component. You need setTimer function on onClientRender event 5. Your vehicle must have part called movspoiler_25.0_3000 (use zmodeller or other software to find/create it) @nagymark686 6. theVeh isn't identified 7. this code will cause alot of lag and consume server's cpu because of the function name that will cause an infinite loop 8. there's a missing ( then ) at line 15 so . -- SERVER SIDE addEventHandler("onPlayerJoin", root, function() bindKey(source, "p", "down", "change_Spoiler_Position") end ) for _,v in pairs(getElementsByType("players")) do bindKey(v, "p", "down", "change_Spoiler_Position") outputServerLog("player: "..getPlayerName(v)) end function spoiler(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) triggerClientEvent("CSP", player, vehicle) end end addCommandHandler("change_Spoiler_Position", spoiler) -- Client SIDE addEvent("CSP", true) addEventHandler("CSP", root, function(vehicle) if vehicle and isElement(vehicle) then if getKeyState("p") then setVehicleComponentPosition(vehicle, "movspoiler_25.0_3000", -0,003, -1,99, 0,48, 0) end end end ) 1 Link to comment
nagymark686 Posted August 25, 2018 Author Share Posted August 25, 2018 i maded thih but not working Link to comment
SycroX Posted August 26, 2018 Share Posted August 26, 2018 check if this component ( "movspoiler_25.0_3000") exist or not Link to comment
nagymark686 Posted August 28, 2018 Author Share Posted August 28, 2018 and if i want to "if speed =< 70" how to add to this? Link to comment
pa3ck Posted August 29, 2018 Share Posted August 29, 2018 Use a timer to check the current speed of the vehicle and if it's above 70 and it's not already out, open it out. 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