How to disable the option for key pressing
#1

Hello there,
I am trying to limit the use of F11 and F12 keys on the keyboard but I don't know how.
I looked into :
https://sampwiki.blast.hk/wiki/GetPlayerKeys
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/Keys


but in the list of keys only the keys from the Single Player apear not any key from the keyboard.
Reply
#2

Unfortunately, https://sampwiki.blast.hk/wiki/Keys pretty much contains the keys which you can only use at the moment.

I hear rumors that people have workarounds but generally they are either private or working for a single client lol.
Reply
#3

I saw on servers that if you press 'Y' for example it starts a rolling animation or something like that.
Anyone know how to? does it work Like C# of sorts?
Reply
#4

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_YES))
    {
        // Functions here.
        SetPlayerPos(playerid, 0.0, 0.0, 0.0); // If pressed Y, teleport him here. for example.
    }
    return 1;
}
OnPlayerKeyStateChange(playerid, newstate, oldstate)

SA-MP Keys
Reply
#5

Quote:
Originally Posted by HY
Посмотреть сообщение
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_YES))
    {
        // Functions here.
        SetPlayerPos(playerid, 0.0, 0.0, 0.0); // If pressed Y, teleport him here. for example.
    }
    return 1;
}
OnPlayerKeyStateChange(playerid, newstate, oldstate)

SA-MP Keys
That I saw on the samp wiki but that wont help me I need something like

Код:
if(KeyCode_F12 == PRESSED)
{
//Do the Thing
}

Basically this will see if the Key on the Keyboard 'F12" is pressed, when it is do something within the "IF".
I need it for like when a player Uses F12 Key and stuff, The "Y" key was a example...
Reply
#6

Yeah, the "Y" on the keyboard is equivalent to "KEY_YES".
Reply
#7

Sorry I edited my last post, it consists the "F12" Key, not the Y key.
Reply
#8

Quote:
Originally Posted by ThatThoseTheThy
Посмотреть сообщение
Sorry I edited my last post, it consists the "F12" Key, not the Y key.
I'm pretty much sure that it's not yet available to be manipulated script-wise. There could be some who do workarounds in order to control those "F" keys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)