25.06.2014, 07:10
This is the problem:
If any one of the first 3 online players are not within range it will give you a false warning. So if you had 7 players online (ID 0, 1, 2, 4, 6, 7,
. If you shot ID 6, it would run through ID 0 (TimesDetected = 1), ID 1 (TimesDetected = 2), ID 2 (TimeDetected = 3 - Gives warning) etc. So it will give you a warning before it even reaches ID 6. Give this a shot:
pawn Код:
foreach(Player, i)
{
if(GetPlayerState(i) != PLAYER_STATE_SPECTATING)
{
if(!IsPlayerInRangeOfPoint(i, 3.0, fX, fY, fZ))
{
TimesDetected[playerid]++;
if(TimesDetected[playerid] >= 3)
{
format(string, sizeof(string), "WARNING: %s(%d) is POSSIBLY using aimbot. /spec %d and /atest %d to test him.", GetName(playerid), playerid, playerid, playerid);
//SendClientMessageToAll(COLOR_NOTES2, string);
DetectedForAimbot{ playerid } = true;
}
}
}
}

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
TimesShot[playerid]++;
if(TimesShot[playerid] < 20)
{
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(!IsAFK{hitid})
{
if(!CoolDown[playerid])
{
new Float:fOriginX, Float:fOriginY, Float:fOriginZ, Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ;
GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
CheckForAimbot(playerid, fHitPosX, fHitPosY, fHitPosZ, hitid);
}
}
}
}
return 1;
}
CheckForAimbot(playerid, Float:fX, Float:fY, Float:fZ, attacked = INVALID_PLAYER_ID)
{
if(!CoolDown[playerid])
{
if(!DetectedForAimbot{playerid})
{
if(attacked != INVALID_PLAYER_ID)
{
if(!IsPlayerInRangeOfPoint(attacked, 3.0, fX, fY, fZ))
{
TimesDetected[playerid]++;
if(TimesDetected[playerid] >= 3)
{
new string[110];
format(string, sizeof(string), "WARNING: %s(%d) is POSSIBLY using aimbot. /spec %d and /atest %d to test him.", GetName(playerid), playerid, playerid, playerid);
SendClientMessageToAll(COLOR_NOTES2, string);
DetectedForAimbot{playerid} = true;
}
}
}
}
}
return 1;
}