Admigo Posted January 25, 2012 Share Posted January 25, 2012 Dear Mta Scripters, I need 3 codes for this rocket shooting code: addCommandHandler("boom",function() local occupiedVehicle = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(occupiedVehicle) local matrix = getElementMatrix(occupiedVehicle) local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] vx = offX - x vy = offY - y vz = offZ - z local rotx, roty, rotz = getElementRotation(occupiedVehicle) createProjectile(getLocalPlayer(), 19, x, y, z+1, 500, nil, 0, 0, 360 - rotz, vx, vy, vz) end) 1.How can i change this command into a key(that i need to press left button to shoot) 2.How can i only use this command(key) every 4 seconds? 3.How can i change the distance of the rocket(that the rocket can shoot a long distance) I hope someone help me with this. Thanks Admigo Link to comment
Castillo Posted January 25, 2012 Share Posted January 25, 2012 canShoot = true bindKey("M","down",function() if (not canShoot) then return end local occupiedVehicle = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(occupiedVehicle) local matrix = getElementMatrix(occupiedVehicle) local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] vx = offX - x vy = offY - y vz = offZ - z local rotx, roty, rotz = getElementRotation(occupiedVehicle) createProjectile(getLocalPlayer(), 19, x, y, z+1, 500, nil, 0, 0, 360 - rotz, vx, vy, vz) canShoot = false setTimer(function () canShoot = true end, 4000, 1) end) About third question, I don't get it. 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