Joypad gives almost 100% accuracy now.
#1

I am not sure is this worth posting on here, since probably most people don't care, but anyone else tried turning on joypad option on this 0.3z client version?
It pretty much gives 100% accuracy on most weapons. It makes game kinda unfair for players without the joypad, on previous versions it wasn't such a big problem since it was lagging all the time, but now when lag is fixed joypads are going to be a big problem in DM servers.
I know detection can be scripted, but sometimes it is not accurate, I think there should be native function to completely disable joypad.

Since 0.3z is not fully finished yet, maybe someone on devs team will notice this topic and will consider to do something about it in future release candidate versions.
Reply
#2

It's actually pretty easy to fix this at least for joypads only let me demonstrate, I'll post my solution in about 10 minutes time here.
Reply
#3

You absolutely right, man. Thanks for suggestion, I think devs should do this, because it`s one of the most needable things in samp.
Reply
#4

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
It's actually pretty easy to fix this at least for joypads only
This should be fixed by SA:MP as default.
It's pretty weird why the scripters have to fix this "issues"
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=254295

Look at that, if they're using a joypad, either kick them, warn them, or do whatever you wish.
Reply
#6

Try this it will limit the rate in which a joypad users shots will be synced. No I didn't really test it yet I don't have or know anyone with a joypad but I'm pretty sure it's correct just make sure you include it near the top of your script. Let me know if there is any problems.

pawn Код:
#define         SHOOTING_DELAY          300

static bool:JoyPadder[MAX_PLAYERS];
static LastShootTime[MAX_PLAYERS];

forward HasJoyPad(playerid);
public HasJoyPad(playerid) { return JoyPadder[playerid]; }

public OnPlayerConnect(playerid)
{
    JoyPadder[playerid] = false;
    return CallLocalFunction("JoyDelay_OnPlayerConnect", "i", playerid);
}

public OnPlayerUpdate(playerid)
{
    if(!JoyPadder[playerid])
    {
        new keys, ud, lr;
        GetPlayerKeys(playerid, keys, ud, lr);
        if((ud != 128 && ud != 0 && ud != -128) || (lr != 128 && lr != 0 && lr != -128)) JoyPadder[playerid] = true;
    }
    return CallLocalFunction("JoyDelay_OnPlayerUpdate", "i", playerid);
}

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(JoyPadder[playerid])
    {
        if(GetTickCount() - LastShootTime[playerid] < SHOOTING_DELAY) return 0;
        else LastShootTime[playerid] = GetTickCount();
    }
    return CallLocalFunction("JoyDelay_OnPlayerWeaponShot", "iiiifff", playerid, weaponid, hittype, hitid, fX, fY, fZ);
}

// Connect hooking
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect JoyDelay_OnPlayerConnect

// Player update hooking
#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate JoyDelay_OnPlayerUpdate

// Weapon shot hooking
#if defined _ALS_OnPlayerWeaponShot
    #undef OnPlayerWeaponShot
#else
    #define _ALS_OnPlayerWeaponShot
#endif
#define OnPlayerWeaponShot JoyDelay_OnPlayerWeaponShot
Reply
#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
#8

holy pawn. i expected some new functions, not this mindfuck )
Reply
#9

Quote:
Originally Posted by hub4
Посмотреть сообщение
holy pawn. i expected some new functions, not this mindfuck )
It's very simple lol.

gettime() does not provide enough precision to be useful unfortunately.
Reply
#10

Quote:
Originally Posted by hub4
Посмотреть сообщение
holy pawn. i expected some new functions, not this mindfuck )
Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
It's very simple lol.
True it is simple like us, but for beginners it is not.
Reply
#11

Quote:
Originally Posted by PawnoQ
View Post
for e.g. reallife/rp servers its a lot more comfortable to use joypad then the keyboard as u can lean back an relax.
A bit offtopic, but lean back and relax with a joypad on rp servers?
I thought RP was a lot about roleplaying, and this includes a lot of texting. I wouldnt call switching between joypad and keyboard all the time 'comfortable'

Disabling or checking the joypad setting COULD be a way, but hackers could easily change the setting without doing it in the menu. And something like GetPlayerJoypadSetting could be spoofed (though, Ive never heard of hacks that actually spoof functions like that)


Another possible way would be to check the camera movement speeds. Autoaim will have an extremely smooth movement, again much smoother than anyone could reach with a mouse (unless the mouse is motorized with a high precision gear ) This would need pretty much testing and research, but could be more efficient than checking the aim precision itself.
Reply
#12

ofc there are advantages and disadvantages but to simply "ban" joypad without having a choice as scripter to recover it would be pretty heavy in my opinion...
Reply
#13

People could use joypads with mouse emulators. So control is still the same, just without the autoaiming.
Most of these emulators just need to be downloaded and are ready. The server could link to one and provide a ready-to-use config.

BTW: random123 tested the cameramode method, and it doesnt work
Quote:
Originally Posted by random123
View Post
Yes I tested this, with multiple people, it shows as 53 weather you are on joypad or keyboard and mouse settings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)