How to do these Key Checks?
#1

I was planning on a Rushing System, i wanted it to check if u "Double Tapped W","Double Tapped W + Sprint". and other related keys, i think its possible but i don't know how because I'm not really used to key based things
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

This should open up a whole new world for you then.
Reply
#3

I know how to do some of those but i want a bit more of a Specific Answer
Reply
#4

wrote this quickly

pawn Код:
#define KEY_W -128

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_W)
    {
        if(GetPVarInt(playerid, "lastkey") != KEY_W) SetPVarInt(playerid, "lastkey", KEY_W);
        else
        {
            SetPVarInt(playerid, "pressedwtwice", 1);
            // they've hit w twice in a row
        }
        return 1;
    }
    if(newkeys & KEY_SPRINT)
    {
        if(GetPVarInt(playerid, "pressedwtwice") == 1)
        {
            // they have pressed w twice in a row and then sprint
            SetPVarInt(playerid, "pressedwtwice", 0);
        }
        return 1;
    }
    SetPVarInt(playerid, "lastkey", 65535);
    SetPVarInt(playerid, "pressedwtwice", 0);
    return 1;
}
Reply
#5

I wanted a "Holding Sprint + Double Tap W" but ill do that myself
Haven't tested yet because i'm lazy but thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)