SA-MP Forums Archive
Am I doing something wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Am I doing something wrong? (/showthread.php?tid=318042)



Am I doing something wrong? - T0pAz - 13.02.2012

pawn Код:
new Float:Position[3];
            GetPlayerPos(i, Position[0], Position[1], Position[2]);
            if(GetPVarInt(i, "teleport") == 0)
            {
                SetTimerEx("CheckTeleportHack", 4000, false, "ifff", i, Position[0], Position[1], Position[2]);
            }
pawn Код:
forward CheckTeleportHack(playerid, Float:A, Float:B, Float:C);
public CheckTeleportHack(playerid, Float:A, Float:B, Float:C)
{
    new Float:Po[3];
    GetPlayerPos(playerid, Po[0], Po[1], Po[2]);
    if(GetDistanceBetweenPoints(Po[0], Po[1], Po[2], A, B, C) == 100.0)
    {
        format(str, sizeof(str), "%s may using teleport/airbrake hack.", PI[playerid][username]);
        SendMessageToAdmins(COLOR_RED, str);
    }
}
pawn Код:
stock Float:GetDistanceBetweenPoints(Float:rx1,Float:ry1,Float:rz1,Float:rx2,Float:ry2,Float:rz2)
{
    return floatadd(floatadd(floatsqroot(floatpower(floatsub(rx1,rx2),2)),floatsqroot(floatpower(floatsub(ry1,ry2),2))),floatsqroot(floatpower(floatsub(rz1,rz2),2)));
}
It doesn't detect if a player has used teleport hack or not. I think I've done a silly mistake.