Search the Community
Showing results for tags 'createprojectile'.
-
I do not know if something is missing but the missile does not activate me: Rocket in the shamal from the createprojectile, I do not know if it would be wrong but I pass the file if you can see function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) -- Only create projectile if we are inside a vehicle if(519)then local x, y, z = getElementPosition(519) createProjectile(519, 19, x, y, z) end end bindKey("Ctrl", "down", shootProjectile) Insert image from URL
- 1 reply
-
- createprojectile
- help
-
(and 1 more)
Tagged with:
-
Hola, quisiera saber si hay alguna manera de obtener las posiciones de impacto X (hitX) impacto Y (hitY) e impactio Z (hitZ) de un proyectil creado con "createProjectile"
-
Hello i have problem with createprojectile when i make Rustler bomber and S.W.AT Tank he is blowing up. Sorry for my bad english What is my problem in Script? w, h = guiGetScreenSize () local function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end local poses = { [531] = {0, 0, 0}, } addEvent("cl_bulletSpawn", true) addEventHandler("cl_bulletSpawn",getRootElement(),function(x, y, z, player) createProjectile(player,19,x,y,z+3) end) function fireBTR() local veh = getPedOccupiedVehicle(localPlayer) if isElement(veh) and getElementModel(veh) == 531 then local xv,yv,zv = getElementVelocity(veh) local mid = getElementModel(veh) local x,y,z = getPositionFromElementOffset(veh, poses[mid][1],poses[mid][2],poses[mid][3]+math.abs(zv*5)) x,y = x+xv*5, y+yv*5 triggerServerEvent("sv_bulletSpawn", getRootElement(), x, y, z, localPlayer) end end bindKey("mouse1","down",fireBTR) function disableFireSwat ( theVehicle, seat ) if ( getElementModel ( theVehicle ) == 531 ) then toggleControl ( "vehicle_fire", false ) else toggleControl ( "vehicle_fire", true ) end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), disableFireSwat ) function disableFireSwat1 ( theVehicle, seat ) if ( getElementModel ( theVehicle ) == 531 ) then toggleControl ( "lctrl_fire", false ) else toggleControl ( "lctrl_fire", true ) end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), disableFireSwat1 ) function renderVehCross () local veh = getPedOccupiedVehicle(localPlayer) if isElement(veh) and getElementModel(veh) == 531 then dxDrawImage (w/2-32, h/2-90,64,64,"shotgun.png",0,0,0) end end addEventHandler('onClientRender', root, renderVehCross ) Server addEvent("sv_bulletSpawn", true) addEventHandler("sv_bulletSpawn",getRootElement(),function(x, y, z, player) triggerClientEvent("cl_bulletSpawn", getRootElement(), x, y, z, player) end) function crb(source) local x,y,z = getElementPosition(source) veh = createVehicle(601,x,y,z) vehCol = createColSphere(x,y,z,2) attachElements ( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"MAX_Slots",50) --Engine + Tires setElementData(vehCol,"Tire_inVehicle",6) setElementData(vehCol,"Engine_inVehicle",1) setElementData(vehCol,"Parts_inVehicle",1) for i=1,1 do setElementData(vehCol,"engineHealth_"..i,1000) end for i=1,1 do setElementData(vehCol,"partHealth_"..i,1000) end for i=1,6 do setElementData(vehCol,"tireHealth_"..i,1000) end setElementData(vehCol,"fuel",200) end addCommandHandler("btr",crb) how to fix it?
-
How to compute Velocity vector of Vehicle turret relative to Global World? I did some calculations and this is what I have been able to reach: local lrotX, lrotY = getVehicleTurretPosition(occupiedVehicle) -- Compute local 3D vector from bearing and elevation math local tVx,tVy,tVz = math.cos(lrotX) * math.cos(lrotY), math.sin(lrotX) * math.cos(lrotY), math.sin(lrotY) Maybe I need to calculate the difference of rotation angles turret and my vehicle, and then to compute Vector by formula above?
- 18 replies
-
Как мне получить вектор направления башни (S.W.A.T. автомобиль) относительно глобальной системы координат, для установки вектора velocity в createProjectile? Единственное, что на данный момент мне удалось сделать, это высчитать вектор башни, относительно самого транспорта. Я это вижу, как вычисление разницы вектора velocity автомобиля и вектора башни, однако не совсем уверен, что это так и как правильно это просчитать (проводил некоторые тесты с getElementVelocity автомобиля). local lrotX, lrotY = getVehicleTurretPosition(occupiedVehicle) -- Compute 3D vector from bearing and elevation math local tVx,tVy,tVz = math.cos(lrotX) * math.cos(lrotY), math.sin(lrotX) * math.cos(lrotY), math.sin(lrotY)