Anti Teleport hax - Unknown123 - 05.06.2011
Code
pawn Код:
new Float:LastPosition[MAX_PLAYERS][3];
new TeleportWarnings[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Hacks", 1000, true);
return 1;
}
forward Hacks();
public Hacks()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInRangeOfPoint(i, 400.0, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]) && EnteredInterior[i] == 0 && GetPlayerState(i) != PLAYER_STATE_PASSENGER && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID)
{
SendClientMessage(i, 0xFF0000FF, "You hack :(");
TeleportWarnings[i] ++;
if(TeleportWarnings[i] >= 3)
{
BanEx(i, "Teleporting");
}
}
GetPlayerPos(i, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]);
}
}
return 1;
}
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:angle, interiorid = 0)
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, angle);
SetPlayerInterior(playerid, interiorid);
SetCameraBehindPlayer(playerid);
}
When i use "SetPlayerPosEx" to teleport to a place, then it sais 'You hack
'
But it is not supposed to that.
It should say "You hack
" only if im not in range of old posision and if i didnt use "SetPlayerPosEx"
Re: Anti Teleport hax -
Mauzen - 05.06.2011
Create a variable like
new tpallowed[MAX_PLAYERS];
and set it to 1 for the player before you teleport him in SetPlayerPosEx. Then when a hack gets detected after the long if line check if that variable is set for the player. If yes, reset it to 0 and end it, else detect him as a hacker.
Re: Anti Teleport hax - Unknown123 - 05.06.2011
pawn Код:
new Float:LastPosition[MAX_PLAYERS][3];
new TeleportWarnings[MAX_PLAYERS];
new TeleportAllowed[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Hacks", 1000, true);
return 1;
}
forward Hacks();
public Hacks()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInRangeOfPoint(i, 400.0, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]) && EnteredInterior[i] == 0 && GetPlayerState(i) != PLAYER_STATE_PASSENGER && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID && TeleportAllowed[i] == 1)
{
SendClientMessage(i, 0xFF0000FF, "You hack :(");
TeleportWarnings[i] ++;
if(TeleportWarnings[i] >= 3)
{
BanEx(i, "Teleporting");
}
}
GetPlayerPos(i, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]);
}
}
return 1;
}
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:angle, interiorid = 0)
{
TeleportAllowed[playerid] = 1;
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, angle);
SetPlayerInterior(playerid, interiorid);
SetCameraBehindPlayer(playerid);
TeleportAllowed[playerid] = 1;
}
if you mean like that, it dont work
Re: Anti Teleport hax -
Mauzen - 05.06.2011
Better do it like this:
pawn Код:
new Float:LastPosition[MAX_PLAYERS][3];
new TeleportWarnings[MAX_PLAYERS];
new TeleportAllowed[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Hacks", 1000, true);
return 1;
}
forward Hacks();
public Hacks()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInRangeOfPoint(i, 400.0, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]) && EnteredInterior[i] == 0 && GetPlayerState(i) != PLAYER_STATE_PASSENGER && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID)
{
if (!TeleportAllowed[playerid]) {
SendClientMessage(i, 0xFF0000FF, "You hack :(");
TeleportWarnings[i] ++;
if(TeleportWarnings[i] >= 3)
{
BanEx(i, "Teleporting");
}
} else TeleportAllowed[playerid] = 0;
}
GetPlayerPos(i, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]);
}
}
return 1;
}
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:angle, interiorid = 0)
{
TeleportAllowed[playerid] = 1;
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, angle);
SetPlayerInterior(playerid, interiorid);
SetCameraBehindPlayer(playerid);
}
Or even better with a timer that sets TeleportAllowed[playerid] to 0 after a few seconds. But this way should also do it.
Re: Anti Teleport hax - Unknown123 - 05.06.2011
Dont work
this say that im hacking
pawn Код:
new Float:LastPosition[MAX_PLAYERS][3];
new TeleportWarnings[MAX_PLAYERS];
new TeleportAllowed[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Hacks", 1000, true);
return 1;
}
forward Hacks();
public Hacks()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerInRangeOfPoint(i, 400.0, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]) && EnteredInterior[i] == 0 && GetPlayerState(i) != PLAYER_STATE_PASSENGER && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID && TeleportAllowed[i] == 1)
{
if(TeleportAllowed[i] == 0)
{
SendClientMessage(i, 0xFF0000FF, "You hack :(");
TeleportWarnings[i] ++;
if(TeleportWarnings[i] >= 3)
{
BanEx(i, "Teleporting");
}
}
else
{
SetTimerEx("TeleportFix", 1500, false, "i", i);
}
}
GetPlayerPos(i, LastPosition[i][0], LastPosition[i][1], LastPosition[i][2]);
}
}
return 1;
}
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:angle, interiorid = 0)
{
TeleportAllowed[playerid] = 1;
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, angle);
SetPlayerInterior(playerid, interiorid);
SetCameraBehindPlayer(playerid);
}
forward TeleportFix(playerid);
public TeleportFix(playerid)
{
TeleportAllowed[playerid] = 0;
return 1;
}