24.06.2018, 09:08
I'm trying to make a ANTI Teleport Hack, but i got some problems
It's so simple, get player position, after sometime check if player is in a valid range
If this range is so high and player was not teleported for a server command (SetPlayerPosEx)
It punish the teleport hack
But i'm stuck in the part to if player use server command, dont detect was a hacker
The values here:
Should be (i used /save in the same place i've got this string /\ ):
But instead of it, its showing:
Full code:
What do i doing wrong?
It's so simple, get player position, after sometime check if player is in a valid range
If this range is so high and player was not teleported for a server command (SetPlayerPosEx)
It punish the teleport hack
But i'm stuck in the part to if player use server command, dont detect was a hacker
The values here:
Код:
format(string, sizeof(string), "Xtp[%i], Ytp[%i], Ztp[%i]", Xtp[playerid], Ytp[playerid], Ztp[playerid] );
Код:
-25.3970,-185.8796,1003.5469
Код:
[05:50:29] Xtp[-1043649266], Ytp[-1019616979], Ztp[1148904192]
Код:
stock SetPlayerPosEx(playerid,Float:x,Float:y,Float:z,Float:angle,int,vw, bool:carregar = false) {
// update anti TP (to dont detect)
Xtp[playerid] = x;
Ytp[playerid] = y;
Ztp[playerid] = z;
INTtp[playerid] = int;
VWtp[playerid] = vw;
//
SetPlayerInterior(playerid,int);
SetPlayerVirtualWorld(playerid, vw);
SetPlayerPos(playerid, x,y,z);
if(angle == 0) SetCameraBehindPlayer(playerid);
if(carregar == true) PlayerCarregando(playerid);
// active anti TP
ContadorTeleport[playerid] = SetTimerEx("DetectTeleport", 50, false, "i", playerid);
return 1;
}
forward CheckTeleport(playerid); public CheckTeleport(playerid) {
KillTimer(ContadorTeleport[playerid]);
if(IsPlayerConnected(playerid) && playerid != INVALID_PLAYER_ID) {
GetPlayerPos(playerid, Xtp[playerid], Ytp[playerid], Ztp[playerid]);
INTtp[playerid] = GetPlayerInterior(playerid);
VWtp[playerid] = GetPlayerVirtualWorld(playerid);
ContadorTeleport[playerid] = SetTimerEx("DetectTeleport", 500, false, "i", playerid);
}
}
forward DetectTeleport(playerid); public DetectTeleport(playerid) {
KillTimer(ContadorTeleport[playerid]);
if(gSpectateID[playerid] == 65535 && paused[playerid] == false) {
if(!IsPlayerInRangeOfPoint(playerid, 60.0, Xtp[playerid], Ytp[playerid], Ztp[playerid])) {
new string[128];
format(string, sizeof(string), "Xtp[%i], Ytp[%i], Ztp[%i]", Xtp[playerid], Ytp[playerid], Ztp[playerid] );
ABroadCast(-1,string,3);
format(string, sizeof(string), "HACK: %s TELEPORT", PlayerName(playerid) );
ABroadCast(-1,string,3);
SetPlayerPosEx(playerid, Xtp[playerid], Ytp[playerid], Ztp[playerid], 0, INTtp[playerid], VWtp[playerid]);
}
}
ContadorTeleport[playerid] = SetTimerEx("CheckTeleport", 500, false, "i", playerid);
}


