Jump to content

Usable turret?


louie999

Recommended Posts

Posted

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... :)

Posted

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.

Posted
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 ? :?

Posted

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 :)

Posted
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. :lol:

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...