16.01.2014, 19:23
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.
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.
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;
}
[uL]Pottus - Instead of GetTickCount you could have used gettime.