gKey - OnPlayerKeyStateChange simplified! -
gamer931215 - 24.09.2011
gKeys
*About*
Hey guys, since i was a bit bored and got some inspiration, i decided to make gKeys!
It is just like zcmd/gDialog, a shortcut with a easyer way of using player hotkeys!
*Callbacks*
pawn Код:
KEYHANDLER:key(playerid,type)
{
return 1;
}
| Information |
KEYHANDLER: | Will define the callback for the given key |
key | Insert your key here (without KEY_ in front of it! e.x. KEYHANDLER:SPRINT) |
playerid | the playerid pressing the key |
type | 0 = holding, 1 = pressed, 2 = released (please note that pressed will also be called when the player is holding a key!) |
*Example usage*
pawn Код:
//Example filterscript showing how to create a repair key with gKeys (numpad +)
#include <a_samp>
#include <gKeys>
KEYHANDLER:SUBMISSION(playerid,type)
{
if(type == 2) //if the key is released
{
RepairVehicle(GetPlayerVehicleID(playerid));
GameTextForPlayer(playerid,"~y~Your ~g~vehicle ~y~has been ~r~repaired ~y~!",3000,4);
}
return 1;
}
Re : gKey - OnPlayerKeyStateChange simplified! -
Naruto_Emilio - 24.09.2011
i love you (no gay) this is epic.
Re: gKey - OnPlayerKeyStateChange simplified! -
TheArcher - 24.09.2011
Very useful good job gamer.
Re: gKey - OnPlayerKeyStateChange simplified! -
Wesley221 - 24.09.2011
Nice
Way easier then using the OnPlayerKeyStateChange IMO; gonna be useful!
Thanks
Re: gKey - OnPlayerKeyStateChange simplified! -
Bumbis - 24.09.2011
It's supporting arrow keys(GetPlayerKeys)?
Re: gKey - OnPlayerKeyStateChange simplified! -
gamer931215 - 24.09.2011
Quote:
Originally Posted by Bumbis
It's supporting arrow keys(GetPlayerKeys)?
|
KEY_UP, KEY_DOWN, KEY_LEFT and KEY_RIGHT are supported (took the keys from the SA-MP wiki) so i guess it does!
Edit: Just tested it, those keys didnt work...
will maybe make a fix tomorrow
Re : gKey - OnPlayerKeyStateChange simplified! -
bousla7e - 25.09.2011
good work man, really nice
Re: gKey - OnPlayerKeyStateChange simplified! -
MisterTickle - 25.09.2011
Any speed advantage?
Re: gKey - OnPlayerKeyStateChange simplified! -
Toni - 25.09.2011
Quote:
Originally Posted by MisterTickle
Any speed advantage?
|
I wouldn't imagine so, but it appears that CallLocalFunction is used, so I'm not exactly sure if it's the same with key detection.
Re: gKey - OnPlayerKeyStateChange simplified! -
aRoach - 25.09.2011
It's very Useful, i gotta use this
+REP
Re: gKey - OnPlayerKeyStateChange simplified! -
[MWR]Blood - 25.09.2011
Indeed useful and simplified.
Good job, gamer!
Re: gKey - OnPlayerKeyStateChange simplified! -
Generation-X - 25.09.2011
Nice idea; is there any way to make it faster?
Re: gKey - OnPlayerKeyStateChange simplified! -
wups - 25.09.2011
Quote:
Originally Posted by gamer931215
KEY_UP, KEY_DOWN, KEY_LEFT and KEY_RIGHT are supported (took the keys from the SA-MP wiki) so i guess it does!
Edit: Just tested it, those keys didnt work...
will maybe make a fix tomorrow
|
These work only with GetPlayerKeys.
Re: gKey - OnPlayerKeyStateChange simplified! -
Jafet_Macario - 25.09.2011
Nice.
Re: gKey - OnPlayerKeyStateChange simplified! -
Lorenc_ - 25.09.2011
Quote:
Originally Posted by Generation-X
Nice idea; is there any way to make it faster?
|
It might be hard though calling it simply like a function:
DoThisCode(playerid);
Re: gKey - OnPlayerKeyStateChange simplified! -
KoczkaHUN - 25.09.2011
Nice include.
Suggestion: make an array to store which keyhandlers are exist. Then check if it exists (under OPKS), and call function.
Re: gKey - OnPlayerKeyStateChange simplified! -
iPLEOMAX - 25.09.2011
Another cool release. Thanks Gamer!
Re: gKey - OnPlayerKeyStateChange simplified! -
Edvin - 25.09.2011
Good Work!