louie999 Posted October 1, 2015 Share Posted October 1, 2015 Hi, So, is it possible to script a usable turret? like the missile launchers in that Area69/Restricted area part, is it possible to make those usable by a player to shoot down aircraft/enemies ? Thanks in advance... Link to comment
Dealman Posted October 1, 2015 Share Posted October 1, 2015 Aye, it sure is possible. It all depends on how you want to set it up. Arguably making sure it's nicely synced between all clients would be the hardest part. Basically you'll need to use onClientMouseMove to detect whenever the client is aiming the turret left, right, up or down. If you don't want to use the mouse, you can use getKeyState bound to either a timer or the renderer. I wrote something somewhat similar a while ago, but it was for vehicles - but in general it follows the same principle. I'll see if I can dig it up. Link to comment
louie999 Posted October 1, 2015 Author Share Posted October 1, 2015 Aye, it sure is possible. It all depends on how you want to set it up. Arguably making sure it's nicely synced between all clients would be the hardest part.Basically you'll need to use onClientMouseMove to detect whenever the client is aiming the turret left, right, up or down. If you don't want to use the mouse, you can use getKeyState bound to either a timer or the renderer. I wrote something somewhat similar a while ago, but it was for vehicles - but in general it follows the same principle. I'll see if I can dig it up. Ah, nice to know it's possible, but could you give me a simple example on how to do it ? Link to comment
Saml1er Posted October 1, 2015 Share Posted October 1, 2015 I'm not sure how MTA team coded sync stuff but since this is a projectile so its important to sync it. I guess they used TCP to send message to all clients for creating and shooting projectile due to which ping matters a lot in this case. If client is lagging then its a problem but hey that doesn't mean that you cannot make this script. You can code it. I'm on mobile phone. I will write a simple script tomorrow Link to comment
Dealman Posted October 1, 2015 Share Posted October 1, 2015 Ah, nice to know it's possible, but could you give me a simple example on how to do it ? I wrote this a long time ago however, so there's plenty of cleaning and optimizations to be done. 1 Link to comment
louie999 Posted October 2, 2015 Author Share Posted October 2, 2015 @Dealman Nice turret 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