SA-MP Forums Archive
Key mapping in scripted form - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Key mapping in scripted form (/showthread.php?tid=643188)



Key mapping in scripted form - Mobtiesgangsa - 15.10.2017

i was doing re-search in the wiki forum normaly it was explained in chart form i dont have no idea how to script a fs to do key-mapping.

example when i press 2 i want to repair my car or lock/unlock it


Re: Key mapping in scripted form - Kraeror - 15.10.2017

Read this: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange !
There is the callback! And here are all the keys you can use: https://sampwiki.blast.hk/wiki/Keys


Re: Key mapping in scripted form - Twizted - 15.10.2017

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_FIRE) {
        //change KEY_FIRE to the desired key —  https://sampwiki.blast.hk/wiki/Keys
        //Code to perform if they is pressed.  
    }
    return 1;
}
Something like this is what you should be looking for (I didn't compile it, but it should be working). I suggest you read through Kraeror's first link though.