Miyuru Posted November 11, 2020 Share Posted November 11, 2020 (edited) function cdoshoot() if bindTrigger == 1 then if not isPedDead(cLP) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 3000, 1) end end end This is my shooting script. And I want to detect player onPlayerWasted and repair him and give money! Thank you. Edited November 11, 2020 by Miyuru Link to comment
xPeacefulDreams Posted November 18, 2020 Share Posted November 18, 2020 Can you explain a bit more what the script does and maybe share the entire script? For example, I see a function called allowshoots being called but no function in the code. Are you trying to give the player that shot money, or the player that got killed? If the player got killed, it might be better to give the money upon onPlayerSpawn The quick answer is you could add something like this: addEventHandler(‘onPlayerWasted’, getRootElement(), function(attacker) if attacker == (some check here if it is a projectile) then setElementHealth(source,100) givePlayerMoney(source,100) end ) 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