GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
OnPlayerWeaponShot(...., Float:fX, Float:fY, Float:fZ)
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);
}
}
}
}
return 1;
}
stock CheckForAimbot(playerid, Float:fX, Float:fY, Float:fZ)
{
new string[118], Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
if(!CoolDown[playerid])
{
if(!DetectedForAimbot{ playerid })
{
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;
}
}
}
}
if(TimesDetected[playerid] >= 3)
{
SendClientMessageToAll(COLOR_NOTES2, string);
}
}
}
string = "\0";
}
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;
}
}
}
}
. 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: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;
}
|
This is the problem:
pawn Код:
. 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 Код:
|