Lo ъnico que se me ocurre es detectar si el jugador alcanzу cierta distancia en un tiempo imposible, algo asн:
PHP Code:
new PosicionesAnticheat[MAX_PLAYERS][3];
public OnGameModeInit()
{
SetTimer("anti_tp_hack", 1000, true);
}
forward anti_tp_hack(playerid);
public anti_tp_hack(playerid)
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i)) // Esto puedes cambiarlo por si tienes una variable que identifique si el jugador ya spawneo, estб logueado o algo asн por el estilo.
{
if(GetPlayerDistanceFromPoint(i, PosicionesAnticheat[i][0], PosicionesAnticheat[i][1], PosicionesAnticheat[i][2]) > 20.0) // Si el jugador alcanzу mбs de 20 metros en menos de 1 segundo, es hack. Edita a tu gusto, ya que a mн me parece que asн estб bien.
{
SendClientMessage(i, -1, "Hack de teletransportaciуn detectado, kickeado.");
Kick(i);
}
GetPlayerPos(i, PosicionesAnticheat[i][0], PosicionesAnticheat[i][1], PosicionesAnticheat[i][2]);
}
}
return true;
}
El parche no estб al 100% obviamente, dado que cuando uses
SetPlayerPos el sistema no detectarб eso, por tanto lo tomarб como
hack. En ese caso lo que puedes hacer es
hookear y hacer que actualice la variable de las posiciones de los jugadores, o si no crear una funciуn como
SetPlayerPosEx que ahн actualice la posiciуn, algo asн:
PHP Code:
SetPlayerPosEx(playerid, Float:x, Float:y, Float:z)
{
GetPlayerPos(playerid, PosicionesAnticheat[playerid][0], PosicionesAnticheat[playerid][1], PosicionesAnticheat[playerid][2]);
return SetPlayerPos(playerid, x, y, z);
}
Si optas por йste, sуlo tienes que cambiar todos los
SetPlayerPos del
GM por
SetPlayerPosEx.