Joypad gives almost 100% accuracy now.
#7

Base on the link above, I have made your work easier, I will not guarantee that this is 100% accurate, also wait for [uL]Pottus code, it maybe more accurate than mine.

pawn Код:
/*
    declaring a stock, boolean and per-player variable, we use stock to avoid any warnings from the variable, and we use boolean
    because we only use two (2) stuff which is true or false.
*/


new stock
    bool:AC_Joypad[ MAX_PLAYERS ] = {false, ...} //much better if you use y_bits or rBits, because you could save some memory.
;
 
/*
    the stock MUST be above of the script, because we are using boolean tag or else it will give us -
    a warning "warning 208: function with tag result used before definition, forcing reparse" or declare
    the "IsPlayerUsingJoypad" function as a callback.
*/

stock bool:IsPlayerUsingJoypad(playerid)
{
    if( AC_Joypad[playerid] == true ) return true;
    else return false;
}

public OnPlayerUpdate(playerid)
{
    //Checking Playerkeys.
    new Arr[3]; GetPlayerKeys(playerid, Arr[0], Arr[1], Arr[2]);
    if( (Arr[1] != 128 && Arr[1] != 0 && Arr[1] != -128) || (Arr[2] != 128 && Arr[2] != 0 && Arr[2] != -128) )
    {
        AC_Joypad[playerid] = true;
    }
    else
    {
        AC_Joypad[playerid] = false;
    }

    //Checking if player is using Joypack, or not.
    if( IsPlayerUsingJoypad (playerid) )
    {
        SendClientMessage(playerid, -1, "[DEBUG - WARNING] - Joypad detected, please use your keypad and mouse!");
    }
    return true;
}
EDIT: I was writing my comment and I pressed Post and saw [uL]Pottus's code, it works the same but he has more complicated stuff such as ALS_Hooking, try my and [uL]Pottus and you decide but I suggest you use [uL]Pottus's code because it has more accurate checking and stuff.

[uL]Pottus - Instead of GetTickCount you could have used gettime.
Reply


Messages In This Thread
Joypad/Autoaim gives almost 100% accuracy now. - by T-N-Z - 16.01.2014, 19:01
Re: Joypad gives almost 100% accuracy now. - by Pottus - 16.01.2014, 19:03
Re: Joypad gives almost 100% accuracy now. - by DreDasLT - 16.01.2014, 19:04
AW: Re: Joypad gives almost 100% accuracy now. - by NetKiel - 16.01.2014, 19:07
Re: Joypad gives almost 100% accuracy now. - by 2KY - 16.01.2014, 19:18
Re: Joypad gives almost 100% accuracy now. - by Pottus - 16.01.2014, 19:21
Re: Joypad gives almost 100% accuracy now. - by Patrick - 16.01.2014, 19:23
Re: Joypad gives almost 100% accuracy now. - by hub4 - 16.01.2014, 19:24
Re: Joypad gives almost 100% accuracy now. - by Pottus - 16.01.2014, 19:26
Re: Joypad gives almost 100% accuracy now. - by Patrick - 16.01.2014, 19:27
Re: Joypad gives almost 100% accuracy now. - by Mauzen - 16.01.2014, 22:13
Re: Joypad gives almost 100% accuracy now. - by PawnoQ - 16.01.2014, 22:32
Re: Joypad gives almost 100% accuracy now. - by Mauzen - 16.01.2014, 22:40

Forum Jump:


Users browsing this thread: 1 Guest(s)