Jump to content

projectiles help


John Smith

Recommended Posts

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

Link to comment

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) 

Link to comment

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

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