Detecting Auto Aim[0.3z only] -
BenTaylorUK - 17.01.2014
As it was needed on the server I work with, I thought I may aswell share it with others, but be warned, the way this is coded is for the server i work with, I will explain what it wont do.
Because it detects the camera mode (GetPlayerCameraMode), and is set to 53, it will only work on weapons like Pistol, SMG, Carbine... and not things like Sniper and Rocket Launcher.
This is only for 0.3z as it uses OnPlayerWeaponShot, this code was about 10 minutes of work, so if its slow or whatever, I apologize as I am quite new to scripting... but here you go.
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new string[128];
new cmode = GetPlayerCameraMode(playerid);
new target = GetPlayerTargetPlayer(playerid); //Reports as 65535 if auto aim is being used.
if( hittype == BULLET_HIT_TYPE_PLAYER )
{
if( GetPlayerState(target) == PLAYER_STATE_WASTED || GetPlayerState(hitid) == PLAYER_STATE_WASTED)
{
SCM(playerid, -1, "This player is dead");
return 0;
}
if( cmode == 53 )
{
if( hitid != target)
{
format(string, sizeof(string), "ID:%d may be using a controller or autoaim.", playerid);
SendClientMessageToAll(-1, string);
return 0;
}
}
}
return 1;
}
And here is a proof of concept video.
[ame]http://www.youtube.com/watch?v=PyInvWL229A[/ame]
Any feedback will be helpful so I can improve
Re: Detecting Controllers[0.3z only] -
Pottus - 17.01.2014
Whats the point of that non-sense?
https://sampforum.blast.hk/showthread.php?tid=254295
Re: Detecting Auto Aim[0.3z only] -
BenTaylorUK - 17.01.2014
Quote:
Originally Posted by [uL]Pottus
|
Well, that only detects the movement motions, for people who want to use controllers, but need to be limited from actually auto aim shooting, does that not make sense?
As I said above, I made this for a server where controllers are allowed, but people dont want controllers auto aiming people, which that code, does not do.
In addition, people can still enable joypad mode, and auto aim with keyboard and mouse, this stops the auto-aiming.
Can a forum staff member rename the thread to Auto Aim instead of Controllers please?
Re: Detecting Controllers[0.3z only] -
Jefff - 17.01.2014
Good idea but should be
pawn Код:
if( GetPlayerState(hitid) == PLAYER_STATE_WASTED || GetPlayerState(target) == PLAYER_STATE_WASTED)
not
pawn Код:
if( GetPlayerState(target) == PLAYER_STATE_WASTED || GetPlayerState(hitid) == PLAYER_STATE_WASTED)
because target is INVALID_PLAYER_ID in this case ?
Re: Detecting Controllers[0.3z only] -
Swisher - 17.01.2014
this is the dumbest tutorial ever. lock this
Re: Detecting Controllers[0.3z only] -
ACI - 17.01.2014
Quote:
Originally Posted by Swisher
this is the dumbest tutorial ever. lock this
|
You're a noob, so you
should know you should not judge anyone by anyway. First, look at your skills then speak. This tutorial made me aware of this detection feature in SA-MP! I thought it was not possible, Nice.
Re: Detecting Controllers[0.3z only] -
[WA]iRonan - 17.01.2014
Good job Ben, this is pretty usefull.
Re: Detecting Controllers[0.3z only] -
Hansrutger - 17.01.2014
I don't really understand the code actually to this... How does it actually detect that it's a joypad?
Re: Detecting Controllers[0.3z only] -
Rifa4life - 21.01.2014
Quote:
Originally Posted by Swisher
this is the dumbest tutorial ever. lock this
|
And you belong to the dumbest people around this forum. If you don't like his work, then have the manners to at least not dis it.
Plus, this could be a lot more efficient than checking for using a joypad OnPlayerUpdate, because the latter is called every god damn second, whereas if you put it under this function it is only used when needed. But that's if you only need to detect auto-aim. I think that suffices.