Stranger Posted March 27, 2014 Posted March 27, 2014 hello, how can i make when the player (ped) aiming on something like 'vehicle' be destroyed , or anything !
Stranger Posted March 27, 2014 Author Posted March 27, 2014 i did it like that: setTimer (function (player) target = getPedTarget (player) if getElementType (target) == "vehicle" then destroyElement (target) end end, 500,0) but not working !
Moderators IIYAMA Posted March 27, 2014 Moderators Posted March 27, 2014 of course it isn't working. The variable player is nil is nothing and useless, when you don't define it. setTimer (function () local players = getElementsByType("player") for i=1,#players do local player = players[i] local target = getPedTarget (player) if target and getElementType (target) == "vehicle" then destroyElement (target) end end end, 500,0)
Stranger Posted March 27, 2014 Author Posted March 27, 2014 will, it's work, but not like what i said, i said i want it when someone aiming on the vehicle with weapon the vehicle will be destroyed.
Moderators IIYAMA Posted March 27, 2014 Moderators Posted March 27, 2014 I am not going to make it exact as you want, it is your code. Use: https://wiki.multitheftauto.com/wiki/GetControlState To check if somebody is aiming.
Moderators IIYAMA Posted March 27, 2014 Moderators Posted March 27, 2014 onPlayerTarget event is way better. Not really since that only get triggered when a player change from target and not when he starts aiming. The best result would be using bindkey, but will require more bandwidth.
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