[Include] gKey - OnPlayerKeyStateChange simplified!
#1

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
keyInsert your key here (without KEY_ in front of it! e.x. KEYHANDLER:SPRINT)
playeridthe playerid pressing the key
type0 = 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;
}

*Download*
http://pastebin.com/DQYR9xbs
Don't forget to also check http://www.gamer93.net/ to donate and/or see more of my work!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)