-Blaze- Posted February 16, 2016 Share Posted February 16, 2016 hello , i'm trying to make an object move that has a colshape attached to it and if any ped hits that object while it's moving , it dies. function bindall (guy) bindKey(guy, "mouse1", "down", shootProjectile, guy) end addCommandHandler("bindit", bindall) function shootProjectile(guy) local length = 100 local x, y, z = getElementPosition( guy ) local _, _, rz = getElementRotation( guy ) local tx = x + - ( length ) * math.sin( math.rad( rz ) ) local ty = y + length * math.cos( math.rad( rz ) ) local tz = z local obj = createObject ( 1369, x, y , z + 0.5, 0, 90, rz+90) local theCol = createColSphere ( x, y, z , 2 ) setElementData( theCol, "spearColOwner", guy) attachElements( theCol, obj , 0, 0, 0) setElementParent(theCol,obj) setPedAnimation( guy, "GRENADE", "WEAPON_throw", 500, false, false, false, false) moveObject ( obj, 1500, tx, ty, tz) end function onHit(player) theOwner = getElementData(source,"spearColOwner") or false if (theOwner == false) then return end if((theOwner == player)) then return end killPed(player) end addEventHandler("onColShapeHit", root,onHit) The problem is that when i shoot the object out , it passes through the ped but ped doesn't get killed. I used setDevelopmentMode and /showcol to check the col position and everything is in place , exept the col doesn't detect anything that entered it. However , if i shoot about 10 cols at the same time , the Ped dies. it's pretty crazy . Any help? 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