HunT Posted May 5, 2011 Share Posted May 5, 2011 noob = local vehicle = getPedOccupiedVehicle(player) hi all.i have problem with this script. if source == Marker[1] then local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) local ramp = createObject ( 1634, x, y, z, rx, ry, rz ) attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 ) move1 = moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) bindKey ( "mouse2", "down", move1 ) createObject work attachElements work moveObject no bindKey no debugscript 3 = ERROR: attempt to call a boolean value Sorry i am . . . scripter Link to comment
Castillo Posted May 5, 2011 Share Posted May 5, 2011 this script is server side or client side? Link to comment
proracer Posted May 5, 2011 Share Posted May 5, 2011 I think that is client-side script, also can you show the whole code not just the part? Link to comment
HunT Posted May 5, 2011 Author Share Posted May 5, 2011 Client side yep castillo. --[[ ===================================================== Racemap : Mortal Kombat v2 ===================================================== ]]-- local root = getRootElement() local this = getThisResource() local resourceRoot = getResourceRootElement(this) local localPlayer = getLocalPlayer() local Marker = {} addEventHandler("onClientResourceStart", resourceRoot, function() Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0) outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) local stereo1 = engineLoadTXD ( "shade.txd" ) engineImportTXD ( stereo1, 3458 ) setCloudsEnabled ( false ) setMinuteDuration(60000) setTimer (function() setTime (0, 0) end , 60000, 0) setWaterColor( 100, 0, 0 ) setWaveHeight ( 0 ) setSkyGradient( 100, 0, 0, 100, 0, 0 ) end ) addEventHandler("onClientResourceStop", root, function(res) if res == this then end end ) addEventHandler("onClientMarkerHit", root, function(player, matchingDimension) if not matchingDimension then return end if player == localPlayer and isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if source == Marker[1] then local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) local ramp = createObject ( 1634, x, y, z, rx, ry, rz ) attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 ) move1 = moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) bindKey ( "mouse2", "down", move1 ) end end end ) I always use this script for my maps. My question: is it possible to move an attached object to the vehicle? Link to comment
Castillo Posted May 6, 2011 Share Posted May 6, 2011 I'm afraid your post makes no sense, qais. Back on the problem: You can't attach a bind to an ELEMENT, you need a function for that, try this code: --[[ ===================================================== Racemap : Mortal Kombat v2 ===================================================== ]]-- local root = getRootElement() local this = getThisResource() local resourceRoot = getResourceRootElement(this) local localPlayer = getLocalPlayer() local Marker = {} addEventHandler("onClientResourceStart", resourceRoot, function() Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0) outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) local stereo1 = engineLoadTXD ( "shade.txd" ) engineImportTXD ( stereo1, 3458 ) setCloudsEnabled ( false ) setMinuteDuration(60000) setTimer (function() setTime (0, 0) end , 60000, 0) setWaterColor( 100, 0, 0 ) setWaveHeight ( 0 ) setSkyGradient( 100, 0, 0, 100, 0, 0 ) end ) addEventHandler("onClientResourceStop", root, function(res) if res == this then end end ) addEventHandler("onClientMarkerHit", root, function(player, matchingDimension) if not matchingDimension then return end if player == localPlayer and isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if source == Marker[1] then local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) ramp = createObject ( 1634, x, y, z, rx, ry, rz ) attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 ) bindKey ( "mouse2", "down", function () moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) end) end end end ) Link to comment
qaisjp Posted May 7, 2011 Share Posted May 7, 2011 I helped him understand that variables are generally the other way round than he thought Link to comment
HunT Posted May 9, 2011 Author Share Posted May 9, 2011 I'm afraid your post makes no sense, qais.Back on the problem: You can't attach a bind to an ELEMENT, you need a function for that, try this code: --[[ ===================================================== Racemap : Mortal Kombat v2 ===================================================== ]]-- local root = getRootElement() local this = getThisResource() local resourceRoot = getResourceRootElement(this) local localPlayer = getLocalPlayer() local Marker = {} addEventHandler("onClientResourceStart", resourceRoot, function() Marker[1] = createMarker(2404.4, -3551.9, 7.6, "corona", 5, 0, 0, 0) outputChatBox ("Mortal Kombat v2", 255, 255, 0, true) local stereo1 = engineLoadTXD ( "shade.txd" ) engineImportTXD ( stereo1, 3458 ) setCloudsEnabled ( false ) setMinuteDuration(60000) setTimer (function() setTime (0, 0) end , 60000, 0) setWaterColor( 100, 0, 0 ) setWaveHeight ( 0 ) setSkyGradient( 100, 0, 0, 100, 0, 0 ) end ) addEventHandler("onClientResourceStop", root, function(res) if res == this then end end ) addEventHandler("onClientMarkerHit", root, function(player, matchingDimension) if not matchingDimension then return end if player == localPlayer and isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if source == Marker[1] then local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) ramp = createObject ( 1634, x, y, z, rx, ry, rz ) attachElements ( ramp, vehicle, 0, 6, -1, 0, 0, 180 ) bindKey ( "mouse2", "down", function () moveObject ( ramp, 100, 1, 0, 0 ,0 ,0 ,0) end) end end end ) Sorry For Delay Castillo.I Test Tnx. Link to comment
HunT Posted May 10, 2011 Author Share Posted May 10, 2011 No work because the problem is attachElements (imho). I want bindKey with function lol = createObject moveObject lol, x+1 and destroyElement lol 100. I reply with iphone Link to comment
Castillo Posted May 10, 2011 Share Posted May 10, 2011 You can't move an object that is attached (if i'm right). Link to comment
HunT Posted May 10, 2011 Author Share Posted May 10, 2011 Without attachElements. Example (Raw) local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) local X, Y, Z = getElementPosition ( source ) local omg = ramp+moved ramp = createObject ( 1634, x, y + 6, z -1, rx, ry, rz + 180) moved = moveObject ( ramp, 100, X + 3, Y, Z) bindKey ( "mouse2", "down", omg ) Link to comment
Castillo Posted May 10, 2011 Share Posted May 10, 2011 What is this? bindKey requires a FUNCTION not a variable or an ELEMENT. Link to comment
HunT Posted May 11, 2011 Author Share Posted May 11, 2011 What is this? bindKey requires a FUNCTION not a variable or an ELEMENT. Callate is only example. But this? function omg ( ) ramp = createObject moveObject ramp bindKey omg ??? Link to comment
Castillo Posted May 11, 2011 Share Posted May 11, 2011 The code i gave you works without attachElements. 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