Jump to content

Something in Lua resembling C's "getchar"


Guest Aeolius

Recommended Posts

Evening, folks. I'm working on my first MTA script right now (and my first Lua script in general), and I am working with some pretty well-developed game ideas that have had time to mature in SA:MP. Thing is, PAWN's getchar functionality is broken in SA:MP, so I never really had the chance to explore a few of my more ambitious plans. To cut to the chase, does Lua have anything like getchar (for those unfamiliar, a native function which waits for the input of a keystroke from the user, then returns the result), and if so, is it implemented in MTA?

Thanks in advance!

Link to comment

If i understood you correctly, MTA has implemented its own bindKey function which is what you should be looking for. It allows detecting keypresses to Controls (e.g. any keys associated to GTA's "fire") or the Keys themselves (e.g. left mouse button).

Depending on the situation, functions getKeyState and getControlState may or may not be useful to you.

The documentation should be easy to follow, but if you get stuck feel free to post!

Link to comment

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