Jump to content

projectiles help


John Smith

Recommended Posts

Posted

im trying to make a marker and when player hits marker from one of area 51 rocket objects come projectiles and it should go to the player position but instead it goes to random positions

function createMissiles() 
missileMarker = createMarker(355.373046875,1944.513671875,17.640625,"corona",1.5,255,0,0,255) -- create red corona 
end 
addCommandHandler("missile",createMissiles) 
  
function triggerMissiles(hitPlayer,matchingDimension) 
if source == missileMarker then 
local x,y,z = getElementPosition(hitPlayer) 
setTimer(function() 
 createProjectile(localPlayer,20,354.0361328125,2027.9912109375,26.000198364258,nil,hitPlayer,0,90,0,1,1,1) 
end,250,0) 
end 
end 
addEventHandler("onClientMarkerHit",getRootElement(),triggerMissiles) 

please help

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

i need to make multiple missiles thats why im using a timer but i dont know how to make createProjectile with all those arguments inside a timer...

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

What? You actually shouldn't even create projectiles like this because it will create it multiple times (for each client).. try it this way:

function createMissiles() 
missileMarker = createMarker(355.373046875,1944.513671875,17.640625,"corona",1.5,255,0,0,255) -- create red corona 
end 
addCommandHandler("missile",createMissiles) 
  
function triggerMissiles(hitPlayer,matchingDimension) 
if source == missileMarker and hitPlayer == localPlayer then 
local x,y,z = getElementPosition(hitPlayer) 
setTimer(function() 
 createProjectile(localPlayer,20,354.0361328125,2027.9912109375,26.000198364258,nil,localPlayer,0,90,0,1,1,1) 
end,250,0) 
end 
end 
addEventHandler("onClientMarkerHit",getRootElement(),triggerMissiles) 

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

Posted

it works same like it did before

and also like before its still like this

projectile changes rotation of movement depending on my position but they go in sky far far away and they dont come to ground at all

i just want to make it realistic so when player hits marker it creates projectile from a51 rocket launcher object and sends projectile onto my position

and i am not sure how to do it... it goes in wrong direction

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

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