Stranger Posted March 27, 2014 Share Posted March 27, 2014 hello, how can i make when the player (ped) aiming on something like 'vehicle' be destroyed , or anything ! Link to comment
Stranger Posted March 27, 2014 Author Share 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 ! Link to comment
Moderators IIYAMA Posted March 27, 2014 Moderators Share 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) Link to comment
Stranger Posted March 27, 2014 Author Share 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. Link to comment
Moderators IIYAMA Posted March 27, 2014 Moderators Share 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. Link to comment
WhoAmI Posted March 27, 2014 Share Posted March 27, 2014 onPlayerTarget event is way better. Link to comment
Moderators IIYAMA Posted March 27, 2014 Moderators Share 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. 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