Jump to content

[HELP] Little help with createProjectile function?


Termycraft

Recommended Posts

Hi to everyone, I'm making a script that makes rockets shoot from ass (xD), the projectile is created, but has a bad (I repeat: BAAD) rotation! Here's the script:

  
setTimer( 
    function() 
        if getControlState("fire") == true then 
            if selWeap == 1 then 
                local x, y, z = getPedBonePosition(getLocalPlayer(), 1) 
                local rot = getPedRotation(getLocalPlayer()) 
                local velRot = rot + 180 
                velRot = velRot + 90 
                velRot = math.rad(velRot) 
                local dirX, dirY = math.cos(velRot), math.sin(velRot) 
                rot = getPedRotation(getLocalPlayer()) + 180 
                createProjectile(getLocalPlayer(), 19, x, y, z, 1, nil, 0, 0, rot, dirX, dirY, 0) 
                setElementData(getLocalPlayer(), "peto", true) 
            end      
        else 
            setElementData(getLocalPlayer(), "peto", false) 
        end 
        for i, players in ipairs(getElementsByType("player")) do 
            if getElementData(players, "peto") == true then 
                local x, y, z = getPedBonePosition(players, 1) 
                local rot = getPedRotation(players) 
                rot = rot + 180 
                rot = rot + 90 
                rot = math.rad(rot) 
                local dirX, dirY = x + math.cos(rot), y + math.sin(rot) 
                dirX, dirY = dirX - x, dirY - y 
                fxAddTankFire(x, y, z, dirX, dirY, 0) 
            end 
        end 
    end 
, 250, 0) 
  

What is the problem? :evil:createProjectile

Everything is working, but it creates the projectile with a rotation of 0, please help me!

:big4:

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...