Mefisto_PL Posted December 22, 2011 Posted December 22, 2011 I wrote a script to fix the car through the Z button, but it shows me the error "Bad argument @'bindkey' "and I have no clue what to do. Please help, and here is the code: function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if theVehicle and getVehicleController ( theVehicle ) == playerSource then fixVehicle (theVehicle) end end addCommandHandler ("fix" , fix) bindKey(source,"z","down",fix)
Castillo Posted December 22, 2011 Posted December 22, 2011 addEventHandler("onPlayerJoin",root, function () bindKey(source,"z","down",fix) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"z","down",fix) end end) function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if (theVehicle and getVehicleController ( theVehicle ) == playerSource) then fixVehicle (theVehicle) end end addCommandHandler ("fix" , fix)
Mefisto_PL Posted December 23, 2011 Author Posted December 23, 2011 Hmm... Can you repair this too? addEventHandler("onPlayerJoin",root, function () bindKey(source,"z","down",fix) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"z","down",fix) end end) function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if (theVehicle and getVehicleController ( theVehicle ) == playerSource) then fixVehicle (theVehicle) local rx, ry, rz = getVehicleRotation ( vehicle ) if ( rx > 110 ) and ( rx < 250 ) then local x, y, z = getElementPosition ( vehicle ) setVehicleRotation ( vehicle, rx + 180, ry, rz ) setElementPosition ( vehicle, x, y, z + 2 ) end end addCommandHandler ("fix" , fix) I want add flip to this function.
Castillo Posted December 23, 2011 Posted December 23, 2011 addEventHandler("onPlayerJoin",root, function () bindKey(source,"z","down",fix) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"z","down",fix) end end) function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if (theVehicle and getVehicleController ( theVehicle ) == playerSource) then fixVehicle (theVehicle) local rx, ry, rz = getVehicleRotation ( theVehicle ) if ( rx > 110 ) and ( rx < 250 ) then local x, y, z = getElementPosition ( theVehicle ) setVehicleRotation ( theVehicle, rx + 180, ry, rz ) setElementPosition ( theVehicle, x, y, z + 2 ) end end end addCommandHandler ("fix", fix)
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