SA-MP Forums Archive
Anti Cheat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Anti Cheat (/showthread.php?tid=420506)



Anti Cheat - mailu - 05.03.2013

Hola

Tengo una duda, como puedo hacer un anti cheat de velocidad?
OnPlayerUpdate?

O con un timer?
Alguna funcion para detectar la velocidad?

Saludos


Respuesta: Anti Cheat - Daniel_Ruiz - 05.03.2013

Agrega esto en OnGamemodeInit

pawn Код:
SetTimer("AntiSpeedHack",1000,1);
y Esto al Final de tu Gm

pawn Код:
forward AntiSpeedHack();
public AntiSpeedHack()
{
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
{
if(ObtenerVelocidad(i)> 230)
{
switch(GetVehicleModel(GetPlayerVehicleID(i)))
{
case 0,511,460,592,577,512,513,520,553,593,476,519: printf("[ID: %d] Manejando %d Con velocidad de %skm/h",i,GetVehicleModel(GetPlayerVehicleID(i)),ObtenerVelocidad(i));
default:
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
SendClientMessage(i, 0xFF0000FF,"Servidor: No hagas SpeedHack, o quieres ban?");
RemovePlayerFromVehicle(i);
SetPlayerPos(i, X, Y, Z+5);
}
}
}
}
}
stock ObtenerVelocidad(playerid)
{
new Float:PosX, Float:PosY, Float:PosZ, Float:PlayerSpeedDistance;
GetVehicleVelocity(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
PlayerSpeedDistance = floatmul(floatsqroot(floatadd(floatadd(floatpower( PosX, 2), floatpower(PosY, 2)), floatpower(PosZ, 2))), 170.0);
new spe = floatround(PlayerSpeedDistance * 1);
return spe;
}



Respuesta: Anti Cheat - Glimma - 05.03.2013

Quote:
Originally Posted by Daniel_Ruiz
Посмотреть сообщение
Agrega esto en OnGamemodeInit

pawn Код:
SetTimer("AntiSpeedHack",1000,1);
y Esto al Final de tu Gm

pawn Код:
forward AntiSpeedHack();
public AntiSpeedHack()
{
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
{
if(ObtenerVelocidad(i)> 230)
{
switch(GetVehicleModel(GetPlayerVehicleID(i)))
{
case 0,511,460,592,577,512,513,520,553,593,476,519: printf("[ID: %d] Manejando %d Con velocidad de %skm/h",i,GetVehicleModel(GetPlayerVehicleID(i)),ObtenerVelocidad(i));
default:
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
SendClientMessage(i, 0xFF0000FF,"Servidor: No hagas SpeedHack, o quieres ban?");
RemovePlayerFromVehicle(i);
SetPlayerPos(i, X, Y, Z+5);
}
}
}
}
}
stock ObtenerVelocidad(playerid)
{
new Float:PosX, Float:PosY, Float:PosZ, Float:PlayerSpeedDistance;
GetVehicleVelocity(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
PlayerSpeedDistance = floatmul(floatsqroot(floatadd(floatadd(floatpower( PosX, 2), floatpower(PosY, 2)), floatpower(PosZ, 2))), 170.0);
new spe = floatround(PlayerSpeedDistance * 1);
return spe;
}
Йste que puso Daniel_Ruiz es muy bueno, lo hizo tribisk_transk, su funciуn es simple, al sobrepasar la velocidad de 230 km/h es detectado que el jugador que maneja utiliza cheat de speedhack, debido a que es el mбximo de velocidad a la que llega un vehнculo (vйase cars.cfg) que en realidad son el Turismo e Infernus, ademбs de que hay excepciones por si son aviones.

Йste anticheat tiene un desperfecto, cuando un jugador que maneje con un vehнculo usando cheat, detectarб que los pasajeros tambiйn utiliza cheat y los expulsarб del vehнculo.

Yo a ese mismo en lugar de usarlo con un timer lo utilizarнa con OnPlayerUpdate (en caso de que el guardado de datos no se use con OnPlayerUpdate) asн lo detecta mбs rбpido el cheat.


Respuesta: Anti Cheat - Fluid016 - 05.03.2013

Se arregla fбcilmente con esta condiciуn:

pawn Код:
if (GetPlayerState(i) == PLAYER_STATE_DRIVER)



Re: Anti Cheat - mailu - 06.03.2013

Gracias!
Si funciona muy bien el AC