papam77 Posted July 24, 2013 Posted July 24, 2013 function mapa () rocket = createMarker ( 3412.8688964844, -1652.7664794922, 13.254596710205 ) setMarkerSize ( rocket, 5 ) function MarkerHit (element) if (element == getLocalPlayer()) then if (getElementType(element) == "player") then if (isPedInVehicle(element)) then if (source==rocket) then outputChatBox ("#ff9900WARNING!", 255,255,255, true ) createProjectile ( RocketLauncher1, "58", 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 0, 0, 0 ) end end end end end addEventHandler ( "onClientMarkerHit", getRootElement() ,MarkerHit) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), mapa ) Hello guys why this projectiles doesn't work? When i hit marker nothing happend :C
Moderators IIYAMA Posted July 24, 2013 Moderators Posted July 24, 2013 This is the bug I could see by creating the projectile, pls learn to debug your code and write down the warning. /debugscript 3 createProjectile ( RocketLauncher1, "58", 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 0, 0, 0 ) createProjectile ( RocketLauncher1, 58, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 0, 0, 0 )
papam77 Posted July 24, 2013 Author Posted July 24, 2013 WARNING: editor_test\client.lua:15: Bad argument @ 'createProjectile'
Moderators IIYAMA Posted July 24, 2013 Moderators Posted July 24, 2013 The creator doesn't exist, it is required that the creator does exist. createProjectile (nil, 58, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 0, 0, 0 ) createProjectile ( localPlayer, 58, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 0, 0, 0 )
papam77 Posted July 24, 2013 Author Posted July 24, 2013 Doesn't work when i hit with vehicle marker called rocket. Nothing shooted from 3440.1625976563, -1543.6124267578, 32.850193023682 to 3514.0498046875, -1665.0322265625, 18.988582611084
Moderators IIYAMA Posted July 24, 2013 Moderators Posted July 24, 2013 Why don't you read things before you use them? Optional Arguments NOTE: When using optional arguments, you must supply all arguments before the one you wish to use. For more information on optional arguments, see Optional Arguments. posX,posY,posZ: float starting coordinates for the projectile. They are coordinates of creator by default. force: float representing the starting force of the projectile. target: element target used for heat seeking rockets. rotX,rotY,rotZ: float starting rotation for the projectile. velX,velY,velZ: float starting velocity for the projectile. model: Integer representing the projectile's model, uses default model for weaponType if not specified.
Alen141 Posted July 24, 2013 Posted July 24, 2013 localPlayer is not defined, use getLocalPlayer() or define localPlayer local localPlayer = getLocalPlayer()
papam77 Posted July 24, 2013 Author Posted July 24, 2013 I was reading it, but I've changed it now to this function mapa () rocket = createMarker ( 3412.8688964844, -1652.7664794922, 13.254596710205 ) setMarkerSize ( rocket, 5 ) function MarkerHit (element) local vehilce = getVehicleName() if (element == getLocalPlayer()) then if (getElementType(element) == "player") then if (isPedInVehicle(element)) then if (source==rocket) then outputChatBox ("#ff9900WARNING!", 255,255,255, true ) createProjectile ( localPlayer, 58, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 1, 1, 1 ) end end end end end addEventHandler ( "onClientMarkerHit", getRootElement() ,MarkerHit) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), mapa ) and still nothing happend.
Castillo Posted July 24, 2013 Posted July 24, 2013 You want to create a rocket missile to target the player that hit the marker? or a hydra flare?
Moderators IIYAMA Posted July 24, 2013 Moderators Posted July 24, 2013 createProjectile ( localPlayer, 58, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, nil, 3514.0498046875, -1665.0322265625, 18.988582611084, 1, 1, 1 ) Position here we start the rocket, but you already knew that. Rotation this doesn't change anything about the direction of the thing, unless it is a rocket with ID 19 or 20. Direction of speed the starting direction of the projectile, makes it possible to move it to the right direction. Note: Rotations are from 0 t/m 360 degrees.
papam77 Posted July 24, 2013 Author Posted July 24, 2013 I wanna create rocket when player hit a defined marker called 'rocket' and shoot to stone which is defined on 3514.0498046875, -1665.0322265625, 18.988582611084 and from rocket launcher 3440.1625976563, -1543.6124267578, 32.850193023682 with hydra rockets
Castillo Posted July 24, 2013 Posted July 24, 2013 function mapa ( ) rocket = createMarker ( 3412.8688964844, -1652.7664794922, 13.254596710205 ) setMarkerSize ( rocket, 5 ) function MarkerHit ( element ) if ( element == localPlayer and getElementType ( element ) == "player" and isPedInVehicle ( element ) ) then outputChatBox ( "#ff9900WARNING!", 255, 255, 255, true ) createProjectile ( localPlayer, 19, 3440.1625976563, -1543.6124267578, 32.850193023682, 1.0, localPlayer ) end end addEventHandler ( "onClientMarkerHit", rocket, MarkerHit ) end addEventHandler ( "onClientResourceStart", resourceRoot, mapa )
iMr.3a[Z]eF Posted July 24, 2013 Posted July 24, 2013 SolidSnake14: But why localPlayer in two arguments in the function createProjectile?
papam77 Posted July 25, 2013 Author Posted July 25, 2013 It works, ty function mapa ( ) rocket = createMarker ( 3412.8688964844, -1652.7664794922, 13.254596710205 ) setMarkerSize ( rocket, 5 ) function MarkerHit ( element ) if ( element == localPlayer and getElementType ( element ) == "player" and isPedInVehicle ( element ) ) then outputChatBox ( "#ff9900Rocket minigun overheated! Give it a rest pal!", 255, 255, 255, true ) launcher = createProjectile ( localPlayer, 20, 3440.1625976563, -1543.6124267578, 36.850193023682, 100.0, localPlayer, 3514.0498046875, -1665.0322265625, 18.988582611084, 70, -320, -70, Cil ) setProjectileCounter (launcher, 250 ) end end addEventHandler ( "onClientMarkerHit", rocket, MarkerHit ) end addEventHandler ( "onClientResourceStart", resourceRoot, mapa ) And where can set projectile Speed ?
Castillo Posted July 25, 2013 Posted July 25, 2013 You can set the projectile velocity arguments: velX, velY, velZ: float starting velocity for the projectile.
papam77 Posted July 25, 2013 Author Posted July 25, 2013 But it is rotation, I am using this for Rotations to rocket
Castillo Posted July 25, 2013 Posted July 25, 2013 Well, is not for that, there's also rotation arguments.
papam77 Posted July 26, 2013 Author Posted July 26, 2013 I guess, that will be good to add to next version setProjectileSpeed
Moderators IIYAMA Posted July 26, 2013 Moderators Posted July 26, 2013 createProjectile ( creator, weaponType , posX, posY, posZ, force = 1.0, target, rotX, rotY, rotZ, velX, velY, velZ, model )
papam77 Posted July 26, 2013 Author Posted July 26, 2013 Force isn't speed, force is destruction power.
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