Jump to content

createProjectile // Error


papam77

Recommended Posts

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

Link to comment
  • Moderators

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 ) 

Link to comment
  • Moderators

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 ) 

Link to comment
  • Moderators

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.

Link to comment

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.

Link to comment
  • Moderators

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.

Link to comment

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

Link to comment
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 ) 

Link to comment

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 ?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...