darhal Posted March 22, 2015 Posted March 22, 2015 Hi there, I want to ask if there is any way to manage the direction of the rocket created by createProjectile function ! because i made a script using this function the rocket dont go to the correct direction ! I use setCameraMatrix it s work but when i move its failed ! #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
MIKI785 Posted March 22, 2015 Posted March 22, 2015 Just read the wiki, there are rotational arguments "rotX, rotY, rotZ: float starting rotation for the projectile.". IF you mean changing the direction after the rocket is fired i don't think that's possible. Lua Scripter Owner of mshost.cz MTA portal.
darhal Posted March 22, 2015 Author Posted March 22, 2015 I already read the wiki I m here firing at a specific x, y, z coordonation #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Enargy, Posted March 22, 2015 Posted March 22, 2015 What do you want to do with setCameraMatrix? - Inactivo.
darhal Posted March 22, 2015 Author Posted March 22, 2015 well I just use it to correct the direction of the rocket and it s work only when I m idle #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Mr.unpredictable. Posted March 23, 2015 Posted March 23, 2015 getElementPosition getElementMatrix getElementRotation this won't help setCameraMatrix
darhal Posted March 23, 2015 Author Posted March 23, 2015 How this will help give me example please #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Mr.unpredictable. Posted March 23, 2015 Posted March 23, 2015 my formatting sucks but here's one example bindKey("vehicle_fire", "down", function() local assholeinvehcile = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(assholeinvehcile) local m = getElementMatrix(assholeinvehcile) local offX = 0 * m[1][1] + 1 * m[2][1] + 0 * m[3][1] + 1 * m[4][1] local offY = 0 * m[1][2] + 1 * m[2][2] + 0 * m[3][2] + 1 * m[4][2] local offZ = 0 * m[1][3] + 1 * m[2][3] + 0 * m[3][3] + 1 * m[4][3] vx = offX - x vy = offY - y vz = offZ - z local rotx, roty, rotz = getElementRotation(assholeinvehcile) createProjectile(getLocalPlayer(), 19, x+1, y-0.5, z+0.8, 5000, nil, 0, 0, 360 - rotz, vx, vy, vz) ------- not sure on which angle it is firing, just edit it. end)
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