iFoReX Posted April 8, 2012 Share Posted April 8, 2012 I have problem with the marker, when Im in marker doesnt create the door D: cl.lua ----------- --ElMisil-- function lanzamisiles ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition (localPlayer) if ( vehicle and vehicle == getElementByID ( "misilero" ) ) then if ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then elseif ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then outputChatBox ( "Ha ocurrido un problema, deja descansar el lanzamisiles" ) end end end bindKey ( "B", "down", lanzamisiles ) function markerhit (hitPlayer) if ( hitPlayer == localPlayer ) then local objeto2 = createObject(3029, 0, 0, -3) attachElements ( objeto2, elobjeto, 0, 2, 0) end end addEventHandler ("onClientMarkerHit", elmarker, markerhit) o.lua local vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() local elobjeto = createObject(2669, 0, 0, 0 ) local elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) Link to comment
Kenix Posted April 8, 2012 Share Posted April 8, 2012 addEventHandler ("onClientMarkerHit", elmarker, markerhit) elmarker defined? Check it. Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 addEventHandler ("onClientMarkerHit", elmarker, markerhit) elmarker defined? Check it. The marker is in the other script... Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 ? ----------- --ElMisil-- function lanzamisiles ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition (localPlayer) if ( vehicle and vehicle == getElementByID ( "misilero" ) ) then if ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then elseif ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then outputChatBox ( "Ha ocurrido un problema, deja descansar el lanzamisiles" ) end end end function lanzamisiles2 ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition (localPlayer) if ( vehicle and vehicle == getElementByID ( "misilero2" ) ) then if ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then elseif ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then outputChatBox ( "Ha ocurrido un problema, deja descansar el lanzamisiles" ) end end end bindKey ( "B", "down", lanzamisiles ) bindKey ( "N", "down", lanzamisiles2 ) function markerhit (hitPlayer) if ( hitPlayer == localPlayer ) then getElementByID ( elmarker ) local objeto2 = createObject(3029, 0, 0, -3) attachElements ( objeto2, elobjeto, 0, 2, 0) end end addEventHandler ("onClientMarkerHit", elmarker, markerhit) local vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() local elobjeto = createObject(2669, 0, 0, 0 ) local elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 try this: ----------- --ElMisil-- function lanzamisiles ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition (localPlayer) if ( vehicle and vehicle == getElementByID ( "misilero" ) ) then if ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then elseif ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then outputChatBox ( "Ha ocurrido un problema, deja descansar el lanzamisiles" ) end end end function lanzamisiles2 ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition (localPlayer) if ( vehicle and vehicle == getElementByID ( "misilero2" ) ) then if ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then elseif ( not createProjectile ( localPlayer, 19, x, y + 7.5, z + 6, 70) ) then outputChatBox ( "Ha ocurrido un problema, deja descansar el lanzamisiles" ) end end end bindKey ( "B", "down", lanzamisiles ) bindKey ( "N", "down", lanzamisiles2 ) --Server local vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() local elobjeto = createObject(2669, 0, 0, 0 ) local elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) addEventHandler ("onMarkerHit", elmarker, function(hitPlayer) if ( hitPlayer == source ) then getElementByID ( elmarker ) local objeto2 = createObject(3029, 0, 0, -3) attachElements ( objeto2, elobjeto, 0, 2, 0) end end) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 I do it , but now in debugging show @ bad argument attachElements function ponere2() local objeto2 = createObject(3029, 0, 0, -3, 0, 0, 0) attachElements ( objeto2, elobjeto, 0, 0, 0) end addCommandHandler("i", ponere2) Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 try this: --Server local vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() local elobjeto = createObject(2669, 0, 0, 0 ) local elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) addEventHandler ("onMarkerHit", elmarker, function(hitPlayer) if ( hitPlayer == source ) then getElementByID ( elmarker ) local objeto2 = createObject(3029, 0, 0, -3) attachElements ( objeto2, elobjeto, 0, 2, 0) end end) addCommandHandler("i",function() local objeto2 = createObject(3029, 0, 0, -3, 0, 0, 0) attachElements ( objeto2, elobjeto, 0, 0, 0) end) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 doesnt work bad argument in attachElements Link to comment
drk Posted April 8, 2012 Share Posted April 8, 2012 Remove local from the elements and will be global. local -> makes the variable local, this is: You can only use it in a piece of code. Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 (edited) lol, I found my mistake --Server vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() elobjeto = createObject(2669, 0, 0, 0 ) elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) addCommandHandler("i",function() local objeto2 = createObject(3029, 0, 0, -3, 0, 0, 0) attachElements ( objeto2, elobjeto, 0, 0, 0) end) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) Edited April 8, 2012 by Guest Link to comment
drk Posted April 8, 2012 Share Posted April 8, 2012 (edited) lol, I found my mistake --Server local vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() elobjeto = createObject(2669, 0, 0, 0 ) elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) addCommandHandler("i",function() local objeto2 = createObject(3029, 0, 0, -3, 0, 0, 0) attachElements ( objeto2, elobjeto, 0, 0, 0) end) end addCommandHandler("o", ponere) ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) * FACEPALM * I said what is wrong, you haven't found it. Edited April 8, 2012 by Guest Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 and how I can attach the player to my object ? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 and how I can attach the player to my object ? What's your object? A gate? Gun? Box? Link to comment
drk Posted April 8, 2012 Share Posted April 8, 2012 attachElements Player is a element. Object too. Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 to the object = 'elobjeto = createObject(2669, 0, 0, 0 )' Link to comment
drk Posted April 8, 2012 Share Posted April 8, 2012 to the object = 'elobjeto = createObject(2669, 0, 0, 0 )' attachElements Player is a element. Object too. Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 ? function elplayer( thePlayer ) attachElements ( thePlayer, elobjeto, 0, 0, 0) end bindKey("z", "down", elplayer) Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 what is "y" ? I dont know ._. In Spanish is and but in english I dont know Link to comment
Jaysds1 Posted April 9, 2012 Share Posted April 9, 2012 (edited) ya, but you don't need those zero's --Server vehiculo = createVehicle( 497, 691.71069, -2794.62891, 8.90768) function ponere() elobjeto = createObject(2669, 0, 0, 0 ) elmarker = createMarker( 0, 0, -7, "cylinder", 1.5, 255,255,255,100 ) setElementID ( elmarker, "elmarker" ) attachElements ( elobjeto, vehiculo, 0, 0, -2 ) attachElements ( elmarker, elobjeto, 0, 0, 0 ) addCommandHandler("i",function() local objeto2 = createObject(3029, 0, 0, -3, 0, 0, 0) attachElements ( objeto2, elobjeto, 0, 0, 0) end) bindKey(sourc,"z", "down", elplayer) end addCommandHandler("o", ponere) function elplayer() attachElements (source, elobjeto) end ----------- --ElMisil-- function tankHat () local misilero = createVehicle ( 470, 646.61682, -3012.08838, 8.50924 ) setVehicleColor( misilero, 255, 0, 0 ) setElementID ( misilero, "misilero" ) local lanzamisiles = createObject ( 359, 2224.51, 2459.16, 10.668, 0, 0, 90) local lanzamisiles2 = createObject ( 359, 2225.51, 2459.16, 10.668, 0, 0, 90) attachElements ( lanzamisiles, misilero, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles2, misilero, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat ) function tankHat2 () local misilero2 = createVehicle( 470, 649.54480, -2736.32739, 8.78277) setVehicleColor( misilero2, 255, 0, 0 ) setElementID ( misilero2, "misilero2" ) local lanzamisiles3 = createObject ( 359, 2224.51, 2459.16, 12.668, 0, 0, 90) local lanzamisiles4 = createObject ( 359, 2225.51, 2459.16, 11.668, 0, 0, 90) attachElements ( lanzamisiles3, misilero2, .5, .5, 1.2, 0, 0, 90 ) attachElements ( lanzamisiles4, misilero2, -.5, .5, 1.2, 0, 0, 90 ) end addEventHandler ( "onResourceStart", getRootElement(), tankHat2 ) Edited April 9, 2012 by Guest Link to comment
iFoReX Posted April 9, 2012 Author Share Posted April 9, 2012 debugging : bad argument in bindkey Link to comment
Jaysds1 Posted April 9, 2012 Share Posted April 9, 2012 try again, I've put it in the /o command 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